00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 __title__ ="Revision3";
00026 __mashup_title__ = "rev3"
00027 __author__="R.D. Vaughan"
00028 __version__="0.15"
00029
00030
00031
00032
00033
00034
00035
00036 __usage_examples__ ='''
00037 (Option Help)
00038 > ./rev3.py -h
00039 Usage: ./rev3.py -hduvlST [parameters] <search text>
00040 Version: v0.1.2 Author: R.D.Vaughan
00041
00042 For details on the MythTV Netvision plugin see the wiki page at:
00043 http://www.mythtv.org/wiki/MythNetvision
00044
00045 Options:
00046 -h, --help show this help message and exit
00047 -d, --debug Show debugging info (URLs, raw XML ... etc, info
00048 varies per grabber)
00049 -u, --usage Display examples for executing the script
00050 -v, --version Display grabber name and supported options
00051 -l LANGUAGE, --language=LANGUAGE
00052 Select data that matches the specified language fall
00053 back to English if nothing found (e.g. 'es' EspaƱol,
00054 'de' Deutsch ... etc). Not all sites or grabbers
00055 support this option.
00056 -p PAGE NUMBER, --pagenumber=PAGE NUMBER
00057 Display specific page of the search results. Default
00058 is page 1. Page number is ignored with the Tree View
00059 option (-T).
00060 -S, --search Search for videos
00061 -T, --treeview Display a Tree View of a sites videos
00062
00063 > ./rev3.py -v
00064 <grabber>
00065 <name>Revision3</name>
00066 <author>R.D.Vaughan</author>
00067 <thumbnail>rev3.png</thumbnail>
00068 <type>video</type>
00069 <description>Revision3 is the leading television network for the internet generation.</description>
00070 <version>v0.13</version>
00071 <search>true</search>
00072 <tree>true</tree>
00073 </grabber>
00074
00075 > ./rev3.py -S "iPad" -p 1
00076 <?xml version="1.0" encoding="UTF-8"?>
00077 <rss version="2.0" xmlns:amp="http://www.adobe.com/amp/1.0"
00078 xmlns:atom="http://www.w3.org/2005/Atom"
00079 xmlns:cnettv="http://cnettv.com/mrss/"
00080 xmlns:content="http://purl.org/rss/1.0/modules/content/"
00081 xmlns:creativecommons="http://backend.userland.com/creativeCommonsRssModule"
00082 xmlns:dc="http://purl.org/dc/elements/1.1/"
00083 xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/">
00084 <channel>
00085 <title>Revision3</title>
00086 <link>http://revision3.com/</link>
00087 <description>Revision3 is the leading television network for the internet generation.</description>
00088 <numresults>16</numresults>
00089 <returned>15</returned>
00090 <startindex>15</startindex>
00091 <item>
00092 <title>AppJudgment &gt; Episode 101 &gt; Voice Band for the ...</title>
00093 <author>Revision3</author>
00094 <pubDate>Mon, 05 Apr 2010 23:10:47 GMT</pubDate>
00095 <description>AppJudgment: Voice Band for the iPhone/iPod Touch - &lt;br /&gt; &lt;br /&gt; AppJudgment:&lt;br /&gt; Download&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; Voice Band&lt;br /&gt; &lt;br /&gt; Version 1.1 ...</description>
00096 <link>http://revision3.com/appjudgment/ip_mau_voiceband/voice-band-for-the-iphone-ipod-touch?fs</link>
00097 <mrss:group xmlns:mrss="http://search.yahoo.com/mrss/">
00098 <mrss:thumbnail url=""/>
00099 <mrss:content duration="" height="" lang=""
00100 url="http://revision3.com/appjudgment/ip_mau_voiceband/voice-band-for-the-iphone-ipod-touch?fs" width=""/>
00101 </mrss:group>
00102 <rating>0.0</rating>
00103 </item>
00104 ...
00105 <item>
00106 <title>The Totally Rad Show &gt; Episode 150: Hockey Kahn ...</title>
00107 <author>Revision3</author>
00108 <pubDate>Mon, 05 Apr 2010 23:10:47 GMT</pubDate>
00109 <description>The Totally Rad Show: Hockey Kahn - Edge of Darkness, MAG, iPad Gaming, the End of Miramax, and More Twitter Q&amp;A - We walk the Edge of Darkness with Mel Gibson. MAG ...</description>
00110 <link>http://revision3.com/trs/hockeykhan?fs</link>
00111 <mrss:group xmlns:mrss="http://search.yahoo.com/mrss/">
00112 <mrss:thumbnail url=""/>
00113 <mrss:content duration="" height="" lang=""
00114 url="http://revision3.com/trs/hockeykhan?fs" width=""/>
00115 </mrss:group>
00116 <rating>0.0</rating>
00117 </item>
00118 </channel>
00119 </rss>
00120
00121 > ./rev3.py -T
00122 <?xml version="1.0" encoding="UTF-8"?>
00123 <rss version="2.0" xmlns:amp="http://www.adobe.com/amp/1.0"
00124 xmlns:atom="http://www.w3.org/2005/Atom"
00125 xmlns:cnettv="http://cnettv.com/mrss/"
00126 xmlns:content="http://purl.org/rss/1.0/modules/content/"
00127 xmlns:creativecommons="http://backend.userland.com/creativeCommonsRssModule"
00128 xmlns:dc="http://purl.org/dc/elements/1.1/"
00129 xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/">
00130 <channel>
00131 <title>Revision3</title>
00132 <link>http://revision3.com/</link>
00133 <description>Revision3 is the leading television network for the internet generation.</description>
00134 <numresults>1</numresults>
00135 <returned>1</returned>
00136 <startindex>1</startindex>
00137 <directory name="Revision3" thumbnail="/usr/local/share/mythtv/mythnetvision/icons/revision3.png">
00138 <directory name="Best Of... (HD MP4)" thumbnail="http://bitcast-a.bitgravity.com/revision3/images/shows/bestof/bestof.jpg">
00139 <item>
00140 <title>Hick - How to Train Your Dragon - Best Of...</title>
00141 <author>feedback@revision3.com (Revision3)</author>
00142 <pubDate>Fri, 02 Apr 2010 00:00:00 GMT</pubDate>
00143 <description>Dreamworks Animation has played second fiddle to the Pixar juggernaut for years...</description>
00144 <link>http://revision3.com/bestof/trs-0158</link>
00145 <mrss:group xmlns:mrss="http://search.yahoo.com/mrss/">
00146 <mrss:thumbnail url="http://bitcast-a.bitgravity.com/revision3/images/shows/bestof/0501/bestof--0501--trs-0158--mini.thumb.jpg"/>
00147 <mrss:content duration="338" height="" lang="en"
00148 url="http://www.podtrac.com/pts/redirect.mp4/bitcast-a.bitgravity.com/revision3/web/bestof/0501/bestof--0501--trs-0158--hd.h264.mp4" width=""/>
00149 </mrss:group>
00150 <rating>0.0</rating>
00151 </item>
00152 ...
00153 <item>
00154 <title>What Should You Know: Revision3 Beta</title>
00155 <author/>
00156 <pubDate>Wed, 10 Sep 2008 20:25:30 GMT</pubDate>
00157 <description>So when someone comes up to you and asks if you know about Revision3 Beta. This is what you should say... http://wsyk.opensermo.com</description>
00158 <link>http://revision3beta.com/watch/wsyk/4dcf948a/</link>
00159 <media:group>
00160 <media:thumbnail url="http://cdn-ll-80.viddler.com/e2/thumbnail_2_4dcf948a.jpg"/>
00161 <media:content duration="" height="" lang=""
00162 url="http://revision3beta.com/watch/wsyk/4dcf948a/" width=""/>
00163 </media:group>
00164 <rating>0.0</rating>
00165 </item>
00166 </directory>
00167 </directory>
00168 </channel>
00169 </rss>
00170 '''
00171 __search_max_page_items__ = 15
00172 __tree_max_page_items__ = 15
00173
00174 import sys, os
00175
00176
00177 class OutStreamEncoder(object):
00178 """Wraps a stream with an encoder"""
00179 def __init__(self, outstream, encoding=None):
00180 self.out = outstream
00181 if not encoding:
00182 self.encoding = sys.getfilesystemencoding()
00183 else:
00184 self.encoding = encoding
00185
00186 def write(self, obj):
00187 """Wraps the output stream, encoding Unicode strings with the specified encoding"""
00188 if isinstance(obj, unicode):
00189 try:
00190 self.out.write(obj.encode(self.encoding))
00191 except IOError:
00192 pass
00193 else:
00194 try:
00195 self.out.write(obj)
00196 except IOError:
00197 pass
00198
00199 def __getattr__(self, attr):
00200 """Delegate everything but write to the stream"""
00201 return getattr(self.out, attr)
00202 sys.stdout = OutStreamEncoder(sys.stdout, 'utf8')
00203 sys.stderr = OutStreamEncoder(sys.stderr, 'utf8')
00204
00205
00206
00207
00208 try:
00209 '''Import the common python class
00210 '''
00211 import nv_python_libs.common.common_api as common_api
00212 except Exception, e:
00213 sys.stderr.write('''
00214 The subdirectory "nv_python_libs/common" containing the modules common_api.py and
00215 common_exceptions.py (v0.1.3 or greater),
00216 They should have been included with the distribution of MythNetvision
00217 Error(%s)
00218 ''' % e)
00219 sys.exit(1)
00220 if common_api.__version__ < '0.1.3':
00221 sys.stderr.write("\n! Error: Your current installed common_api.py version is (%s)\nYou must at least have version (0.1.3) or higher.\n" % target.__version__)
00222 sys.exit(1)
00223
00224
00225
00226 try:
00227 '''Import the python Rev3 support classes
00228 '''
00229 import nv_python_libs.rev3.rev3_api as target
00230 except Exception, e:
00231 sys.stderr.write('''
00232 The subdirectory "nv_python_libs/rev3" containing the modules rev3_api.py and
00233 rev3_exceptions.py (v0.1.0 or greater),
00234 They should have been included with the distribution of rev3.py.
00235 Error(%s)
00236 ''' % e)
00237 sys.exit(1)
00238 if target.__version__ < '0.1.0':
00239 sys.stderr.write("\n! Error: Your current installed rev3_api.py version is (%s)\nYou must at least have version (0.1.0) or higher.\n" % target.__version__)
00240 sys.exit(1)
00241
00242
00243 try:
00244 import nv_python_libs.mainProcess as process
00245 except Exception, e:
00246 sys.stderr.write('''
00247 The python script "nv_python_libs/mainProcess.py" must be present.
00248 Error(%s)
00249 ''' % e)
00250 sys.exit(1)
00251
00252 if process.__version__ < '0.2.0':
00253 sys.stderr.write("\n! Error: Your current installed mainProcess.py version is (%s)\nYou must at least have version (0.2.0) or higher.\n" % process.__version__)
00254 sys.exit(1)
00255
00256 if __name__ == '__main__':
00257
00258 apikey = ""
00259
00260 target.baseProcessingDir = os.path.dirname( os.path.realpath( __file__ ))
00261
00262 target.common = common_api.Common()
00263 main = process.mainProcess(target, apikey, )
00264 main.grabberInfo = {}
00265 main.grabberInfo['title'] = __title__
00266 main.grabberInfo['command'] = u'rev3.py'
00267 main.grabberInfo['mashup_title'] = __mashup_title__
00268 main.grabberInfo['author'] = __author__
00269 main.grabberInfo['thumbnail'] = 'rev3.png'
00270 main.grabberInfo['type'] = ['video', ]
00271 main.grabberInfo['desc'] = u"Revision3 is the leading television network for the internet generation."
00272 main.grabberInfo['version'] = __version__
00273 main.grabberInfo['search'] = True
00274 main.grabberInfo['tree'] = True
00275 main.grabberInfo['html'] = False
00276 main.grabberInfo['usage'] = __usage_examples__
00277 main.grabberInfo['SmaxPage'] = __search_max_page_items__
00278 main.grabberInfo['TmaxPage'] = __tree_max_page_items__
00279 main.main()