26 __mashup_title__ =
"hulu"
27 __author__=
"R.D. Vaughan"
34 __usage_examples__ =
'''
37 Usage: ./hulu.py -hduvlST [parameters] <search text>
38 Version: v0.1.1 Author: R.D.Vaughan
40 For details on the MythTV Netvision plugin see the wiki page at:
41 http://www.mythtv.org/wiki/MythNetvision
44 -h, --help show this help message and exit
45 -d, --debug Show debugging info (URLs, raw XML ... etc, info
47 -u, --usage Display examples for executing the script
48 -v, --version Display grabber name and supported options
49 -l LANGUAGE, --language=LANGUAGE
50 Select data that matches the specified language fall
51 back to English if nothing found (e.g. 'es' Español,
52 'de' Deutsch ... etc). Not all sites or grabbers
54 -p PAGE NUMBER, --pagenumber=PAGE NUMBER
55 Display specific page of the search results. Default
56 is page 1. Page number is ignored with the Tree View
58 -S, --search Search for videos
59 -T, --treeview Display a Tree View of a sites videos
64 <author>R.D.Vaughan</author>
65 <thumbnail>hulu.png</thumbnail>
67 <description>Hulu.com is a free online video service that offers hit TV shows including Family Guy, 30 Rock, and the Daily Show with Jon Stewart, etc.</description>
68 <version>v0.11</version>
73 > ./hulu.py -S "Burn Notice"
74 <?xml version="1.0" encoding="UTF-8"?>
75 <rss version="2.0" xmlns:amp="http://www.adobe.com/amp/1.0"
76 xmlns:atom="http://www.w3.org/2005/Atom"
77 xmlns:cnettv="http://cnettv.com/mrss/"
78 xmlns:content="http://purl.org/rss/1.0/modules/content/"
79 xmlns:creativecommons="http://backend.userland.com/creativeCommonsRssModule"
80 xmlns:dc="http://purl.org/dc/elements/1.1/"
81 xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/">
84 <link>http://hulu.com</link>
85 <description>Hulu.com is a free online video service that offers hit TV shows including Family Guy, 30 Rock, and the Daily Show with Jon Stewart, etc.</description>
86 <numresults>25</numresults>
87 <returned>21</returned>
88 <startindex>21</startindex>
90 <title>Burn Notice - A Dark Road</title>
92 <pubDate>Mon, 25 Jan 2010 17:45:06 GMT</pubDate>
93 <description>Commentary with Matt Nix</description>
94 <link>http://www.hulu.com/watch/122855/burn-notice-a-dark-road#http%3A%2F%2Fwww.hulu.com%2Ffeed%2Fsearch%3Fquery%3DBurn%2BNotice%2Bdate%253Anewest%26sort_by%3Drelevance%26st%3D0</link>
95 <mrss:group xmlns:mrss="http://search.yahoo.com/mrss/">
96 <mrss:thumbnail url="http://thumbnails.hulu.com/231/50029231/140025_145x80_generated.jpg"/>
97 <mrss:content duration="05:19" height="" lang=""
98 url="http://www.hulu.com/watch/122855/burn-notice-a-dark-road#http%3A%2F%2Fwww.hulu.com%2Ffeed%2Fsearch%3Fquery%3DBurn%2BNotice%2Bdate%253Anewest%26sort_by%3Drelevance%26st%3D0" width=""/>
104 <title>Burn Notice - s3 | e15 - Good Intentions</title>
106 <pubDate>Sat, 27 Feb 2010 03:05:06 GMT</pubDate>
107 <description>Fiona seems to get more than she bargained for when she becomes involved with a paranoid kidnapper, only to discover that he's more than what he appears.</description>
108 <link>http://www.hulu.com/watch/131000/burn-notice-good-intentions#http%3A%2F%2Fwww.hulu.com%2Ffeed%2Fsearch%3Fquery%3DBurn%2BNotice%2Bdate%253Anewest%26sort_by%3Drelevance%26st%3D0</link>
109 <mrss:group xmlns:mrss="http://search.yahoo.com/mrss/">
110 <mrss:thumbnail url="http://thumbnails.hulu.com/183/50037183/148491_145x80_generated.jpg"/>
111 <mrss:content duration="43:32" height="" lang=""
112 url="http://www.hulu.com/watch/131000/burn-notice-good-intentions#http%3A%2F%2Fwww.hulu.com%2Ffeed%2Fsearch%3Fquery%3DBurn%2BNotice%2Bdate%253Anewest%26sort_by%3Drelevance%26st%3D0" width=""/>
120 <?xml version="1.0" encoding="UTF-8"?>
121 <rss version="2.0" xmlns:amp="http://www.adobe.com/amp/1.0"
122 xmlns:atom="http://www.w3.org/2005/Atom"
123 xmlns:cnettv="http://cnettv.com/mrss/"
124 xmlns:content="http://purl.org/rss/1.0/modules/content/"
125 xmlns:creativecommons="http://backend.userland.com/creativeCommonsRssModule"
126 xmlns:dc="http://purl.org/dc/elements/1.1/"
127 xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/">
130 <link>http://hulu.com</link>
131 <description>Hulu.com is a free online video service that offers hit TV shows including Family Guy, 30 Rock, and the Daily Show with Jon Stewart, etc.</description>
132 <numresults>1</numresults>
133 <returned>1</returned>
134 <startindex>1</startindex>
135 <directory name="Hulu" thumbnail="/usr/local/share/mythtv/mythnetvision/icons/hulu.png">
136 <directory name="Hulu - Recently added videos" thumbnail="/usr/local/share/mythtv/mythnetvision/icons/hulu.png">
138 <title>NBC TODAY Show - Mood Meds Pose ‘Weighty’ Issue</title>
139 <author>MSNBC</author>
140 <pubDate>Wed, 07 Apr 2010 14:54:05 GMT</pubDate>
141 <description>While battling depression, Lauren Slater faced a tough choice: She could take a prescription that would improve her mood, but it would make her gain weight. She discusses her experience with psychiatrist Dr. Catherine Birndorf and Dr. Nancy Snyderman.</description>
142 <link>http://rss.hulu.com/~r/HuluRecentlyAddedVideos/~3/ExUXTu_hOTo/nbc-today-show-mood-meds-pose-%E2%80%98weighty%E2%80%99-issue</link>
143 <mrss:group xmlns:mrss="http://search.yahoo.com/mrss/">
144 <mrss:thumbnail url="http://thumbnails.hulu.com/931/50046931/159024_145x80_generated.jpg"/>
145 <mrss:content duration="05:05" height="" lang=""
146 url="http://rss.hulu.com/~r/HuluRecentlyAddedVideos/~3/ExUXTu_hOTo/nbc-today-show-mood-meds-pose-%E2%80%98weighty%E2%80%99-issue" width=""/>
152 <title>X-Play - Top 4 Open World Games of 2008</title>
154 <pubDate>Thu, 10 Apr 2008 04:06:27 GMT</pubDate>
155 <description>X-Play brings you their list of the most anticipated sandbox games for this year.</description>
156 <link>http://www.hulu.com/watch/16729/x-play-top-4-open-world-games-of-2008#http%3A%2F%2Fwww.hulu.com%2Ffeed%2Fexpiring%2Fvideos</link>
157 <mrss:group xmlns:mrss="http://search.yahoo.com/mrss/">
158 <mrss:thumbnail url="http://thumbnails.hulu.com/7/827/18906_145x80_manicured__6DZDj36Oa0GlHMbezc3SfA.jpg"/>
159 <mrss:content duration="02:14" height="" lang=""
160 url="http://www.hulu.com/watch/16729/x-play-top-4-open-world-games-of-2008#http%3A%2F%2Fwww.hulu.com%2Ffeed%2Fexpiring%2Fvideos" width=""/>
169 __search_max_page_items__ = 20
170 __tree_max_page_items__ = 20
176 """Wraps a stream with an encoder"""
185 """Wraps the output stream, encoding Unicode strings with the specified encoding"""
186 if isinstance(obj, str):
188 self.
out.buffer.write(obj)
191 """Delegate everything but write to the stream"""
192 return getattr(self.
out, attr)
194 if isinstance(sys.stdout, io.TextIOWrapper):
202 '''Import the common python class
205 except Exception
as e:
207 The subdirectory "nv_python_libs/common" containing the modules common_api.py and
208 common_exceptions.py (v0.1.3 or greater),
209 They should have been included with the distribution of MythNetvision
213 if common_api.__version__ <
'0.1.3':
214 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__)
220 '''Import the python hulu support classes
223 except Exception
as e:
225 The subdirectory "nv_python_libs/hulu" containing the modules hulu_api and
226 hulu_exceptions.py (v0.1.0 or greater),
227 They should have been included with the distribution of hulu.py.
231 if target.__version__ <
'0.1.0':
232 sys.stderr.write(
"\n! Error: Your current installed hulu_api.py version is (%s)\nYou must at least have version (0.1.0) or higher.\n" % target.__version__)
238 except Exception
as e:
240 The python script "nv_python_libs/mainProcess.py" must be present.
245 if process.__version__ <
'0.2.0':
246 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__)
249 if __name__ ==
'__main__':
253 target.baseProcessingDir = os.path.dirname( os.path.realpath( __file__ ))
255 target.common = common_api.Common()
256 main = process.mainProcess(target, apikey, )
257 main.grabberInfo = {}
258 main.grabberInfo[
'enabled'] =
True
259 main.grabberInfo[
'title'] = __title__
260 main.grabberInfo[
'command'] =
'hulu.py'
261 main.grabberInfo[
'mashup_title'] = __mashup_title__
262 main.grabberInfo[
'author'] = __author__
263 main.grabberInfo[
'thumbnail'] =
'hulu.png'
264 main.grabberInfo[
'type'] = [
'video', ]
265 main.grabberInfo[
'desc'] =
"Hulu.com is a free online video service that offers hit TV shows including Family Guy, 30 Rock, and the Daily Show with Jon Stewart."
266 main.grabberInfo[
'version'] = __version__
267 main.grabberInfo[
'search'] =
True
268 main.grabberInfo[
'tree'] =
True
269 main.grabberInfo[
'html'] =
False
270 main.grabberInfo[
'usage'] = __usage_examples__
271 main.grabberInfo[
'SmaxPage'] = __search_max_page_items__
272 main.grabberInfo[
'TmaxPage'] = __tree_max_page_items__