00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 __title__ ="Dailymotion";
00029 __author__="R.D. Vaughan"
00030 __version__="0.23"
00031
00032
00033
00034
00035
00036
00037
00038
00039 __usage_examples__ ='''
00040 (Option Help)
00041 > ./dailymotion.py -h
00042 Usage: ./dailymotion.py -hduvlST [parameters] <search text>
00043 Version: v0.2.0 Author: R.D.Vaughan
00044
00045 For details on the MythTV Netvision plugin see the wiki page at:
00046 http://www.mythtv.org/wiki/MythNetvision
00047
00048 Options:
00049 -h, --help show this help message and exit
00050 -d, --debug Show debugging info (URLs, raw XML ... etc, info
00051 varies per grabber)
00052 -u, --usage Display examples for executing the script
00053 -v, --version Display grabber name and supported options
00054 -l LANGUAGE, --language=LANGUAGE
00055 Select data that matches the specified language fall
00056 back to English if nothing found (e.g. 'es' Español,
00057 'de' Deutsch ... etc). Not all sites or grabbers
00058 support this option.
00059 -p PAGE NUMBER, --pagenumber=PAGE NUMBER
00060 Display specific page of the search results. Default
00061 is page 1. Page number is ignored with the Tree View
00062 option (-T).
00063 -S, --search Search for videos
00064 -T, --treeview Display a Tree View of a sites videos
00065
00066
00067 (Search dailymotion for videos matching search words)
00068 > ./dailymotion.py -S "Birds"
00069 <?xml version="1.0" encoding="UTF-8"?>
00070 <rss version="2.0"
00071 xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
00072 xmlns:content="http://purl.org/rss/1.0/modules/content/"
00073 xmlns:cnettv="http://cnettv.com/mrss/"
00074 xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
00075 xmlns:media="http://search.yahoo.com/mrss/"
00076 xmlns:atom="http://www.w3.org/2005/Atom"
00077 xmlns:amp="http://www.adobe.com/amp/1.0"
00078 xmlns:dc="http://purl.org/dc/elements/1.1/">
00079 <channel>
00080 <title>Dailymotion</title>
00081 <link>http://www.dailymotion.com</link>
00082 <description>Dailymotion is about finding new ways to see, share and engage your world through the power of online video.</description>
00083 <numresults>16</numresults>
00084 <returned>15</returned>
00085 <startindex>15</startindex>
00086 <item>
00087 <title>Bob Marley - Three Little Birds</title>
00088 <author>hushhush112</author>
00089 <pubDate>Wed, 24 Jan 2007 04:29:56 +0100</pubDate>
00090 <description>"Three Little Birds" is a song by Bob Marley & The Wailers from their 1977 album Exodus. The single reached the Top 20 in England.</description>
00091 <link>http://www.dailymotion.com/swf/x11te1?autoPlay=1</link>
00092 <media:group>
00093 <media:thumbnail url='http://ak2.static.dailymotion.com/static/video/163/467/1764361:jpeg_preview_large.jpg?20090610235117'/>
00094 <media:content url='http://www.dailymotion.com/swf/x11te1?autoPlay=1' duration='204' width='320' height='240' lang='en'/>
00095 </media:group>
00096 <rating>5.0</rating>
00097 </item>
00098 ...
00099 <item>
00100 <title>Birds Eye View Film Festival 2006: Highlights (Part 1)</title>
00101 <author>BirdsEyeViewFilm</author>
00102 <pubDate>Wed, 11 Feb 2009 17:11:32 +0100</pubDate>
00103 <description>Highlights from the Birds Eye View International Women's Day Gala at the BFI Southbank - the opening event for Birds Eye View Film Festival 2006. Special guests included Gurinder Chadha, Arabella Weir, Jerry Hall and Jessica Stevenson (Hynes). Each year we showcase the very best in new features, documentaries and short films from women filmmakers from across the globe, alongside premiere screenings, special multi-media events, Q&As, panel discussions and parties. Birds Eye View celebrates international women filmmakers. http://www.birds-eye-view.co.uk</description>
00104 <link>http://www.dailymotion.com/swf/x8c61t?autoPlay=1</link>
00105 <media:group>
00106 <media:thumbnail url='http://ak2.static.dailymotion.com/static/video/146/400/14004641:jpeg_preview_large.jpg?20090416211915'/>
00107 <media:content url='http://www.dailymotion.com/swf/x8c61t?autoPlay=1' duration='199' width='320' height='240' lang='en'/>
00108 </media:group>
00109 <rating>5.0</rating>
00110 </item>
00111 </channel>
00112 </rss>
00113
00114
00115 (Retrieve a Tree View of the Dailymotion Video Categories)
00116 > ./dailymotion.py -T
00117 <?xml version="1.0" encoding="UTF-8"?>
00118 <rss version="2.0"
00119 xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
00120 xmlns:content="http://purl.org/rss/1.0/modules/content/"
00121 xmlns:cnettv="http://cnettv.com/mrss/"
00122 xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
00123 xmlns:media="http://search.yahoo.com/mrss/"
00124 xmlns:atom="http://www.w3.org/2005/Atom"
00125 xmlns:amp="http://www.adobe.com/amp/1.0"
00126 xmlns:dc="http://purl.org/dc/elements/1.1/">
00127 <channel>
00128 <title>Dailymotion</title>
00129 <link>http://www.dailymotion.com</link>
00130 <description>Dailymotion is about finding new ways to see, share and engage your world through the power of online video.</description>
00131 <numresults>0</numresults>
00132 <returned>1</returned>
00133 <startindex>0</startindex>
00134 <directory name="Featured/Most/Best/Current ..." thumbnail="/usr/local/share/mythtv/mythnetvision/icons/dailymotion.jpg">
00135 <directory name="Featured Videos" thumbnail="/usr/local/share/mythtv/mythnetvision/icons/directories/topics/featured.png">
00136 <item>
00137 <title>Born of Hope - Full Movie</title>
00138 <author>BornofHope</author>
00139 <pubDate>Tue, 01 Dec 2009 09:49:05 +0100</pubDate>
00140 <description>This version of the film is not the best one to watch. Please select the Extended Version http://www.dailymotion.com/video/xbhonj_born-of-hope-extended-version_shortfilms Born of Hope is an independent feature film inspired by the Lord of the Rings and produced in the UK. www.bornofhope.comA scattered people, the descendents of storied sea kings of the ancient West, struggle to survive in a lonely wilderness as a dark force relentlessly bends its will toward their destruction. Yet amidst these valiant, desperate people, hope remains. A royal house endures unbroken from father to son.This 70 minute original drama is set in the time before the War of the Ring and tells the story of the Dúnedain, the Rangers of the North, before the return of the King. Inspired by only a couple of paragraphs written by Tolkien in the appendices of the Lord of the Rings we follow Arathorn and Gilraen, the parents of Aragorn, from their first meeting through a turbulent time in their people's history.</description>
00141 <link>http://www.dailymotion.com/swf/xbc5ut?autoPlay=1</link>
00142 <media:group>
00143 <media:thumbnail url='http://ak2.static.dailymotion.com/static/video/732/340/19043237:jpeg_preview_large.jpg?20091215100200'/>
00144 <media:content url='http://www.dailymotion.com/swf/xbc5ut?autoPlay=1' duration='4088' width='320' height='240' lang='en'/>
00145 </media:group>
00146 <rating>4.5</rating>
00147 </item>
00148 ...
00149 <item>
00150 <title>Rubik's Cube : un Français recordman du monde</title>
00151 <author>newzy-fr</author>
00152 <pubDate>Wed, 10 Oct 2007 21:02:52 +0200</pubDate>
00153 <description>Il s'appelle Thibaut Jacquinot, il a été champion de France 2006 de Rubik's Cube et il détient toujours le record du monde de la discipline. Démonstration réalisée sans trucages...Plus de vidéos rubik's Cube sur www.newzy.fr</description>
00154 <link>http://www.dailymotion.com/swf/x36jkt?autoPlay=1</link>
00155 <media:group>
00156 <media:thumbnail url='http://ak2.static.dailymotion.com/static/video/751/443/5344157:jpeg_preview_large.jpg?20090618140735'/>
00157 <media:content url='http://www.dailymotion.com/swf/x36jkt?autoPlay=1' duration='32' width='320' height='240' lang='en'/>
00158 </media:group>
00159 <rating>4.9</rating>
00160 </item>
00161 </directory>
00162 </directory>
00163 </directory>
00164 </channel>
00165 </rss>
00166 '''
00167 __search_max_page_items__ = 10
00168 __tree_max_page_items__ = 20
00169
00170 import sys, os
00171
00172 class OutStreamEncoder(object):
00173 """Wraps a stream with an encoder"""
00174 def __init__(self, outstream, encoding=None):
00175 self.out = outstream
00176 if not encoding:
00177 self.encoding = sys.getfilesystemencoding()
00178 else:
00179 self.encoding = encoding
00180
00181 def write(self, obj):
00182 """Wraps the output stream, encoding Unicode strings with the specified encoding"""
00183 if isinstance(obj, unicode):
00184 try:
00185 self.out.write(obj.encode(self.encoding))
00186 except IOError:
00187 pass
00188 else:
00189 try:
00190 self.out.write(obj)
00191 except IOError:
00192 pass
00193
00194 def __getattr__(self, attr):
00195 """Delegate everything but write to the stream"""
00196 return getattr(self.out, attr)
00197 sys.stdout = OutStreamEncoder(sys.stdout, 'utf8')
00198 sys.stderr = OutStreamEncoder(sys.stderr, 'utf8')
00199
00200
00201
00202
00203
00204 try:
00205 import nv_python_libs.dailymotion.dailymotion_api as target
00206 except Exception, e:
00207 sys.stderr.write('''
00208 The subdirectory "nv_python_libs/dailymotion" containing the modules dailymotion_api.py (v0.2.0 or greater),
00209 They should have been included with the distribution of dailymotion.py.
00210 Error(%s)
00211 ''' % e)
00212 sys.exit(1)
00213
00214 if target.__version__ < '0.2.0':
00215 sys.stderr.write("\n! Error: Your current installed dailymotion_api.py version is (%s)\nYou must at least have version (0.2.0) or higher.\n" % target.__version__)
00216 sys.exit(1)
00217
00218
00219
00220 try:
00221 import nv_python_libs.mainProcess as process
00222 except Exception, e:
00223 sys.stderr.write('''
00224 The python script "nv_python_libs/mainProcess.py" must be present.
00225 Error(%s)
00226 ''' % e)
00227 sys.exit(1)
00228
00229 if process.__version__ < '0.2.0':
00230 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__)
00231 sys.exit(1)
00232
00233 if __name__ == '__main__':
00234
00235 apikey = ""
00236 main = process.mainProcess(target, apikey, )
00237 main.grabberInfo = {}
00238 main.grabberInfo['title'] = __title__
00239 main.grabberInfo['command'] = u'dailymotion.py'
00240 main.grabberInfo['author'] = __author__
00241 main.grabberInfo['thumbnail'] = 'dailymotion.png'
00242 main.grabberInfo['type'] = ['video']
00243 main.grabberInfo['desc'] = u"Dailymotion is about finding new ways to see, share and engage your world through the power of online video."
00244 main.grabberInfo['version'] = __version__
00245 main.grabberInfo['search'] = True
00246 main.grabberInfo['tree'] = True
00247 main.grabberInfo['html'] = False
00248 main.grabberInfo['usage'] = __usage_examples__
00249 main.grabberInfo['SmaxPage'] = __search_max_page_items__
00250 main.grabberInfo['TmaxPage'] = __tree_max_page_items__
00251 main.main()