The branch, frodo has been updated via 5b81f682ed4e35ce7c4445f0316336a49f98647e (commit) via bf34e722f18824a1f13edf2e4d5eb4f066d0250e (commit) via a549b6704136213765ca7c3b97dd8a7a9cb3c407 (commit) via 400ff308e14378938d4dc54138c0e97b08bb9748 (commit) via 8a9d8838159901812f7d116b9e8aa619dd940c7b (commit) via ce753c08be2b462a4a555ba4bf114a6d7a16e026 (commit) from 5f5a6fcf3f928582200421e54f6c9dc7afe7a601 (commit)
- Log ----------------------------------------------------------------- http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=5b81f682ed4e35ce7c4445f0316336a49f98647e commit 5b81f682ed4e35ce7c4445f0316336a49f98647e Author: sphere <sph...@dersphere.de> Date: Tue Feb 25 09:35:55 2014 +0100 [plugin.video.watchmojo] updated to version 1.0.1 diff --git a/plugin.video.watchmojo/addon.py b/plugin.video.watchmojo/addon.py index 91d892a..be2c3fe 100644 --- a/plugin.video.watchmojo/addon.py +++ b/plugin.video.watchmojo/addon.py @@ -19,7 +19,7 @@ # Initiate Startup import xbmcutil action = xbmcutil.plugin.actions[0] -if action == "system": xbmcutil.sysCheck() +if action == u"system": xbmcutil.sysCheck() else: # Call Function Based on Action Param import main as plugin diff --git a/plugin.video.watchmojo/addon.xml b/plugin.video.watchmojo/addon.xml index 715170e..d281eb1 100644 --- a/plugin.video.watchmojo/addon.xml +++ b/plugin.video.watchmojo/addon.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="plugin.video.watchmojo" name="Watchmojo" provider-name="willforde" version="1.0.0"> +<addon id="plugin.video.watchmojo" name="Watchmojo" provider-name="willforde" version="1.0.1"> <requires> <import addon="xbmc.python" version="2.1.0"/> - <import addon="script.module.xbmcutil" version="2.0.0"/> + <import addon="script.module.xbmcutil" version="2.0.2"/> </requires> <extension library="addon.py" point="xbmc.python.pluginsource"> <provides>video</provides> diff --git a/plugin.video.watchmojo/changelog.txt b/plugin.video.watchmojo/changelog.txt index 8a53bba..0d8a189 100644 --- a/plugin.video.watchmojo/changelog.txt +++ b/plugin.video.watchmojo/changelog.txt @@ -1,2 +1,5 @@ -[B]Version 1.0[/B] +[B]Version 1.0.1[/B] +- Added full unicode support + +[B]Version 1.0.0[/B] - Initial Version \ No newline at end of file diff --git a/plugin.video.watchmojo/resources/lib/main.py b/plugin.video.watchmojo/resources/lib/main.py index 7a2bd2a..2b8fa71 100644 --- a/plugin.video.watchmojo/resources/lib/main.py +++ b/plugin.video.watchmojo/resources/lib/main.py @@ -20,21 +20,20 @@ from xbmcutil import listitem, urlhandler, plugin import parsers -BASEURL = "http://www.watchmojo.com" +BASEURL = u"http://www.watchmojo.com" class Initialize(listitem.VirtualFS): @plugin.error_handler def scraper(self): # Fetch Video Content - url = "%s/video/theme/" % BASEURL - sourceObj = urlhandler.urlopen(url, 2678400) # TTL = 1 Month - videoItems = parsers.CategorysParser().parse(sourceObj.read()) - sourceObj.close() + url = u"%s/video/theme/" % BASEURL + sourceCode = urlhandler.urlread(url, 2678400) # TTL = 1 Month + videoItems = parsers.CategorysParser().parse(sourceCode) # Add Extra Items icon = (plugin.getIcon(),0) self.add_youtube_channel("watchmojo") - self.add_item("-Latest Videos", thumbnail=icon, url={"action":"Videos", "url":"/video/cat/home/1"}) - self.add_item("-Video Themes", thumbnail=icon, url={"action":"Themes", "url":"/video/theme/"}) + self.add_item(u"-Latest Videos", thumbnail=icon, url={"action":"Videos", "url":"/video/cat/home/1"}) + self.add_item(u"-Video Themes", thumbnail=icon, url={"action":"Themes", "url":"/video/theme/"}) # Set Content Properties self.set_sort_methods(self.sort_method_video_title) @@ -48,9 +47,8 @@ class Themes(listitem.VirtualFS): def scraper(self): # Fetch Video Content url = BASEURL + plugin["url"] - sourceObj = urlhandler.urlopen(url, 604800) # TTL = 1 Week - videoItems = parsers.ThemesParser().parse(sourceObj.read()) - sourceObj.close() + sourceCode = urlhandler.urlread(url, 604800) # TTL = 1 Week + videoItems = parsers.ThemesParser().parse(sourceCode) # Set Content Properties self.set_sort_methods(self.sort_method_video_title) @@ -63,7 +61,7 @@ class SubCat(listitem.VirtualFS): @plugin.error_handler def scraper(self): # Fetch Video Content - url = "%s/video/theme/" % BASEURL + url = u"%s/video/theme/" % BASEURL sourceCode = urlhandler.urlread(url, 2678400) # TTL = 1 Month # Set Content Properties @@ -81,14 +79,14 @@ class SubCat(listitem.VirtualFS): import re # Add Current Category - self.add_item(label="-%s" % plugin["title"], url={"action":"Videos", "url":plugin["url"]}) + self.add_item(label=u"-%s" % plugin["title"], url={"action":"Videos", "url":plugin["url"]}) - for catID in plugin["idlist"].split(","): + for catID in plugin["idlist"].split(u","): # Create listitem of Data item = localListitem() # Fetch Title and Set url & action - url = "/video/id/%s/1" % catID + url = u"/video/id/%s/1" % catID item.setLabel(re.findall('<a href="%s">(.+?)</a>' % url, sourceCode)[0]) item.setParamDict(action="Videos", url=url) @@ -102,10 +100,9 @@ class Videos(listitem.VirtualFS): @plugin.error_handler def scraper(self): # Fetch Video Content - url = BASEURL + plugin["url"].replace(" ","%20") - sourceObj = urlhandler.urlopen(url, 28800) # TTL = 8 Hours - videoItems = parsers.VideosParser().parse(sourceObj.read()) - sourceObj.close() + url = BASEURL + plugin["url"].replace(u" ",u"%20") + sourceCode = urlhandler.urlread(url, 28800) # TTL = 8 Hours + videoItems = parsers.VideosParser().parse(sourceCode) # Set Content Properties self.set_sort_methods(self.sort_method_date, self.sort_method_video_title) @@ -123,6 +120,7 @@ class PlayVideo(listitem.PlayMedia): import re # Search sourceCode - values = plugin.get_params(re.findall("<param name=\"flashvars\" value='(.+?)'>", sourceCode)[0]) + test = re.findall("<param name=\"flashvars\" value='(.+?)'>", sourceCode)[0] + values = plugin.get_params(test) if values["type"] == "rtmp": return {"url":"%s/mp4:%s" % (values["streamer"], values["file"])} else: return {"url":values["file"]} diff --git a/plugin.video.watchmojo/resources/lib/parsers.py b/plugin.video.watchmojo/resources/lib/parsers.py index 6f39441..318813a 100644 --- a/plugin.video.watchmojo/resources/lib/parsers.py +++ b/plugin.video.watchmojo/resources/lib/parsers.py @@ -53,23 +53,23 @@ class CategorysParser(HTMLParser.HTMLParser): # Find Each Category Bock if section == 0: - if tag == "li" and "class" in attrs and attrs["class"] == "off": + if tag == u"li" and u"class" in attrs and attrs[u"class"] == u"off": self.section = 1 - elif tag == "div" and "id" in attrs and attrs["id"] == "bar_main": + elif tag == u"div" and u"id" in attrs and attrs[u"id"] == u"bar_main": raise plugin.ParserError # Find Each Part within Section Block elif section >= 1: - if section == 1 and tag == "a" and "href" in attrs: - url = attrs["href"] + if section == 1 and tag == u"a" and u"href" in attrs: + url = attrs[u"href"] self.item.urlParams["url"] = url self.section = 101 # Title url = url[:-2] - image = url[url.rfind("/")+1:].replace(" ","-") + ".png" + image = url[url.rfind(u"/")+1:].replace(u" ",u"-") + u".png" self.item.setThumbnailImage(image, 1) - elif section == 2 and tag == "a" and "href" in attrs: - url = attrs["href"] - self.idList.append(url[url.find("/", 8)+1:][:-2]) + elif section == 2 and tag == u"a" and u"href" in attrs: + url = attrs[u"href"] + self.idList.append(url[url.find(u"/", 8)+1:][:-2]) def handle_data(self, data): # Fetch Category Title when within Section 2 @@ -79,9 +79,9 @@ class CategorysParser(HTMLParser.HTMLParser): def handle_endtag(self, tag): # Search for each end tag - if self.section >= 1 and tag == "ul": + if self.section >= 1 and tag == u"ul": self.section = 0 - self.item.urlParams["idlist"] = ",".join(self.idList) + self.item.urlParams["idlist"] = u",".join(self.idList) self.results.append(self.item.getListitemTuple()) self.reset_lists() @@ -116,20 +116,20 @@ class ThemesParser(HTMLParser.HTMLParser): section = self.section # Find Each Category Bock - if section == 0 and tag == "div": - if "class" in attrs and attrs["class"] == "theme_box": + if section == 0 and tag == u"div": + if u"class" in attrs and attrs[u"class"] == u"theme_box": self.section = 1 - elif "id" in attrs and attrs["id"] == "grid_small": + elif u"id" in attrs and attrs[u"id"] == u"grid_small": raise plugin.ParserError # Find Each Part within Section Block elif section >= 1: - if tag == "img" and "src" in attrs: - self.item.setThumbnailImage(attrs["src"]) - elif tag == "a" and "class" in attrs and attrs["class"] == "theme": - self.item.urlParams["url"] = attrs["href"] + if tag == u"img" and u"src" in attrs: + self.item.setThumbnailImage(attrs[u"src"]) + elif tag == u"a" and u"class" in attrs and attrs[u"class"] == u"theme": + self.item.urlParams["url"] = attrs[u"href"] self.section = 101 # Title - elif tag == "span": + elif tag == u"span": self.section = 102 # Title with Video Count def handle_data(self, data): @@ -138,7 +138,7 @@ class ThemesParser(HTMLParser.HTMLParser): self.title = data self.section = 1 elif self.section == 102: # Title with Video Count - self.item.setLabel("%s (%s)" % (self.title, data[:data.find(" ")])) + self.item.setLabel(u"%s (%s)" % (self.title, data[:data.find(u" ")])) self.results.append(self.item.getListitemTuple()) self.reset_lists() self.section = 0 @@ -156,7 +156,7 @@ class VideosParser(HTMLParser.HTMLParser): # Proceed with parsing self.reset_lists() self.results = [] - try: self.feed(html.replace('_blank"','')) + try: self.feed(html.replace(u'_blank"',u'')) except plugin.ParserError: pass # Return Results @@ -176,27 +176,27 @@ class VideosParser(HTMLParser.HTMLParser): # Find Each Category Bock if section == 0: - if tag == "a" and "href" in attrs and "class" in attrs and attrs["class"] == "grid_image": - self.item.urlParams["url"] = attrs["href"] + if tag == u"a" and u"href" in attrs and u"class" in attrs and attrs[u"class"] == u"grid_image": + self.item.urlParams["url"] = attrs[u"href"] self.section = 1 - elif tag == "div" and "id" in attrs and attrs["id"] == "next": + elif tag == u"div" and u"id" in attrs and attrs[u"id"] == u"next": self.section = -1 # Find Each Part within Section Block elif section >= 1: - if tag == "img" and "src" in attrs: - self.item.setThumbnailImage(attrs["src"]) - elif tag == "span" and "class" in attrs and attrs["class"] == "adate": + if tag == u"img" and u"src" in attrs: + self.item.setThumbnailImage(attrs[u"src"]) + elif tag == u"span" and u"class" in attrs and attrs[u"class"] == u"adate": self.section = 101 # Date - elif tag == "a" and "class" in attrs and attrs["class"] == "title": + elif tag == u"a" and u"class" in attrs and attrs[u"class"] == u"title": self.section = 102 # Title - elif tag == "br": + elif tag == u"br": self.section = 103 # Plot # Find Next Page elif section == -1: - if tag == "a" and "href" in attrs and attrs["href"].startswith("/video/"): - self.results.append(self.item.add_next_page(url={"url":attrs["href"]})) + if tag == u"a" and u"href" in attrs and attrs[u"href"].startswith(u"/video/"): + self.results.append(self.item.add_next_page(url={"url":attrs[u"href"]})) raise plugin.ParserError else: raise plugin.ParserError @@ -211,14 +211,14 @@ class VideosParser(HTMLParser.HTMLParser): self.item.setLabel(data) self.section == 1 elif section == 103: # Plot - if data.startswith("hosted by"): self.section = 1 + if data.startswith(u"hosted by"): self.section = 1 else: self.item.infoLabels["plot"] = data.strip() self.section = 1 def handle_endtag(self, tag): # Search for each end tag - if self.section >= 1 and tag == "div": + if self.section >= 1 and tag == u"div": self.section = 0 self.results.append(self.item.getListitemTuple(True)) self.reset_lists() http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=bf34e722f18824a1f13edf2e4d5eb4f066d0250e commit bf34e722f18824a1f13edf2e4d5eb4f066d0250e Author: sphere <sph...@dersphere.de> Date: Tue Feb 25 09:35:51 2014 +0100 [plugin.video.quake.live] updated to version 1.0.1 diff --git a/plugin.video.quake.live/addon.py b/plugin.video.quake.live/addon.py index 91d892a..be2c3fe 100644 --- a/plugin.video.quake.live/addon.py +++ b/plugin.video.quake.live/addon.py @@ -19,7 +19,7 @@ # Initiate Startup import xbmcutil action = xbmcutil.plugin.actions[0] -if action == "system": xbmcutil.sysCheck() +if action == u"system": xbmcutil.sysCheck() else: # Call Function Based on Action Param import main as plugin diff --git a/plugin.video.quake.live/addon.xml b/plugin.video.quake.live/addon.xml index baa66f0..fdbc532 100644 --- a/plugin.video.quake.live/addon.xml +++ b/plugin.video.quake.live/addon.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="plugin.video.quake.live" name="Quake Live" provider-name="willforde" version="1.0.0"> +<addon id="plugin.video.quake.live" name="Quake Live" provider-name="willforde" version="1.0.1"> <requires> <import addon="xbmc.python" version="2.1.0"/> - <import addon="script.module.xbmcutil" version="2.0.0"/> + <import addon="script.module.xbmcutil" version="2.0.2"/> </requires> <extension library="addon.py" point="xbmc.python.pluginsource"> <provides>video</provides> diff --git a/plugin.video.quake.live/changelog.txt b/plugin.video.quake.live/changelog.txt index 8a53bba..fe440e4 100644 --- a/plugin.video.quake.live/changelog.txt +++ b/plugin.video.quake.live/changelog.txt @@ -1,2 +1,6 @@ -[B]Version 1.0[/B] +[B]Version 1.0.1[/B] +- Added full unicode support +- Added youtube channel + +[B]Version 1.0.0[/B] - Initial Version \ No newline at end of file diff --git a/plugin.video.quake.live/resources/lib/main.py b/plugin.video.quake.live/resources/lib/main.py index 854d8b7..412a89c 100644 --- a/plugin.video.quake.live/resources/lib/main.py +++ b/plugin.video.quake.live/resources/lib/main.py @@ -23,13 +23,16 @@ class Initialize(listitem.VirtualFS): @plugin.error_handler def scraper(self): # Fetch Video Content - url = "http://www.quake-live.tv/data/playlist_MySQL.php?vf=&t=all&v=&s=DESC" + url = u"http://www.quake-live.tv/data/playlist_MySQL.php?vf=&t=all&v=&s=DESC" sourceObj = urlhandler.urlopen(url, 28800) # TTL = 8 Hours # Set Content Properties self.set_sort_methods(self.sort_method_date, self.sort_method_video_title) self.set_content("episodes") + # Add Youtube Channel + self.add_youtube_channel(u"TheQuakeLiveTV") + # Fetch and Return VideoItems return self.xml_scraper(sourceObj) @@ -42,26 +45,26 @@ class Initialize(listitem.VirtualFS): # Import XML Parser and Parse sourceObj import xml.etree.ElementTree as ElementTree tree = ElementTree.parse(sourceObj).getroot() - ns = "http://xspf.org/ns/0/" + ns = u"http://xspf.org/ns/0/" sourceObj.close() # Loop thought earch Show element - for node in tree.getiterator("{%s}track" % ns): + for node in tree.getiterator(u"{%s}track" % ns): # Create listitem of Data item = localListitem() item.setAudioInfo() item.setQualityIcon(False) - item.setStreamDict("aspect", 1.78) - item.setLabel(node.findtext("{%s}title" % ns).replace("\n","").encode("utf-8")) - item.setThumbnailImage(node.findtext("{%s}image" % ns).encode("utf-8")) - item.setParamDict(url=node.findtext("{%s}location" % ns).encode("utf-8"), action="system.direct") + item.setStreamDict(u"aspect", 1.78) + item.setLabel(node.findtext(u"{%s}title" % ns).replace(u"\n",u"")) + item.setThumbnailImage(node.findtext(u"{%s}image" % ns)) + item.setParamDict(url=node.findtext(u"{%s}location" % ns), action="system.direct") # Add Date Info - date = node.findtext("{%s}creator" % ns).replace("\n"," ") - item.setDateInfo(date[date.rfind(" ")+1:], "%m/%d/%y") + date = node.findtext(u"{%s}creator" % ns).replace(u"\n",u" ") + item.setDateInfo(date[date.rfind(u" ")+1:], "%m/%d/%y") # Store Listitem data additem(item.getListitemTuple(isPlayable=True)) # Return list of listitems - return results \ No newline at end of file + return results http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=a549b6704136213765ca7c3b97dd8a7a9cb3c407 commit a549b6704136213765ca7c3b97dd8a7a9cb3c407 Author: sphere <sph...@dersphere.de> Date: Tue Feb 25 09:35:49 2014 +0100 [plugin.video.metalvideo] updated to version 1.0.1 diff --git a/plugin.video.metalvideo/addon.py b/plugin.video.metalvideo/addon.py index 91d892a..be2c3fe 100644 --- a/plugin.video.metalvideo/addon.py +++ b/plugin.video.metalvideo/addon.py @@ -19,7 +19,7 @@ # Initiate Startup import xbmcutil action = xbmcutil.plugin.actions[0] -if action == "system": xbmcutil.sysCheck() +if action == u"system": xbmcutil.sysCheck() else: # Call Function Based on Action Param import main as plugin diff --git a/plugin.video.metalvideo/addon.xml b/plugin.video.metalvideo/addon.xml index 85e6247..ec2013d 100644 --- a/plugin.video.metalvideo/addon.xml +++ b/plugin.video.metalvideo/addon.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="plugin.video.metalvideo" name="Metalvideo" provider-name="willforde" version="1.0.0"> +<addon id="plugin.video.metalvideo" name="Metalvideo" provider-name="willforde" version="1.0.1"> <requires> <import addon="xbmc.python" version="2.1.0"/> - <import addon="script.module.xbmcutil" version="2.0.0"/> + <import addon="script.module.xbmcutil" version="2.0.2"/> </requires> <extension library="addon.py" point="xbmc.python.pluginsource"> - <provides>video</provides> + <provides>audio video</provides> </extension> <extension point="xbmc.addon.metadata"> <language>en</language> diff --git a/plugin.video.metalvideo/changelog.txt b/plugin.video.metalvideo/changelog.txt index 8a53bba..9e300b7 100644 --- a/plugin.video.metalvideo/changelog.txt +++ b/plugin.video.metalvideo/changelog.txt @@ -1,2 +1,8 @@ -[B]Version 1.0[/B] +[B]Version 1.0.1[/B] +- Fixed artist needing to be a list of artists in Gotham +- Changed Addon to show under Music Addons as well as Video Addons +- Added Ability to save searches +- Added full unicode support + +[B]Version 1.0.0[/B] - Initial Version \ No newline at end of file diff --git a/plugin.video.metalvideo/resources/lib/main.py b/plugin.video.metalvideo/resources/lib/main.py index 8aa30df..acd87a3 100644 --- a/plugin.video.metalvideo/resources/lib/main.py +++ b/plugin.video.metalvideo/resources/lib/main.py @@ -23,7 +23,7 @@ import re class Initialize(listitem.VirtualFS): @plugin.error_handler def scraper(self): - url = "http://metalvideo.com/mobile/category.html" + url = u"http://metalvideo.com/mobile/category.html" sourceCode = urlhandler.urlread(url, 604800, headers={"Cookie":"COOKIE_DEVICE=mobile"}, userAgent=2) # TTL = 1 Week # Set Content Properties @@ -40,17 +40,17 @@ class Initialize(listitem.VirtualFS): localListitem = listitem.ListItem # Add Extra Items - self.add_item(label="-Random Video", url={"action":"PlayVideo", "url":"http://www.metalvideo.com/randomizer.php"}, isPlayable=True) - self.add_item(label="-Top 50 Videos", url={"action":"TopVideos", "url":"http://www.metalvideo.com/topvideos.html"}, isPlayable=False) - self.add_item(label="-Latest Videos", url={"action":"NewVideos", "url":"http://www.metalvideo.com/newvideos.html"}, isPlayable=False) - self.add_item(label="-Search", url={"action":"VideoList"}, isPlayable=False) + self.add_item(label=u"-Random Video", url={"action":"PlayVideo", "url":u"http://www.metalvideo.com/randomizer.php"}, isPlayable=True) + self.add_item(label=u"-Top 50 Videos", url={"action":"TopVideos", "url":u"http://www.metalvideo.com/topvideos.html"}, isPlayable=False) + self.add_item(label=u"-Latest Videos", url={"action":"NewVideos", "url":u"http://www.metalvideo.com/newvideos.html"}, isPlayable=False) + self.add_search("VideoList", "http://www.metalvideo.com/search.php?keywords=%s") # Loop and display each Video for url, title, count in re.findall('<li class=""><a href="http://metalvideo.com/mobile/(\S+?)date.html">(.+?)</a>\s+<span class="category_count">(\d+)</span></li>', sourceCode): # Create listitem of Data item = localListitem() - item.setLabel("%s (%s)" % (title, count)) - item.setParamDict(action="VideoList", url="http://metalvideo.com/%s" % url) + item.setLabel(u"%s (%s)" % (title, count)) + item.setParamDict(action="VideoList", url=u"http://metalvideo.com/%s" % url) # Store Listitem data additem(item.getListitemTuple(isPlayable=False)) @@ -67,22 +67,22 @@ class TopVideos(listitem.VirtualFS): # Set Content Properties self.set_sort_methods(self.sort_method_program_count) - self.set_content("musicvideos") + self.set_content("episodes") # Fetch and Return VideoItems return self.regex_scraper(sourceCode) def regex_selector(self): # Fetch SourceCode - url = "http://metalvideo.com/topvideos.html" + url = u"http://metalvideo.com/topvideos.html" sourceCode = urlhandler.urlread(url, 2678400) # TTL = 1 Month # Fetch list of Top Video Category - topLists = [part for part in re.findall('<option value="(\S+?)"\s*>\s*(.+?)\s*</option>', sourceCode) if not "Select one" in part[1]] + topLists = [part for part in re.findall('<option value="(\S+?)"\s*>\s*(.+?)\s*</option>', sourceCode) if not u"Select one" in part[1]] titleList = [part[1] for part in topLists] # Display list for Selection - ret = plugin.dialogSelect(plugin.getstr(30600), titleList) + ret = plugin.dialogSelect(plugin.getuni(30600), titleList) if ret >= 0: return topLists[ret][0] else: raise plugin.ScraperError(0, "User Has Quit the Top Display") @@ -97,13 +97,13 @@ class TopVideos(listitem.VirtualFS): for count, url, img, artist, track, views in re.findall('<tr>\s+<td align="center" class="row\d">(\d+).</td>\s+<td align="center" class="row\d" width="\d+"><a href="(\S+?)"><img src="(\S+?)" alt=".+?" class="tinythumb" width="\d+" height="\d+" align="left" border="1" /></a></td>\s+<td class="row\d">(.+?)</td>\s+<td class="row\d"><a href="\S+?">(.+?)</a></td>\s+<td class="row\d">([\d,]+)</td>\s+</tr>', sourceCode): # Create listitem of Data item = localListitem() - item.setLabel("%s. %s - %s" % (count, artist, track)) + item.setLabel(u"%s. %s - %s" % (count, artist, track)) item.setThumbnailImage(img) - item.setInfoDict(artist=artist, count=intCmd(views.replace(",",""))) + item.setInfoDict(artist=[artist], count=intCmd(views.replace(u",",u""))) item.setParamDict(action="PlayVideo", url=url) # Add Context item to link to related videos - item.addRelatedContext(url=url[url.rfind("_")+1:url.rfind(".")]) + item.addRelatedContext(url=url[url.rfind(u"_")+1:url.rfind(u".")]) # Store Listitem data additem(item.getListitemTuple(isPlayable=True)) @@ -119,7 +119,7 @@ class NewVideos(listitem.VirtualFS): # Set Content Properties self.set_sort_methods(self.sort_method_unsorted) - self.set_content("musicvideos") + self.set_content("episodes") # Fetch and Return VideoItems return self.regex_scraper(sourceCode) @@ -132,7 +132,7 @@ class NewVideos(listitem.VirtualFS): # Add Next Page if Exists nextUrl = re.findall('<a href="(\S+?)">next \xc2\xbb</a>', sourceCode) - if nextUrl: self.add_next_page(url={"url":"http://www.metalvideo.com/%s" % nextUrl[0]}) + if nextUrl: self.add_next_page(url={"url":u"http://www.metalvideo.com/%s" % nextUrl[0]}) # Iterate the list of videos for url, img, artist, track in re.findall('<tr><td align="center" class="\w+" width="\d+"><a href="(\S+?)"><img src="(\S+?)" alt=".+?" class="tinythumb" width="\d+" height="\d+" align="left" border="1" /></a></td><td class="\w+" width="\w+">(.+?)<td class="\w+"><a href="\S+?">(.+?)</a></td><td class="\w+">.+?</td></tr>', sourceCode): @@ -141,13 +141,13 @@ class NewVideos(listitem.VirtualFS): # Create listitem of Data item = localListitem() - item.setLabel("%s - %s" % (artist, track)) + item.setLabel(u"%s - %s" % (artist, track)) item.setThumbnailImage(img) - item.setInfoDict(artist=artist) + item.setInfoDict(artist=[artist]) item.setParamDict(action="PlayVideo", url=url) # Add Context item to link to related videos - item.addRelatedContext(url=url[url.rfind("_")+1:url.rfind(".")]) + item.addRelatedContext(url=url[url.rfind(u"_")+1:url.rfind(u".")]) # Store Listitem data additem(item.getListitemTuple(isPlayable=True)) @@ -159,17 +159,17 @@ class Related(listitem.VirtualFS): @plugin.error_handler def scraper(self): # Fetch SourceCode - url = "http://metalvideo.com/relatedclips.php?vid=%(url)s" % plugin - sourceCode = urlhandler.urlread(url, 28800) # TTL = 8 Hours + url = u"http://metalvideo.com/relatedclips.php?vid=%(url)s" % plugin + sourceObj = urlhandler.urlopen(url, 28800) # TTL = 8 Hours # Set Content Properties self.set_sort_methods(self.sort_method_unsorted) - self.set_content("musicvideos") + self.set_content("episodes") # Fetch and Return VideoItems - return self.xml_scraper(sourceCode) + return self.xml_scraper(sourceObj) - def xml_scraper(self, sourceCode): + def xml_scraper(self, sourceObj): # Create Speed vars results = [] additem = results.append @@ -177,21 +177,22 @@ class Related(listitem.VirtualFS): # Import XML Parser and Parse sourceObj import xml.etree.ElementTree as ElementTree - tree = ElementTree.fromstring(sourceCode.replace("&","&")) + tree = ElementTree.fromstring(sourceObj.read().replace("&","&")) + sourceObj.close() - # Loop thought earch Show element - for node in tree.getiterator("video"): + # Loop through each Show element + for node in tree.getiterator(u"video"): # Create listitem of Data item = localListitem() - item.setLabel(node.findtext("title").encode("utf-8")) - item.setThumbnailImage(node.findtext("thumb").encode("utf-8")) + item.setLabel(node.findtext(u"title")) + item.setThumbnailImage(node.findtext(u"thumb")) # Add url Param - url = node.findtext("url").encode("utf-8") + url = node.findtext(u"url") item.setParamDict(action="PlayVideo", url=url) # Add Context item to link to related videos - item.addRelatedContext(url=url[url.rfind("_")+1:url.rfind(".")], updatelisting="true") + item.addRelatedContext(url=url[url.rfind(u"_")+1:url.rfind(u".")], updatelisting="true") # Store Listitem data additem(item.getListitemTuple(isPlayable=True)) @@ -202,17 +203,18 @@ class Related(listitem.VirtualFS): class VideoList(listitem.VirtualFS): @plugin.error_handler def scraper(self): - # Fetch SourceCode - if "url" in plugin: - # Fetch Sort Method and Crerate New Url - urlString = {"0":"%sdate.html", "1":"%sartist.html", "2":"%srating.html", "3":"%sviews.html"}[plugin.getSetting("sort")] + # Fetch Sort Method and Crerate New Url + if u"search.php" in plugin["url"]: url = plugin["url"] + else: + urlString = {u"0":u"%sdate.html", u"1":u"%sartist.html", u"2":u"%srating.html", u"3":u"%sviews.html"}[plugin.getSetting("sort")] url = urlString % plugin["url"] - else: url = urlhandler.search("http://www.metalvideo.com/search.php?keywords=%s"); self.cacheToDisc= True + + # Fetch SourceCode sourceCode = urlhandler.urlread(url, 28800) # TTL = 8 Hours # Set Content Properties self.set_sort_methods(self.sort_method_unsorted) - self.set_content("musicvideos") + self.set_content("episodes") # Fetch and Return VideoItems return self.regex_scraper(sourceCode) @@ -226,23 +228,22 @@ class VideoList(listitem.VirtualFS): # Add Next Page if Exists nextUrl = re.findall('<a href="(\S+?)">next \xc2\xbb</a>', sourceCode) - if nextUrl: self.add_next_page(url={"url":"http://www.metalvideo.com/%s" % nextUrl[0]}) + if nextUrl: self.add_next_page(url={"url":u"http://www.metalvideo.com/%s" % nextUrl[0]}) # Iterate the list of videos searchUrl = re.compile('<a href="(\S+?)">') searchImg = re.compile('<img src="(\S+?)"') searchSong = re.compile('<span class="song_name">(.+?)</span>') searchArtist = re.compile('<span class="artist_name">(.+?)</span>') - for htmlSegment in CommonFunctions.parseDOM(sourceCode, "li", {"class":"video"}): - # Convert String Encoding - htmlSegment = htmlSegment.encode("utf8") + for htmlSegment in CommonFunctions.parseDOM(sourceCode, u"li", {u"class":u"video"}): + # Fetch artist and url artist = searchArtist.findall(htmlSegment)[0] url = searchUrl.findall(htmlSegment)[0] # Create listitem of Data item = localListitem() - item.setLabel("%s - %s" % (artist, searchSong.findall(htmlSegment)[0])) - item.setInfoDict(artist=artist) + item.setLabel(u"%s - %s" % (artist, searchSong.findall(htmlSegment)[0])) + item.setInfoDict(artist=[artist]) item.setParamDict(action="PlayVideo", url=url) # Set Thumbnail Image @@ -250,7 +251,7 @@ class VideoList(listitem.VirtualFS): if image: item.setThumbnailImage(image[0]) # Add Context item to link to related videos - item.addRelatedContext(url=url[url.rfind("_")+1:url.rfind(".")]) + item.addRelatedContext(url=url[url.rfind(u"_")+1:url.rfind(u".")]) # Store Listitem data additem(item.getListitemTuple(isPlayable=True)) @@ -262,14 +263,14 @@ class PlayVideo(listitem.PlayMedia): @plugin.error_handler def resolve(self): # Set TTL - if plugin["url"].endswith("randomizer.php"): TTL=0 + if plugin["url"].endswith(u"randomizer.php"): TTL=0 else: TTL=604800 # TTL = 1 Week # Fetch Page Source - sourceCode = urlhandler.urlread(plugin["url"], TTL) # TTL = 8 Hours + sourceCode = urlhandler.urlread(plugin["url"], TTL) from xbmcutil import videoResolver # Look for Youtube Video First videoId = [part for part in re.findall('src="(http://www.youtube.com/embed/\S+?)"|file:\s+\'(\S+?)\'', sourceCode)[0] if part][0] - if "www.metalvideo.com" in videoId: return {"url":videoId} - else: return videoResolver.youtube_com().decode(videoId) + if u"metalvideo.com" in videoId: return {"url":videoId} + elif u"youtube.com" in videoId: return videoResolver.youtube_com().decode(videoId) http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=400ff308e14378938d4dc54138c0e97b08bb9748 commit 400ff308e14378938d4dc54138c0e97b08bb9748 Author: sphere <sph...@dersphere.de> Date: Tue Feb 25 09:35:47 2014 +0100 [plugin.video.johnlocker] updated to version 1.0.1 diff --git a/plugin.video.johnlocker/addon.py b/plugin.video.johnlocker/addon.py index 91d892a..be2c3fe 100644 --- a/plugin.video.johnlocker/addon.py +++ b/plugin.video.johnlocker/addon.py @@ -19,7 +19,7 @@ # Initiate Startup import xbmcutil action = xbmcutil.plugin.actions[0] -if action == "system": xbmcutil.sysCheck() +if action == u"system": xbmcutil.sysCheck() else: # Call Function Based on Action Param import main as plugin diff --git a/plugin.video.johnlocker/addon.xml b/plugin.video.johnlocker/addon.xml index 48253a8..2bf1a94 100644 --- a/plugin.video.johnlocker/addon.xml +++ b/plugin.video.johnlocker/addon.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="plugin.video.johnlocker" name="JohnLocker" provider-name="willforde" version="1.0.0"> +<addon id="plugin.video.johnlocker" name="JohnLocker" provider-name="willforde" version="1.0.1"> <requires> <import addon="xbmc.python" version="2.1.0"/> - <import addon="script.module.xbmcutil" version="2.0.0"/> + <import addon="script.module.xbmcutil" version="2.0.2"/> </requires> <extension library="addon.py" point="xbmc.python.pluginsource"> <provides>video</provides> @@ -11,6 +11,7 @@ <language>en</language> <platform>all</platform> <summary lang="en">JohnLocker, Anonymous online education.</summary> + <description lang="en">JohnLocker, Anonymous online education and documentaries.</description> <license>GNU GENERAL PUBLIC LICENSE. Version 3, June 2007</license> <email>willforde+x...@gmail.com</email> <forum>http://forum.xbmc.org/showthread.php?tid=178796</forum> diff --git a/plugin.video.johnlocker/changelog.txt b/plugin.video.johnlocker/changelog.txt index 8a53bba..0d8a189 100644 --- a/plugin.video.johnlocker/changelog.txt +++ b/plugin.video.johnlocker/changelog.txt @@ -1,2 +1,5 @@ -[B]Version 1.0[/B] +[B]Version 1.0.1[/B] +- Added full unicode support + +[B]Version 1.0.0[/B] - Initial Version \ No newline at end of file diff --git a/plugin.video.johnlocker/resources/lib/main.py b/plugin.video.johnlocker/resources/lib/main.py index ca4cace..948ea7c 100644 --- a/plugin.video.johnlocker/resources/lib/main.py +++ b/plugin.video.johnlocker/resources/lib/main.py @@ -23,7 +23,7 @@ class Initialize(listitem.VirtualFS): @plugin.error_handler def scraper(self): # Fetch List of Revision3 Shows - url = "http://johnlocker.com/home/main?mlvd=oc&mmvd=oc&mhrvd=oc&mfvd=oc" + url = u"http://johnlocker.com/home/main?mlvd=oc&mmvd=oc&mhrvd=oc&mfvd=oc" sourceCode = urlhandler.urlread(url, 2678400) # TTL = 1 Month # Set Content Properties @@ -40,21 +40,18 @@ class Initialize(listitem.VirtualFS): localListitem = listitem.ListItem # Add Extra Items - #self.add_item("-Channels", thumbnail=("channels.jpg",1), url={"action":"Channels", "url":"http://johnlocker.com/home/channel"}) - self.add_item("-Most Recent", thumbnail=("latest.png",1), url={"action":"Videos", "url":"http://johnlocker.com/home/main?mlvd=oc&mmvd=oc&mhrvd=oc&mfvd=oc", "section":"latestvideos"}) - self.add_item("-Most viewed", thumbnail=("viewed.jpg",1), url={"action":"Videos", "url":"http://johnlocker.com/home/main?mlvd=oc&mmvd=oc&mhrvd=oc&mfvd=oc", "section":"mostviewed"}) - self.add_item("-Highest rated", thumbnail=("rated.jpg",1), url={"action":"Videos", "url":"http://johnlocker.com/home/main?mlvd=oc&mmvd=oc&mhrvd=oc&mfvd=oc", "section":"highestrated"}) - self.add_item("-Featured", thumbnail=("featured.png",1), url={"action":"Videos", "url":"http://johnlocker.com/home/main?mlvd=oc&mmvd=oc&mhrvd=oc&mfvd=oc", "section":"featured"}) + #self.add_item(u"-Channels", thumbnail=(u"channels.jpg",1), url={"action":"Channels", "url":"http://johnlocker.com/home/channel"}) + self.add_item(u"-Most Recent", thumbnail=(u"latest.png",1), url={"action":"Videos", "url":"http://johnlocker.com/home/main?mlvd=oc&mmvd=oc&mhrvd=oc&mfvd=oc", "section":"latestvideos"}) + self.add_item(u"-Most viewed", thumbnail=(u"viewed.jpg",1), url={"action":"Videos", "url":"http://johnlocker.com/home/main?mlvd=oc&mmvd=oc&mhrvd=oc&mfvd=oc", "section":"mostviewed"}) + self.add_item(u"-Highest rated", thumbnail=(u"rated.jpg",1), url={"action":"Videos", "url":"http://johnlocker.com/home/main?mlvd=oc&mmvd=oc&mhrvd=oc&mfvd=oc", "section":"highestrated"}) + self.add_item(u"-Featured", thumbnail=(u"featured.png",1), url={"action":"Videos", "url":"http://johnlocker.com/home/main?mlvd=oc&mmvd=oc&mhrvd=oc&mfvd=oc", "section":"featured"}) # Loop and display each Video import CommonFunctions, re searchUrlTitle = re.compile('<a href="(http://johnlocker.com/home/category/videos/\d+)" style="font-weight:bold;">\s+(.+?)\s+</a>') searchImg = re.compile('<img class="listedvideolistthumbnailmc" src="(http://johnlocker.com/categories/\S+.jpg)"') - sectionCat = CommonFunctions.parseDOM(sourceCode, "div", {"id":"categories"}) - for htmlSegment in CommonFunctions.parseDOM(sectionCat, "div", {"class":"listedvideolistvideomc"}): - # Convert String Encoding - htmlSegment = htmlSegment.encode("utf8") - + sectionCat = CommonFunctions.parseDOM(sourceCode, u"div", {u"id":u"categories"}) + for htmlSegment in CommonFunctions.parseDOM(sectionCat, u"div", {u"class":u"listedvideolistvideomc"}): # Fetch Url and Title url, title = searchUrlTitle.findall(htmlSegment)[0] @@ -62,7 +59,7 @@ class Initialize(listitem.VirtualFS): item = localListitem() item.setLabel(title) item.setThumbnailImage(searchImg.findall(htmlSegment)[0]) - item.setParamDict(action="Videos", url="%s?cvld=oc" % url) + item.setParamDict(action="Videos", url=u"%s?cvld=oc" % url) # Store Listitem data additem(item.getListitemTuple(isPlayable=False)) @@ -94,11 +91,8 @@ class Channels(listitem.VirtualFS): import CommonFunctions, re searchUrlTitle = re.compile('<div class="channelitemtitle"><a href="(http://johnlocker.com/home/channel/\d+)">(.+?)</a>') searchImg = re.compile('<img class="channelitemimage" src="(http://johnlocker.com/\S+\.jpg)"') - for htmlSegment in CommonFunctions.parseDOM(sourceCode, "div", {"class":"channelitem"}): - # Convert String Encoding - htmlSegment = htmlSegment.encode("utf8") - - img = re.findall('<img class="channelitemimage" src="(http://johnlocker.com/\S+\.jpg)"', htmlSegment) + for htmlSegment in CommonFunctions.parseDOM(sourceCode, u"div", {u"class":u"channelitem"}): + img = searchImg.findall(htmlSegment) if img: img = img[0] else: continue @@ -124,7 +118,7 @@ class Videos(listitem.VirtualFS): sourceCode = urlhandler.urlread(plugin["url"], 28800) # TTL = 8 Hours # Set Content Properties - if "section" in plugin and plugin["section"] == "mostviewed": self.set_sort_methods(self.sort_method_program_count, self.sort_method_date, self.sort_method_video_runtime, self.sort_method_title) + if "section" in plugin and plugin["section"] == u"mostviewed": self.set_sort_methods(self.sort_method_program_count, self.sort_method_date, self.sort_method_video_runtime, self.sort_method_title) else: self.set_sort_methods(self.sort_method_date, self.sort_method_video_runtime, self.sort_method_program_count, self.sort_method_title) self.set_content("episodes") @@ -140,9 +134,9 @@ class Videos(listitem.VirtualFS): # Restrict to Selected Section and Add Next Page import CommonFunctions, re - if "section" in plugin: sourceCode = CommonFunctions.parseDOM(sourceCode, "div", {"id":plugin["section"]})[0] + if "section" in plugin: sourceCode = CommonFunctions.parseDOM(sourceCode, u"div", {u"id":plugin["section"]})[0] nextUrl = re.findall('<a class="pagination" href="(\S+?)">Next</a>', sourceCode) - if nextUrl: self.add_next_page(url={"url":"http://johnlocker.com%s&mlvd=oc&mmvd=oc&mhrvd=oc&mfvd=oc&cvld=oc" % nextUrl[0], "section":plugin.get("section","")}) + if nextUrl: self.add_next_page(url={"url":u"http://johnlocker.com%s&mlvd=oc&mmvd=oc&mhrvd=oc&mfvd=oc&cvld=oc" % nextUrl[0], "section":plugin.get("section","")}) # Loop and display each Video searchUrl = re.compile('<a href="(http://johnlocker.com/home/video/\S+?)"') @@ -152,10 +146,7 @@ class Videos(listitem.VirtualFS): searchTime = re.compile('<div class="listedvideolistfootdivoc">\s+Added date: \d+-\d+-\d+\s+- Duration:(.+?)\s+</div>') searchImg = re.compile('<img class="listedvideolistthumbnailoc" src="(http://\S+?)"') searchViews = re.compile('<div class="clear"></div>\s+</div>\s+Views : (\d+)\s+</div>') - for htmlSegment in CommonFunctions.parseDOM(sourceCode, "div", {"class":"listedvideolistvideooc"}): - # Convert String Encoding - htmlSegment = htmlSegment.encode("utf8") - + for htmlSegment in CommonFunctions.parseDOM(sourceCode, u"div", {u"class":u"listedvideolistvideooc"}): # Create listitem of Data item = localListitem() item.setLabel(searchTitle.findall(htmlSegment)[0]) @@ -177,7 +168,7 @@ class Videos(listitem.VirtualFS): except: pass # Add Context item to link to related videos - item.addRelatedContext(url="%s?rvds=oc" % url) + item.addRelatedContext(url=u"%s?rvds=oc" % url) # Store Listitem data additem(item.getListitemTuple(isPlayable=True)) @@ -213,10 +204,7 @@ class Related(listitem.VirtualFS): searchTime = re.compile('<div class="watchpagelistdurationdivmc">\s*(\d+:\d+:\d+)\s+</div>') searchImg = re.compile('<img class="videothumbscv" src="(http://\S+?)"') searchViews = re.compile('<div\s+class="watchpagelistviewsdiv">\s+Views: (\d+)\s+</div>') - for htmlSegment in CommonFunctions.parseDOM(sourceCode, "div", {"class":"relatedvideoslistrow"}): - # Convert String Encoding - htmlSegment = htmlSegment.encode("utf8") - + for htmlSegment in CommonFunctions.parseDOM(sourceCode, u"div", {u"class":u"relatedvideoslistrow"}): # Create listitem of Data item = localListitem() item.setLabel(searchTitle.findall(htmlSegment)[0]) @@ -236,7 +224,7 @@ class Related(listitem.VirtualFS): except: pass # Add Context item to link to related videos - item.addRelatedContext(url="%s?rvds=oc" % url, updatelisting="true") + item.addRelatedContext(url=u"%s?rvds=oc" % url, updatelisting="true") # Store Listitem data additem(item.getListitemTuple(isPlayable=True)) http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=8a9d8838159901812f7d116b9e8aa619dd940c7b commit 8a9d8838159901812f7d116b9e8aa619dd940c7b Author: sphere <sph...@dersphere.de> Date: Tue Feb 25 09:35:44 2014 +0100 [plugin.video.engineeringtv] updated to version 1.0.1 diff --git a/plugin.video.engineeringtv/addon.py b/plugin.video.engineeringtv/addon.py index 91d892a..be2c3fe 100644 --- a/plugin.video.engineeringtv/addon.py +++ b/plugin.video.engineeringtv/addon.py @@ -19,7 +19,7 @@ # Initiate Startup import xbmcutil action = xbmcutil.plugin.actions[0] -if action == "system": xbmcutil.sysCheck() +if action == u"system": xbmcutil.sysCheck() else: # Call Function Based on Action Param import main as plugin diff --git a/plugin.video.engineeringtv/addon.xml b/plugin.video.engineeringtv/addon.xml index b5bad32..baefd59 100644 --- a/plugin.video.engineeringtv/addon.xml +++ b/plugin.video.engineeringtv/addon.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="plugin.video.engineeringtv" name="Engineering TV" provider-name="willforde" version="1.0.0"> +<addon id="plugin.video.engineeringtv" name="Engineering TV" provider-name="willforde" version="1.0.1"> <requires> <import addon="xbmc.python" version="2.1.0"/> - <import addon="script.module.xbmcutil" version="2.0.0"/> + <import addon="script.module.xbmcutil" version="2.0.2"/> </requires> <extension library="addon.py" point="xbmc.python.pluginsource"> <provides>video</provides> diff --git a/plugin.video.engineeringtv/changelog.txt b/plugin.video.engineeringtv/changelog.txt index 8a53bba..d8846fe 100644 --- a/plugin.video.engineeringtv/changelog.txt +++ b/plugin.video.engineeringtv/changelog.txt @@ -1,2 +1,10 @@ -[B]Version 1.0[/B] +[B]Version 1.0.1[/B] +- Fixed Video Url Scraper After Site Changed, Now Has Better Video Quality +- Added a Fallback Video Scraper if main Scraper Failes +- Added Search with Save Searches Support +- Added Support for Related Videos +- Added Full Unicode Support +- Changed print with xbmc.log + +[B]Version 1.0.0[/B] - Initial Version \ No newline at end of file diff --git a/plugin.video.engineeringtv/resources/lib/main.py b/plugin.video.engineeringtv/resources/lib/main.py index f99255e..26c49ed 100644 --- a/plugin.video.engineeringtv/resources/lib/main.py +++ b/plugin.video.engineeringtv/resources/lib/main.py @@ -23,15 +23,18 @@ class Initialize(listitem.VirtualFS): @plugin.error_handler def scraper(self): # Fetch SourceCode of Site - url = "http://www.engineeringtv.com/pages/about.us" + url = u"http://www.engineeringtv.com/pages/about.us" sourceCode = urlhandler.urlread(url, 2678400) # TTL = 1 Week + # Add Search Page + self.add_search("Videos", u"/search/?search=%s") + # Set Content Properties self.set_sort_methods(self.sort_method_unsorted) self.set_content("files") # Fetch and Return VideoItems - self.add_youtube_channel("engineeringtv") + self.add_youtube_channel(u"engineeringtv") return self.regex_scraper(sourceCode) def regex_scraper(self, sourceCode): @@ -46,7 +49,7 @@ class Initialize(listitem.VirtualFS): # Create listitem of Data item = localListitem() item.setLabel(title) - item.setThumbnailImage("%s.jpg" % url, 1) + item.setThumbnailImage(u"%s.jpg" % url, 1) item.setParamDict(action="Videos", subaction="subcat", url=url) # Store Listitem data @@ -59,19 +62,19 @@ class Videos(listitem.VirtualFS): @plugin.error_handler def scraper(self): # Decide on to Show sub Categories or directly show videos - if plugin.get("subaction") == "subcat": return self.subCategories(plugin["url"]) + if plugin.get("subaction",u"") == u"subcat": return self.subCategories(plugin["url"]) else: return self.videoList(plugin["url"]) def subCategories(self, catID): # Fetch SourceCode - url = "http://www.engineeringtv.com/pages/%s" % catID + url = u"http://www.engineeringtv.com/pages/%s" % catID sourceCode = urlhandler.urlread(url, 2678400) # TTL = 1 Week # Fetch List of Sub Categories import CommonFunctions, re searchID = re.compile('href="/feed/magnify.rss/(\S+?)"') - sources = CommonFunctions.parseDOM(sourceCode, "div", {"class":"mvp_page_title_expressive clearfix"}) - if len(sources) == 1: return self.videoList("/watch/playlist/%s" % searchID.findall(sources[0])[0]) + sources = CommonFunctions.parseDOM(sourceCode, u"div", {u"class":u"mvp_page_title_expressive clearfix"}) + if len(sources) == 1: return self.videoList(u"/watch/playlist/%s" % searchID.findall(sources[0])[0]) else: # Set Content Properties self.set_sort_methods(self.sort_method_unsorted) @@ -84,13 +87,10 @@ class Videos(listitem.VirtualFS): # Loop and display each source for htmlSegment in sources: - # Convert String Encoding - htmlSegment = htmlSegment.encode("utf8") - # Create listitem of Data item = localListitem() - item.setLabel(htmlSegment[htmlSegment.rfind("</div>")+6:].strip().title()) - item.setParamDict(action="Videos", url="/watch/playlist/%s" % searchID.findall(htmlSegment)[0]) + item.setLabel(htmlSegment[htmlSegment.rfind(u"</div>")+6:].strip().title()) + item.setParamDict(action="Videos", url=u"/watch/playlist/%s" % searchID.findall(htmlSegment)[0]) # Store Listitem data additem(item.getListitemTuple(isPlayable=False)) @@ -100,7 +100,8 @@ class Videos(listitem.VirtualFS): def videoList(self, playlistID): # Fetch SourceCode - url = "http://www.engineeringtv.com%s" % playlistID + if playlistID.startswith(u"?search="): url = u"http://www.engineeringtv.com/search/%s" % playlistID + else: url = u"http://www.engineeringtv.com%s" % playlistID sourceCode = urlhandler.urlread(url, 28800) # TTL = 8 Hours # Set Content Properties @@ -118,10 +119,11 @@ class Videos(listitem.VirtualFS): searchUrl = re.compile('<a href="(\S+?)"') searchImg = re.compile("background-image: url\('(\S+?)'\)") nextUrl = re.findall('<a class="mvp-pagenum-next mvp-pagenum-pagelink" href="(\S+?)">', sourceCode) - if nextUrl: self.add_next_page(url={"url":nextUrl[0]}, infoType="video") - for htmlSegment in CommonFunctions.parseDOM(sourceCode, "div", {"class":"mvp_grid_panel_4"}): - # Convert String Encoding - htmlSegment = htmlSegment.encode("utf8") + if nextUrl: self.add_next_page(url={"url":nextUrl[0]}) + for htmlSegment in CommonFunctions.parseDOM(sourceCode, u"div", {u"class":u"mvp_grid_panel_\d"}): + # Fetch url + url = searchUrl.findall(htmlSegment)[0] + url = url[url.rfind("/video/"):] # Create listitem of Data item = localListitem() @@ -129,7 +131,57 @@ class Videos(listitem.VirtualFS): item.setQualityIcon(False) item.setLabel(searchTitle.findall(htmlSegment)[0]) item.setThumbnailImage(searchImg.findall(htmlSegment)[0]) - item.setParamDict(action="PlayVideo", url=searchUrl.findall(htmlSegment)[0]) + item.setParamDict(action="PlayVideo", url=url) + + # Add Context item to link to related videos + item.addRelatedContext(url=url) + + # Store Listitem data + additem(item.getListitemTuple(isPlayable=True)) + + # Return list of listitems + return results + +class Related(listitem.VirtualFS): + @plugin.error_handler + def scraper(self): + # Fetch SourceCode of Site + url = u"http://www.engineeringtv.com%(url)s" % plugin + sourceCode = urlhandler.urlread(url, 28800) # TTL = 8 Hours + + # Set Content Properties + self.set_sort_methods(self.sort_method_unsorted) + self.set_content("episodes") + + # Fetch and Return VideoItems + return self.regex_scraper(sourceCode) + + def regex_scraper(self, sourceCode): + # Create Speed vars + results = [] + additem = results.append + localListitem = listitem.ListItem + + # Loop and display each Video + import CommonFunctions, re + searchTitle = re.compile('title="(.+?)"') + searchUrl = re.compile('<a href="(\S+?)"') + searchImg = re.compile("background-image: url\('(http\S+?)'\)") + for htmlSegment in CommonFunctions.parseDOM(sourceCode, u"div", {u"class":u"magnify-widget-playlist-item"}): + # Fetch url + url = searchUrl.findall(htmlSegment)[0] + url = url[url.rfind("/video/"):] + + # Create listitem of Data + item = localListitem() + item.setAudioInfo() + item.setQualityIcon(False) + item.setLabel(searchTitle.findall(htmlSegment)[0]) + item.setThumbnailImage(searchImg.findall(htmlSegment)[0]) + item.setParamDict(action="PlayVideo", url=url) + + # Add Context item to link to related videos + item.addRelatedContext(url=url, updatelisting="true") # Store Listitem data additem(item.getListitemTuple(isPlayable=True)) @@ -140,10 +192,29 @@ class Videos(listitem.VirtualFS): class PlayVideo(listitem.PlayMedia): @plugin.error_handler def resolve(self): - # Fetch SourceCode of Site + # Call Needed Imports import re - url = "http://www.engineeringtv.com%(url)s" % plugin - sourceCode = urlhandler.urlread(url, 86400) # TTL = 24 Hours - url = re.findall('link=(\S+?)" autoplay controls poster', sourceCode)[0] - if url.endswith("\\"): return {"type":"video/mp4", "url":url[:-1]} - else: return {"type":"video/mp4", "url":url} + + try: + # Fetch SourceCode of Site + url = u"http://www.engineeringtv.com%(url)s/player" % plugin + sourceCode = urlhandler.urlread(url, 1800) # TTL = 30 Mins + + # Fetch Query String with video id + queryString = re.findall("queryString\s*=\s*'(\S+?)'", sourceCode)[0] + url = u"http://www.engineeringtv.com/embed/player/container/300/300/?%s" % queryString + sourceCode = urlhandler.urlread(url, 1800) # TTL = 30 Mins + + # Fetch Video Url + videoUrl = re.findall('"pipeline_xid"\s*:\s*"(http://videos\.\S+?)"', sourceCode)[0] + return {"type":u"video/mp4", "url":videoUrl} + + except: + # Fetch SourceCode of Site + url = u"http://www.engineeringtv.com%(url)s" % plugin + sourceCode = urlhandler.urlread(url, 86400) # TTL = 24 Hours + + # Fetch Video Url + try: url = re.findall('src=\\\\"(http://videos\.cache\.magnify\.net/\S+?)\\\\" autoplay controls poster', sourceCode)[0] + except: return None + else: return {"type":u"video/mp4", "url":url} http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=ce753c08be2b462a4a555ba4bf114a6d7a16e026 commit ce753c08be2b462a4a555ba4bf114a6d7a16e026 Author: sphere <sph...@dersphere.de> Date: Tue Feb 25 09:35:41 2014 +0100 [plugin.video.enemy.territory] updated to version 1.0.1 diff --git a/plugin.video.enemy.territory/addon.py b/plugin.video.enemy.territory/addon.py index 91d892a..be2c3fe 100644 --- a/plugin.video.enemy.territory/addon.py +++ b/plugin.video.enemy.territory/addon.py @@ -19,7 +19,7 @@ # Initiate Startup import xbmcutil action = xbmcutil.plugin.actions[0] -if action == "system": xbmcutil.sysCheck() +if action == u"system": xbmcutil.sysCheck() else: # Call Function Based on Action Param import main as plugin diff --git a/plugin.video.enemy.territory/addon.xml b/plugin.video.enemy.territory/addon.xml index f5bf190..a49a376 100644 --- a/plugin.video.enemy.territory/addon.xml +++ b/plugin.video.enemy.territory/addon.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="plugin.video.enemy.territory" name="Enemy Territory" provider-name="willforde" version="1.0.0"> +<addon id="plugin.video.enemy.territory" name="Enemy Territory" provider-name="willforde" version="1.0.1"> <requires> <import addon="xbmc.python" version="2.1.0"/> - <import addon="script.module.xbmcutil" version="2.0.0"/> + <import addon="script.module.xbmcutil" version="2.0.2"/> </requires> <extension library="addon.py" point="xbmc.python.pluginsource"> <provides>video</provides> @@ -11,6 +11,7 @@ <language>en</language> <platform>all</platform> <summary lang="en">Enemy Territory, Archived Enemy Territory Matchs.</summary> + <description lang="en">Enemy Territory, Archived Enemy Territory Matchs.</description> <license>GNU GENERAL PUBLIC LICENSE. Version 3, June 2007</license> <email>willforde+x...@gmail.com</email> <forum>http://forum.xbmc.org/showthread.php?tid=178789</forum> diff --git a/plugin.video.enemy.territory/changelog.txt b/plugin.video.enemy.territory/changelog.txt index 8a53bba..4b377dd 100644 --- a/plugin.video.enemy.territory/changelog.txt +++ b/plugin.video.enemy.territory/changelog.txt @@ -1,2 +1,5 @@ -[B]Version 1.0[/B] +[B]Version 1.0.1[/B] +- Added Full Unicode Support + +[B]Version 1.0.0[/B] - Initial Version \ No newline at end of file diff --git a/plugin.video.enemy.territory/resources/lib/main.py b/plugin.video.enemy.territory/resources/lib/main.py index 50e6e2c..3f01097 100644 --- a/plugin.video.enemy.territory/resources/lib/main.py +++ b/plugin.video.enemy.territory/resources/lib/main.py @@ -23,7 +23,7 @@ class Initialize(listitem.VirtualFS): @plugin.error_handler def scraper(self): # Fetch Video Content - url = "http://enemyterritory.sectornetwork.com/data/playlist_MySQL.php?t=all&v=all&s=DESC&289" + url = u"http://enemyterritory.sectornetwork.com/data/playlist_MySQL.php?t=all&v=all&s=DESC&289" sourceObj = urlhandler.urlopen(url, 28800) # TTL = 8 Hours # Set Content Properties @@ -42,22 +42,22 @@ class Initialize(listitem.VirtualFS): # Import XML Parser and Parse sourceObj import xml.etree.ElementTree as ElementTree tree = ElementTree.parse(sourceObj).getroot() - ns = "http://xspf.org/ns/0/" + ns = u"http://xspf.org/ns/0/" sourceObj.close() # Loop thought earch Show element - for node in tree.getiterator("{%s}track" % ns): + for node in tree.getiterator(u"{%s}track" % ns): # Create listitem of Data item = localListitem() item.setAudioInfo() item.setQualityIcon(False) - item.setLabel(node.findtext("{%s}title" % ns).encode("utf-8")) - item.setThumbnailImage(node.findtext("{%s}image" % ns).encode("utf-8")) - item.setParamDict(url=node.findtext("{%s}location" % ns).encode("utf-8"), action="system.direct") + item.setLabel(node.findtext(u"{%s}title" % ns)) + item.setThumbnailImage(node.findtext(u"{%s}image" % ns)) + item.setParamDict(url=node.findtext(u"{%s}location" % ns), action="system.direct") # Add Date Info - date = node.findtext("{%s}creator" % ns).replace("\n"," ") - item.setDateInfo(date[date.rfind(" ")+1:], "%m/%d/%Y") + date = node.findtext(u"{%s}creator" % ns).replace(u"\n",u" ") + item.setDateInfo(date[date.rfind(u" ")+1:], "%m/%d/%Y") # Store Listitem data additem(item.getListitemTuple(isPlayable=True)) ----------------------------------------------------------------------- Summary of changes: plugin.video.enemy.territory/addon.py | 2 +- plugin.video.enemy.territory/addon.xml | 5 +- plugin.video.enemy.territory/changelog.txt | 5 +- plugin.video.enemy.territory/resources/lib/main.py | 16 ++-- plugin.video.engineeringtv/addon.py | 2 +- plugin.video.engineeringtv/addon.xml | 4 +- plugin.video.engineeringtv/changelog.txt | 10 ++- plugin.video.engineeringtv/resources/lib/main.py | 119 ++++++++++++++++---- plugin.video.johnlocker/addon.py | 2 +- plugin.video.johnlocker/addon.xml | 5 +- plugin.video.johnlocker/changelog.txt | 5 +- plugin.video.johnlocker/resources/lib/main.py | 48 +++----- plugin.video.metalvideo/addon.py | 2 +- plugin.video.metalvideo/addon.xml | 6 +- plugin.video.metalvideo/changelog.txt | 8 +- plugin.video.metalvideo/resources/lib/main.py | 97 ++++++++-------- plugin.video.quake.live/addon.py | 2 +- plugin.video.quake.live/addon.xml | 4 +- plugin.video.quake.live/changelog.txt | 6 +- plugin.video.quake.live/resources/lib/main.py | 23 ++-- plugin.video.watchmojo/addon.py | 2 +- plugin.video.watchmojo/addon.xml | 4 +- plugin.video.watchmojo/changelog.txt | 5 +- plugin.video.watchmojo/resources/lib/main.py | 36 +++--- plugin.video.watchmojo/resources/lib/parsers.py | 64 +++++----- 25 files changed, 286 insertions(+), 196 deletions(-) hooks/post-receive -- Plugins ------------------------------------------------------------------------------ Flow-based real-time traffic analytics software. Cisco certified tool. Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer Customize your own dashboards, set traffic alerts and generate reports. Network behavioral analysis & security monitoring. All-in-one tool. http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk _______________________________________________ Xbmc-addons mailing list Xbmc-addons@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xbmc-addons