29__author__=
"R.D. Vaughan"
39__usage_examples__ =
'''
42Usage: ./mtv.py -hduvlST [parameters] <search text>
43Version: v0.2.0 Author: R.D.Vaughan
45For details on the MythTV Netvision plugin see the wiki page at:
46http://www.mythtv.org/wiki/MythNetvision
49 -h, --help show this help message and exit
50 -d, --debug Show debugging info (URLs, raw XML ... etc, info
52 -u, --usage Display examples
for executing the script
53 -v, --version Display grabber name
and supported options
54 -l LANGUAGE, --language=LANGUAGE
55 Select data that matches the specified language fall
56 back to English
if nothing found (e.g.
'es' EspaƱol,
57 'de' Deutsch ... etc). Not all sites
or grabbers
59 -p PAGE NUMBER, --pagenumber=PAGE NUMBER
60 Display specific page of the search results. Default
61 is page 1. Page number
is ignored
with the Tree View
63 -S, --search Search
for videos
64 -T, --treeview Display a Tree View of a sites videos
67(Search MTV
for videos matching search words)
68> ./mtv.py -S
"Sleeping" -p 2
69<?xml version=
"1.0" encoding=
"UTF-8"?>
71xmlns:itunes=
"http://www.itunes.com/dtds/podcast-1.0.dtd"
72xmlns:content=
"http://purl.org/rss/1.0/modules/content/"
73xmlns:cnettv=
"http://cnettv.com/mrss/"
74xmlns:creativeCommons=
"http://backend.userland.com/creativeCommonsRssModule"
75xmlns:media=
"http://search.yahoo.com/mrss/"
76xmlns:atom=
"http://www.w3.org/2005/Atom"
77xmlns:amp=
"http://www.adobe.com/amp/1.0"
78xmlns:dc=
"http://purl.org/dc/elements/1.1/">
81 <link>http://www.mtv.com</link>
82 <description>Visit MTV (Music Television)
for TV shows, music videos, celebrity photos, news.</description>
83 <numresults>41</numresults>
84 <returned>20</returned>
85 <startindex>40</startindex>
87 <title>While You Were Sleeping</title>
88 <author>Elvis Perkins</author>
89 <pubDate>Tue, 20 Feb 2007 00:00:00 GMT</pubDate>
90 <description>Elvis Perkins - While You Were Sleeping - XL Recordings</description>
91 <link>http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:170754</link>
93 <media:thumbnail url=
'http://www.mtv.com/shared/promoimages/bands/p/perkins_elvis/while_you_were_sleeping/281x211.jpg'/>
94 <media:content url=
'http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:170754' duration=
'229' width=
'' height=
'' lang=
''/>
100 <title>She
is Love</title>
101 <author>Parachute</author>
102 <pubDate>Mon, 16 Mar 2009 00:00:00 GMT</pubDate>
103 <description>Parachute - She
is Love - Mercury</description>
104 <link>http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:353524</link>
106 <media:thumbnail url=
'http://www.mtv.com/shared/promoimages/bands/p/parachute/she_is_love/281x211.jpg'/>
107 <media:content url=
'http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:353524' duration=
'226.76' width=
'' height=
'' lang=
''/>
117<?xml version=
"1.0" encoding=
"UTF-8"?>
119xmlns:itunes=
"http://www.itunes.com/dtds/podcast-1.0.dtd"
120xmlns:content=
"http://purl.org/rss/1.0/modules/content/"
121xmlns:cnettv=
"http://cnettv.com/mrss/"
122xmlns:creativeCommons=
"http://backend.userland.com/creativeCommonsRssModule"
123xmlns:media=
"http://search.yahoo.com/mrss/"
124xmlns:atom=
"http://www.w3.org/2005/Atom"
125xmlns:amp=
"http://www.adobe.com/amp/1.0"
126xmlns:dc=
"http://purl.org/dc/elements/1.1/">
129 <link>http://www.mtv.com</link>
130 <description>Visit MTV (Music Television)
for TV shows, music videos, celebrity photos, news.</description>
131 <numresults>5050</numresults>
132 <returned>20</returned>
133 <startindex>20</startindex>
134 <directory name=
"New over the last 3 months" thumbnail=
"/usr/local/share/mythtv/mythnetvision/icons/directories/topics/recent.png">
135 <directory name=
"Rock" thumbnail=
"/usr/local/share/mythtv/mythnetvision/icons/directories/music_genres/rock.png">
137 <title>Useless</title>
138 <author>Tiny Animals</author>
139 <pubDate>Thu, 17 Dec 2009 00:00:00 GMT</pubDate>
140 <description></description>
141 <link>http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:444694</link>
143 <media:thumbnail url=
'http://www.mtv.com/shared/promoimages/bands/t/tiny_animals/useless/281x211.jpg'/>
144 <media:content url=
'http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:444694' duration=
'212.88' width=
'' height=
'' lang=
'en'/>
150 <title>Our Velocity</title>
151 <author>Maximo Park</author>
152 <pubDate>Mon, 02 Apr 2007 00:00:00 GMT</pubDate>
153 <description></description>
154 <link>http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:149873</link>
156 <media:thumbnail url=
'http://www.mtv.com/shared/promoimages/bands/m/maximo_park/our_velocity/281x211.jpg'/>
157 <media:content url=
'http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:149873' duration=
'218' width=
'' height=
'' lang=
'en'/>
166__search_max_page_items__ = 10
167__tree_max_page_items__ = 20
172class OutStreamEncoder(object):
173 """Wraps a stream with an encoder"""
182 """Wraps the output stream, encoding Unicode strings with the specified encoding"""
183 if isinstance(obj, str):
185 self.
out.buffer.write(obj)
188 """Delegate everything but write to the stream"""
189 return getattr(self.
out, attr)
191if isinstance(sys.stdout, io.TextIOWrapper):
202except Exception
as e:
204The subdirectory "nv_python_libs/mtv" containing the modules mtv_api.py (v0.2.0 or greater),
205They should have been included with the distribution of mtv.py.
210if target.__version__ <
'0.2.0':
211 sys.stderr.write(
"\n! Error: Your current installed mtv_api.py version is (%s)\nYou must at least have version (0.2.0) or higher.\n" % target.__version__)
218except Exception
as e:
220The python script "nv_python_libs/mainProcess.py" must be present.
225if process.__version__ <
'0.2.0':
226 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__)
229if __name__ ==
'__main__':
232 main = process.mainProcess(target, apikey, )
233 main.grabberInfo = {}
234 main.grabberInfo[
'enabled'] =
True
235 main.grabberInfo[
'title'] = __title__
236 main.grabberInfo[
'command'] =
'mtv.py'
237 main.grabberInfo[
'author'] = __author__
238 main.grabberInfo[
'thumbnail'] =
'mtv.png'
239 main.grabberInfo[
'type'] = [
'video']
240 main.grabberInfo[
'desc'] =
"Visit MTV (Music Television) for TV shows, music videos, celebrity photos, and news."
241 main.grabberInfo[
'version'] = __version__
242 main.grabberInfo[
'search'] =
True
243 main.grabberInfo[
'tree'] =
True
244 main.grabberInfo[
'html'] =
False
245 main.grabberInfo[
'usage'] = __usage_examples__
246 main.grabberInfo[
'SmaxPage'] = __search_max_page_items__
247 main.grabberInfo[
'TmaxPage'] = __tree_max_page_items__
def __init__(self, outstream, encoding=None)
def __getattr__(self, attr)