23 __title__ =
"Movie Trailers";
24 __mashup_title__ =
"trailersMashup"
25 __author__=
"R.D. Vaughan"
30 __usage_examples__ =
'''
33 Usage: ./trailers.py -hduvlST [parameters] <search text>
34 Version: 0.XX Author: R.D. Vaughan
36 For details on the MythTV Netvision plugin see the wiki page at:
37 http://www.mythtv.org/wiki/MythNetvision
40 -h, --help show this help message and exit
41 -d, --debug Show debugging info (URLs, raw XML ... etc, info
43 -u, --usage Display examples for executing the script
44 -v, --version Display grabber name and supported options
45 -l LANGUAGE, --language=LANGUAGE
46 Select data that matches the specified language fall
47 back to English if nothing found (e.g. 'es' EspaƱol,
48 'de' Deutsch ... etc). Not all sites or grabbers
50 -p PAGE NUMBER, --pagenumber=PAGE NUMBER
51 Display specific page of the search results. Default
52 is page 1. Page number is ignored with the Tree View
54 -S, --search Search for videos
55 -T, --treeview Display a Tree View of a sites videos
59 <name>Movie Trailers</name>
60 <author>R.D. Vaughan</author>
61 <thumbnail>trailers.png</thumbnail>
62 <command>trailers.py</command>
64 <description>Mashups combines media from multiple sources to create a new work</description>
65 <version>0.11</version>
72 __search_max_page_items__ = 50
73 __tree_max_page_items__ = 20
79 """Wraps a stream with an encoder"""
88 """Wraps the output stream, encoding Unicode strings with the specified encoding"""
89 if isinstance(obj, str):
91 self.
out.buffer.write(obj)
94 """Delegate everything but write to the stream"""
95 return getattr(self.
out, attr)
97 if isinstance(sys.stdout, io.TextIOWrapper):
105 '''Import the common python class
108 except Exception
as e:
110 The subdirectory "nv_python_libs/common" containing the modules common_api.py and
111 common_exceptions.py (v0.1.3 or greater),
112 They should have been included with the distribution of MythNetvision
116 if common_api.__version__ <
'0.1.3':
117 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__)
124 '''Import the python mashups support classes
127 except Exception
as e:
129 The subdirectory "nv_python_libs/mashups" containing the modules mashups_api and
130 mashups_exceptions.py (v0.1.0 or greater),
131 They should have been included with the distribution of nature.py.
135 if target.__version__ <
'0.1.0':
136 sys.stderr.write(
"\n! Error: Your current installed mashups_api.py version is (%s)\nYou must at least have version (0.1.0) or higher.\n" % target.__version__)
142 except Exception
as e:
144 The python script "nv_python_libs/mainProcess.py" must be present.
149 if process.__version__ <
'0.2.0':
150 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__)
153 if __name__ ==
'__main__':
157 target.baseProcessingDir = os.path.dirname( os.path.realpath( __file__ ))
159 target.common = common_api.Common()
160 main = process.mainProcess(target, apikey, )
161 main.grabberInfo = {}
162 main.grabberInfo[
'enabled'] =
True
163 main.grabberInfo[
'title'] = __title__
164 main.grabberInfo[
'command'] =
'trailers.py'
165 main.grabberInfo[
'mashup_title'] = __mashup_title__
166 main.grabberInfo[
'author'] = __author__
167 main.grabberInfo[
'thumbnail'] =
'trailers.png'
168 main.grabberInfo[
'type'] = [
'video', ]
169 main.grabberInfo[
'desc'] =
"Mashups combines media from multiple sources to create a new work"
170 main.grabberInfo[
'version'] = __version__
171 main.grabberInfo[
'search'] =
True
172 main.grabberInfo[
'tree'] =
True
173 main.grabberInfo[
'html'] =
False
174 main.grabberInfo[
'usage'] = __usage_examples__
175 main.grabberInfo[
'SmaxPage'] = __search_max_page_items__
176 main.grabberInfo[
'TmaxPage'] = __tree_max_page_items__