25 __title__ =
"BBC iPlayer";
26 __mashup_title__ =
"bbcipplayer"
27 __author__=
"R.D. Vaughan"
36 __usage_examples__ =
'''
39 Usage: ./bbciplayer.py -hduvlST [parameters] <search text>
40 Version: v0.1.2 Author: R.D.Vaughan
42 For details on the MythTV Netvision plugin see the wiki page at:
43 http://www.mythtv.org/wiki/MythNetvision
46 -h, --help show this help message and exit
47 -d, --debug Show debugging info (URLs, raw XML ... etc, info
49 -u, --usage Display examples for executing the script
50 -v, --version Display grabber name and supported options
51 -l LANGUAGE, --language=LANGUAGE
52 Select data that matches the specified language fall
53 back to English if nothing found (e.g. 'es' EspaƱol,
54 'de' Deutsch ... etc). Not all sites or grabbers
56 -p PAGE NUMBER, --pagenumber=PAGE NUMBER
57 Display specific page of the search results. Default
58 is page 1. Page number is ignored with the Tree View
60 -S, --search Search for videos
61 -T, --treeview Display a Tree View of a sites videos
65 <name>BBC iPlayer</name>
66 <author>R.D. Vaughan</author>
67 <thumbnail>bbciplayer.png</thumbnail>
69 <description>BBC iPlayer is our service that lets you catch up with radio and television programmes from the past week.</description>
70 <version>v0.13</version>
75 > ./bbciplayer.py -S "Doctor Who"
76 <?xml version="1.0" encoding="UTF-8"?>
77 <rss version="2.0" xmlns:amp="http://www.adobe.com/amp/1.0"
78 xmlns:atom="http://www.w3.org/2005/Atom"
79 xmlns:cnettv="http://cnettv.com/mrss/"
80 xmlns:content="http://purl.org/rss/1.0/modules/content/"
81 xmlns:creativecommons="http://backend.userland.com/creativeCommonsRssModule"
82 xmlns:dc="http://purl.org/dc/elements/1.1/"
83 xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/">
85 <title>BBC iPlayer</title>
86 <link>http://www.bbc.co.uk</link>
87 <description>BBC iPlayer is our service that lets you catch up with radio and television programmes from the past week.</description>
88 <numresults>7</numresults>
89 <returned>7</returned>
90 <startindex>7</startindex>
92 <title>Doctor Who - Series 4 - 11. Turn Left</title>
93 <author>British Broadcasting Corporation</author>
94 <pubDate>Wed, 24 Mar 2010 18:35:41 GMT</pubDate>
95 <description>Can Donna and Rose stop the approaching Darkness? (R)</description>
96 <link>http://www.bbc.co.uk/iplayer/episode/b00c7ytx/Doctor_Who_Series_4_Turn_Left/</link>
98 <media:thumbnail url="http://node1.bbcimg.co.uk/iplayer/images/episode/b00c7ytx_120_68.jpg"/>
99 <media:content duration="" height="" lang=""
100 url="http://www.bbc.co.uk/iplayer/episode/b00c7ytx/Doctor_Who_Series_4_Turn_Left/" width=""/>
106 <title>Doctor Who Confidential - Series 4 - 13. The End of an Era</title>
107 <author>British Broadcasting Corporation</author>
108 <pubDate>Wed, 24 Mar 2010 18:35:41 GMT</pubDate>
109 <description>The series finale as the Doctor's arch enemy brings the universe to the edge of extinction (R)</description>
110 <link>http://www.bbc.co.uk/iplayer/episode/b00cgphl/Doctor_Who_Confidential_Series_4_The_End_of_an_Era/</link>
112 <media:thumbnail url="http://node1.bbcimg.co.uk/iplayer/images/episode/b00cgphl_120_68.jpg"/>
113 <media:content duration="" height="" lang=""
114 url="http://www.bbc.co.uk/iplayer/episode/b00cgphl/Doctor_Who_Confidential_Series_4_The_End_of_an_Era/" width=""/>
122 <?xml version="1.0" encoding="UTF-8"?>
123 <rss version="2.0" xmlns:amp="http://www.adobe.com/amp/1.0"
124 xmlns:atom="http://www.w3.org/2005/Atom"
125 xmlns:cnettv="http://cnettv.com/mrss/"
126 xmlns:content="http://purl.org/rss/1.0/modules/content/"
127 xmlns:creativecommons="http://backend.userland.com/creativeCommonsRssModule"
128 xmlns:dc="http://purl.org/dc/elements/1.1/"
129 xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/">
131 <title>BBC iPlayer</title>
132 <link>http://www.bbc.co.uk</link>
133 <description>BBC iPlayer is our service that lets you catch up with radio and television programmes from the past week.</description>
134 <numresults>1</numresults>
135 <returned>1</returned>
136 <startindex>1</startindex>
137 <directory name="BBC iPlayer" thumbnail="/usr/local/share/mythtv/mythnetvision/icons/bbciplayer.png">
138 <directory name="BBC iPlayer - TV Highlights" thumbnail="/usr/local/share/mythtv/mythnetvision/icons/bbciplayer.png">
140 <title>Great Ormond Street: Pushing the Boundaries</title>
142 <pubDate>Wed, 07 Apr 2010 17:00:49 GMT</pubDate>
143 <description>A look at the work of the largest children&apos;s cardiac unit in the UK.</description>
144 <link>http://localhost:8080/emml/cgi-bin/bbciplayer_embedded.py?videocode=b00s02ct</link>
145 <mrss:group xmlns:mrss="http://search.yahoo.com/mrss/">
146 <mrss:thumbnail url="http://node2.bbcimg.co.uk/iplayer/images/episode/b00s02ct_150_84.jpg"/>
147 <mrss:content duration="" height="" lang=""
148 url="http://localhost:8080/emml/cgi-bin/bbciplayer_embedded.py?videocode=b00s02ct" width=""/>
154 <title>The Real Hustle: Series 7: On Holiday - Cutdowns: Episode 8</title>
156 <pubDate>Fri, 02 Apr 2010 07:29:46 GMT</pubDate>
157 <description>Paul relieves some unsuspecting tourists of their spending money in Oxford.</description>
158 <link>http://localhost:8080/emml/cgi-bin/bbciplayer_embedded.py?videocode=b00rw6xb</link>
159 <mrss:group xmlns:mrss="http://search.yahoo.com/mrss/">
160 <mrss:thumbnail url="http://node2.bbcimg.co.uk/iplayer/images/episode/b00rw6xb_150_84.jpg"/>
161 <mrss:content duration="" height="" lang=""
162 url="http://localhost:8080/emml/cgi-bin/bbciplayer_embedded.py?videocode=b00rw6xb" width=""/>
171 __search_max_page_items__ = 20
172 __tree_max_page_items__ = 20
178 """Wraps a stream with an encoder"""
187 """Wraps the output stream, encoding Unicode strings with the specified encoding"""
188 if isinstance(obj, unicode):
200 """Delegate everything but write to the stream"""
201 return getattr(self.
out, attr)
209 '''Import the common python class
214 The subdirectory "nv_python_libs/common" containing the modules common_api.py and
215 common_exceptions.py (v0.1.3 or greater),
216 They should have been included with the distribution of MythNetvision
220 if common_api.__version__ <
'0.1.3':
221 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__)
227 '''Import the python bbciplayer support classes
232 The subdirectory "nv_python_libs/bbciplayer" containing the modules bbciplayer_api and
233 bbciplayer_exceptions.py (v0.1.0 or greater),
234 They should have been included with the distribution of bbciplayer.py.
238 if target.__version__ <
'0.1.0':
239 sys.stderr.write(
"\n! Error: Your current installed bbciplayer_api.py version is (%s)\nYou must at least have version (0.1.0) or higher.\n" % target.__version__)
247 The python script "nv_python_libs/mainProcess.py" must be present.
252 if process.__version__ <
'0.2.0':
253 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__)
256 if __name__ ==
'__main__':
260 target.baseProcessingDir = os.path.dirname( os.path.realpath( __file__ ))
262 target.common = common_api.Common()
263 main = process.mainProcess(target, apikey, )
264 main.grabberInfo = {}
265 main.grabberInfo[
'title'] = __title__
266 main.grabberInfo[
'mashup_title'] = __mashup_title__
267 main.grabberInfo[
'command'] =
u'bbciplayer.py'
268 main.grabberInfo[
'author'] = __author__
269 main.grabberInfo[
'thumbnail'] =
'bbciplayer.png'
270 main.grabberInfo[
'type'] = [
'video', ]
271 main.grabberInfo[
'desc'] =
u"BBC iPlayer is our service that lets you catch up with radio and television programmes from the past week."
272 main.grabberInfo[
'version'] = __version__
273 main.grabberInfo[
'search'] =
True
274 main.grabberInfo[
'tree'] =
True
275 main.grabberInfo[
'html'] =
False
276 main.grabberInfo[
'usage'] = __usage_examples__
277 main.grabberInfo[
'SmaxPage'] = __search_max_page_items__
278 main.grabberInfo[
'TmaxPage'] = __tree_max_page_items__