24 __mashup_title__ =
"natureMashup"
25 __author__=
"R.D. Vaughan"
32 __usage_examples__ =
'''
35 Usage: ./nature.py -hduvlST [parameters] <search text>
36 Version: v0.1.0 Author: R.D.Vaughan
38 For details on the MythTV Netvision plugin see the wiki page at:
39 http://www.mythtv.org/wiki/MythNetvision
42 -h, --help show this help message and exit
43 -d, --debug Show debugging info (URLs, raw XML ... etc, info
45 -u, --usage Display examples for executing the script
46 -v, --version Display grabber name and supported options
47 -l LANGUAGE, --language=LANGUAGE
48 Select data that matches the specified language fall
49 back to English if nothing found (e.g. 'es' EspaƱol,
50 'de' Deutsch ... etc). Not all sites or grabbers
52 -p PAGE NUMBER, --pagenumber=PAGE NUMBER
53 Display specific page of the search results. Default
54 is page 1. Page number is ignored with the Tree View
56 -T, --treeview Display a Tree View of a sites videos
61 <author>R.D. Vaughan</author>
62 <thumbnail>nature.png</thumbnail>
63 <command>nature.py</command>
65 <description>Mashups combines media from multiple sources to create a new work</description>
66 <version>0.XX</version>
72 > ./nature.py -S "Lions"
77 __search_max_page_items__ = 20
78 __tree_max_page_items__ = 20
84 """Wraps a stream with an encoder"""
93 """Wraps the output stream, encoding Unicode strings with the specified encoding"""
94 if isinstance(obj, str):
96 self.
out.buffer.write(obj)
99 """Delegate everything but write to the stream"""
100 return getattr(self.
out, attr)
102 if isinstance(sys.stdout, io.TextIOWrapper):
110 '''Import the common python class
113 except Exception
as e:
115 The subdirectory "nv_python_libs/common" containing the modules common_api.py and
116 common_exceptions.py (v0.1.3 or greater),
117 They should have been included with the distribution of MythNetvision
121 if common_api.__version__ <
'0.1.3':
122 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__)
129 '''Import the python mashups support classes
132 except Exception
as e:
134 The subdirectory "nv_python_libs/mashups" containing the modules mashups_api and
135 mashups_exceptions.py (v0.1.0 or greater),
136 They should have been included with the distribution of nature.py.
140 if target.__version__ <
'0.1.0':
141 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__)
147 except Exception
as e:
149 The python script "nv_python_libs/mainProcess.py" must be present.
154 if process.__version__ <
'0.2.0':
155 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__)
158 if __name__ ==
'__main__':
162 target.baseProcessingDir = os.path.dirname( os.path.realpath( __file__ ))
164 target.common = common_api.Common()
165 main = process.mainProcess(target, apikey, )
166 main.grabberInfo = {}
167 main.grabberInfo[
'enabled'] =
True
168 main.grabberInfo[
'title'] = __title__
169 main.grabberInfo[
'command'] =
'nature.py'
170 main.grabberInfo[
'mashup_title'] = __mashup_title__
171 main.grabberInfo[
'author'] = __author__
172 main.grabberInfo[
'thumbnail'] =
'nature.png'
173 main.grabberInfo[
'type'] = [
'video', ]
174 main.grabberInfo[
'desc'] =
"Mashups combines media from multiple sources to create a new work"
175 main.grabberInfo[
'version'] = __version__
177 main.grabberInfo[
'search'] = target.common.checkIfDBItem(
'dummy', {
'feedtitle': __title__, })
178 main.grabberInfo[
'tree'] =
True
179 main.grabberInfo[
'html'] =
False
180 main.grabberInfo[
'usage'] = __usage_examples__
181 main.grabberInfo[
'SmaxPage'] = __search_max_page_items__
182 main.grabberInfo[
'TmaxPage'] = __tree_max_page_items__