26 __mashup_title__ =
"thewb"
27 __author__=
"R.D. Vaughan"
34 __usage_examples__ =
'''
37 Usage: ./thewb.py -hduvlST [parameters] <search text>
38 Version: v0.11 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>thewb.png</thumbnail>
67 <description>Watch full episodes of your favorite shows on The WB.com, like Friends, The O.C., Veronica Mars, Pushing Daisies, Smallville, Buffy The Vampire Slayer, One Tree Hill and Gilmore Girls.</description>
68 <version>v0.11</version>
73 > ./thewb.py -S "Firefly"
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__)
128 '''Import the python thewb support classes
131 except Exception
as e:
133 The subdirectory "nv_python_libs/thewb" containing the modules thewb_api and
134 thewb_exceptions.py (v0.1.0 or greater),
135 They should have been included with the distribution of thewb.py.
139 if target.__version__ <
'0.1.0':
140 sys.stderr.write(
"\n! Error: Your current installed thewb_api.py version is (%s)\nYou must at least have version (0.1.0) or higher.\n" % target.__version__)
146 except Exception
as e:
148 The python script "nv_python_libs/mainProcess.py" must be present.
153 if process.__version__ <
'0.2.0':
154 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__)
157 if __name__ ==
'__main__':
161 target.baseProcessingDir = os.path.dirname( os.path.realpath( __file__ ))
163 target.common = common_api.Common()
164 main = process.mainProcess(target, apikey, )
165 main.grabberInfo = {}
166 main.grabberInfo[
'enabled'] =
True
167 main.grabberInfo[
'title'] = __title__
168 main.grabberInfo[
'command'] =
'thewb.py'
169 main.grabberInfo[
'mashup_title'] = __mashup_title__
170 main.grabberInfo[
'author'] = __author__
171 main.grabberInfo[
'thumbnail'] =
'thewb.png'
172 main.grabberInfo[
'type'] = [
'video', ]
173 main.grabberInfo[
'desc'] =
"Watch full episodes of your favorite shows on The WB.com, like Friends, The O.C., Veronica Mars, Pushing Daisies, Smallville, Buffy The Vampire Slayer, One Tree Hill and Gilmore Girls."
174 main.grabberInfo[
'version'] = __version__
175 main.grabberInfo[
'search'] =
True
176 main.grabberInfo[
'tree'] =
True
177 main.grabberInfo[
'html'] =
False
178 main.grabberInfo[
'usage'] = __usage_examples__
179 main.grabberInfo[
'SmaxPage'] = __search_max_page_items__
180 main.grabberInfo[
'TmaxPage'] = __tree_max_page_items__