The branch, frodo has been updated
via 26d063f548519d0a52898fe3254e1c2c51f579b0 (commit)
via 7646cbef46c67e5f554b57f680db5956cf88f002 (commit)
from 6a7a13e00b6e83686bc93fdad765178942982c72 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=26d063f548519d0a52898fe3254e1c2c51f579b0
commit 26d063f548519d0a52898fe3254e1c2c51f579b0
Author: Martijn Kaijser <[email protected]>
Date: Sun Apr 21 21:15:02 2013 +0200
[plugin.video.gametrailerscom] 1.0.1
diff --git a/plugin.video.gametrailerscom/addon.py
b/plugin.video.gametrailerscom/addon.py
index f9fdca7..7b84965 100644
--- a/plugin.video.gametrailerscom/addon.py
+++ b/plugin.video.gametrailerscom/addon.py
@@ -199,16 +199,22 @@ def play_video(path):
video_xml = urllib2.urlopen(path).read().decode("utf-8", "ignore")
quality_setting = get_bool_setting("prefered_quality")
quality_i = -1
+ video_quality_list = list()
- if quality_setting == 0:
- video_quality_list = list()
+ if not common.parseDOM(html=video_xml, name="rendition"):
+ # Assume id in path is an info id
+ info_path =
path.replace("http://www.gametrailers.com/feeds/mediagen/?uri=",
"http://www.gametrailers.com/feeds/mrss?uri=")
+ info_xml = urllib2.urlopen(info_path).read().decode("utf-8", "ignore")
+ path = common.parseDOM(html=info_xml, name="media:content",
ret="url")[0]
+ video_xml = urllib2.urlopen(path).read().decode("utf-8", "ignore")
- for i in range(len(common.parseDOM(html=video_xml, name="rendition"))):
- height = common.parseDOM(html=video_xml, name="rendition",
ret="height")[i]
- width = common.parseDOM(html=video_xml, name="rendition",
ret="width")[i]
- title = "%sx%s" % (height, width)
- video_quality_list.append(title)
+ for i in range(len(common.parseDOM(html=video_xml, name="rendition"))):
+ height = common.parseDOM(html=video_xml, name="rendition",
ret="height")[i]
+ width = common.parseDOM(html=video_xml, name="rendition",
ret="width")[i]
+ title = "%sx%s" % (height, width)
+ video_quality_list.append(title)
+ if quality_setting == 0:
dialog = xbmcgui.Dialog()
quality_i = dialog.select(get_string(30002), video_quality_list)
@@ -216,7 +222,15 @@ def play_video(path):
quality_i = quality_setting - 1
if quality_i != -1:
- video = common.parseDOM(html=video_xml, name="src")[quality_i]
+ video_sources = common.parseDOM(html=video_xml, name="src")
+
+ if (len(video_sources) - 1) >= quality_i:
+ # Play prefered quality
+ video = video_sources[quality_i]
+ else:
+ # Play highest quality
+ print "[GameTrailers] Prefered quality not found. Playing highest
available."
+ video = video_sources[-1]
video = plugin.set_resolved_url(video)
diff --git a/plugin.video.gametrailerscom/addon.xml
b/plugin.video.gametrailerscom/addon.xml
index 6ffe117..a0bcedb 100644
--- a/plugin.video.gametrailerscom/addon.xml
+++ b/plugin.video.gametrailerscom/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<addon id="plugin.video.gametrailerscom" version="1.0.0"
name="GameTrailers.com" provider-name="David Gray (N3MIS15)">
+<addon id="plugin.video.gametrailerscom" version="1.0.1"
name="GameTrailers.com" provider-name="David Gray (N3MIS15)">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.xbmcswift2" version="2.4.0" />
@@ -17,7 +17,7 @@
<language>en</language>
<website></website>
<source>https://github.com/N3MIS15/plugin.video.gametrailerscom</source>
- <forum></forum>
+ <forum>http://forum.xbmc.org/showthread.php?tid=162908</forum>
<email>[email protected]</email>
</extension>
</addon>
diff --git a/plugin.video.gametrailerscom/changelog.txt
b/plugin.video.gametrailerscom/changelog.txt
index ed39b31..634a9eb 100644
--- a/plugin.video.gametrailerscom/changelog.txt
+++ b/plugin.video.gametrailerscom/changelog.txt
@@ -1,2 +1,7 @@
[B]Version 1.0.0[/B]
- Initial release.
+
+[B]Version 1.0.1[/B]
+- Check video uri before trying to play it.
+- If prefered quality does not exist, fallback to highest quality.
+- Added forum link to addon.xml
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=7646cbef46c67e5f554b57f680db5956cf88f002
commit 7646cbef46c67e5f554b57f680db5956cf88f002
Author: Martijn Kaijser <[email protected]>
Date: Sun Apr 21 21:13:39 2013 +0200
[plugin.video.n24_de] 2.0.8
diff --git a/plugin.video.n24_de/addon.xml b/plugin.video.n24_de/addon.xml
index 0c84056..6f5ccd9 100644
--- a/plugin.video.n24_de/addon.xml
+++ b/plugin.video.n24_de/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<addon id="plugin.video.n24_de" name="N24.de" version="2.0.7"
provider-name="AddonScriptorDE">
+<addon id="plugin.video.n24_de" name="N24.de" version="2.0.8"
provider-name="AddonScriptorDE">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
</requires>
diff --git a/plugin.video.n24_de/changelog.txt
b/plugin.video.n24_de/changelog.txt
index ceba4a2..c429bde 100644
--- a/plugin.video.n24_de/changelog.txt
+++ b/plugin.video.n24_de/changelog.txt
@@ -1,8 +1,18 @@
-1.0.0 - First Try
-1.0.1 - Changed addon.xml
-1.0.2 - Added <disclaimer> Tag to addon.xml
-1.0.3 - Changed Timeout
-1.0.4 - Fixed Livestream Problem
-1.0.5 - Changed Timeout again
-1.0.6 - Various fixes and optical optimizations
-1.0.7 - Fixed wrong localization string & Livestream problem
\ No newline at end of file
+1.0.0
+- Initial release
+1.0.1
+- Changed addon.xml
+1.0.2
+- Added <disclaimer> Tag to addon.xml
+1.0.3
+- Changed Timeout
+1.0.4
+- Fixed Livestream Problem
+1.0.5
+- Changed Timeout again
+1.0.6
+- Various fixes and optical optimizations
+1.0.7
+- Fixed wrong localization string & Livestream problem
+1.0.8 / 2.0.8
+- Fixed site changes
\ No newline at end of file
diff --git a/plugin.video.n24_de/default.py b/plugin.video.n24_de/default.py
index a9aa2e8..fec5efe 100644
--- a/plugin.video.n24_de/default.py
+++ b/plugin.video.n24_de/default.py
@@ -1,130 +1,143 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
-import urllib,urllib2,re,xbmcplugin,xbmcgui,sys,xbmcaddon
+import urllib
+import urllib2
+import socket
+import re
+import sys
+import xbmcplugin
+import xbmcaddon
+import xbmcgui
+socket.setdefaulttimeout(30)
pluginhandle = int(sys.argv[1])
-settings = xbmcaddon.Addon(id='plugin.video.n24_de')
-translation = settings.getLocalizedString
+addonId = 'plugin.video.n24_de'
+addon = xbmcaddon.Addon(id=addonId)
+translation = addon.getLocalizedString
+baseUrl = "http://www.n24.de"
+
def index():
- addDir(translation(30001),"most_clicked",1,"")
- addDir("Dokumentationen","doku",1,"")
- addDir("Reportagen","reportage",1,"")
- addDir("Magazine","magazin",1,"")
- addDir("Computer/Technik","computer",1,"")
- addDir("Wirtschaft/Börse","wirtschaft",1,"")
- addDir("History","history",1,"")
- addDir("Panorama","panorama",1,"")
- addDir("Politik","politik",1,"")
- addDir("Spezial","spezial",1,"")
- addDir("Service","service",1,"")
- addDir("Auto","auto",1,"")
- addDir("Talks","talk",1,"")
- addDir("N24 "+str(translation(30002)),"search",8,"")
- addLink("N24 Live Stream","live",9,"")
- xbmcplugin.endOfDirectory(pluginhandle)
-
-def catToUrl(cat):
-
listVideos("http://www.n24.de/mediathek/api/box_renderer/GenerateExtendedBox?dataset_name="+cat+"&page=1&limit=40")
-
-def listVideos(url1):
- content = getUrl(url1)
- match=re.compile('<a class="img_wrapper" href="(.+?)">\n
<img src="(.+?)" width="192" height="108" alt="(.+?)" />\n
<span class="play">abspielen</span>\n
<strong class="ellipsis">(.+?)</strong>\n
</a>', re.DOTALL).findall(content)
- for url,thumb,temp,title in match:
-
addLink(temp,"http://www.n24.de"+url,2,"http://www.n24.de/mediathek/"+thumb)
- match=re.compile('<span class="page_number">(.+?) von (.+?)</span>',
re.DOTALL).findall(content)
- currentPage=int(match[0][0])
- maxPage=int(match[0][1])
- if currentPage<maxPage:
-
urlNew=url1[:url1.find("&page=")]+"&page="+str(currentPage+1)+"&limit=40"
- addDir("Next Page",urlNew,7,'')
- xbmcplugin.endOfDirectory(pluginhandle)
+ addDir(translation(30001),
baseUrl+"/n24/Mediathek/videos/q?query=&hitsPerPage=50&pageNum=1&recent=0&docType=CMVideo&category=&from=&to=&taxonomy=&type=&sort=new",
'listVideos', "")
+ addDir(translation(30002),
baseUrl+"/n24/Mediathek/videos/q?query=&hitsPerPage=50&pageNum=1&recent=0&docType=CMVideo&category=&from=&to=&taxonomy=&type=888&sort=new",
'listVideos', "")
+ addDir(translation(30003),
baseUrl+"/n24/Mediathek/videos/q?query=&hitsPerPage=50&pageNum=1&recent=0&docType=CMVideo&category=&from=&to=&taxonomy=&type=6&sort=new",
'listVideos', "")
+ addDir(translation(30004),
baseUrl+"/n24/Mediathek/videos/q?query=&hitsPerPage=50&pageNum=1&recent=0&docType=CMVideo&category=&from=&to=&taxonomy=&type=32986&sort=new",
'listVideos', "")
+ addDir(translation(30008), "", 'search', "")
+ addLink(translation(30005), "http://www.n24.de/n24/Mediathek/Live/",
'playVideo', "")
+ xbmcplugin.endOfDirectory(pluginhandle)
+
+
+def listVideos(url):
+ urlMain = url
+ content = getUrl(url)
+ spl = content.split('<div class="content">')
+ for i in range(1, len(spl), 1):
+ entry = spl[i]
+ match = re.compile('src="(.+?)"', re.DOTALL).findall(entry)
+ thumb = match[0]
+ match = re.compile('<h4>.+?<a href="(.+?)">(.+?)</a>',
re.DOTALL).findall(entry)
+ url = baseUrl+match[0][0]
+ title = match[0][1]
+ title = cleanTitle(title)
+ addLink(title, url, 'playVideo', thumb)
+ match = re.compile('&pageNum=(.+?)&', re.DOTALL).findall(urlMain)
+ currentPage = match[0]
+ nextPage = str(int(currentPage)+1)
+ urlNew = urlMain.replace("&pageNum="+currentPage+"&",
"&pageNum="+nextPage+"&")
+ addDir(translation(30006), urlNew, "listVideos", '')
+ xbmcplugin.endOfDirectory(pluginhandle)
-def search():
- keyboard = xbmc.Keyboard('', 'Video Suche')
- keyboard.doModal()
- if keyboard.isConfirmed() and keyboard.getText():
- search_string = keyboard.getText()
-
listVideos("http://www.n24.de/mediathek/api/box_renderer/GenerateSearchResultsBox?search_string="+search_string+"&page=1&limit=40")
-
-def liveStream():
- try:
- playLiveStream()
- except:
-
xbmc.executebuiltin('XBMC.Notification(Info,'+str(translation(30003))+',5000)')
-
-def playLiveStream():
- listitem =
xbmcgui.ListItem(path="rtmp://pssimn24livefs.fplive.net/pssimn24live-live/n24live2011_01
swfUrl=http://www.n24.de/media/flash/homeplayer_swf.swf live=true timeout=60")
- return xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
def playVideo(url):
- content = getUrl(url)
- match=re.compile('filename":"(.+?)"',
re.DOTALL).findall(content)
- filename=match[0]
- listitem =
xbmcgui.ListItem(path="rtmp://pssimn24livefs.fplive.net/pssimn24/"+filename)
- return xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
+ content = getUrl(url)
+ matchBase = re.compile('videoFlashconnectionUrl = "(.+?)"',
re.DOTALL).findall(content)
+ matchPlaypath = re.compile('videoFlashSource = "(.+?)"',
re.DOTALL).findall(content)
+ if matchPlaypath:
+ if url == "http://www.n24.de/n24/Mediathek/Live/":
+ filename = matchBase[0] + " playpath="+matchPlaypath[0] + "
swfUrl=http://www.n24.de/_swf/HomePlayer.swf live=true timeout=60"
+ else:
+ filename = matchBase[0] + " playpath="+matchPlaypath[0] + "
swfUrl=http://www.n24.de/_swf/HomePlayer.swf"
+ listitem = xbmcgui.ListItem(path=filename)
+ xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
+ else:
+
xbmc.executebuiltin('XBMC.Notification(Info:,'+translation(30009).encode('utf-8')+',5000)')
+
+
+def queueVideo(url, name):
+ playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
+ listitem = xbmcgui.ListItem(name)
+ playlist.add(url, listitem)
+
+
+def search():
+ keyboard = xbmc.Keyboard('', translation(30008))
+ keyboard.doModal()
+ if keyboard.isConfirmed() and keyboard.getText():
+ search_string = keyboard.getText().replace(" ", "+")
+
listVideos(baseUrl+"/n24/Mediathek/videos/q?query="+search_string+"&hitsPerPage=50&pageNum=1&recent=0&docType=CMVideo&category=&from=&to=&taxonomy=&type=&sort=new")
+
+
+def cleanTitle(title):
+ title = title.replace("<", "<").replace(">", ">").replace("&",
"&").replace("&", "&").replace("'", "'")
+ title = title.replace("'", "'").replace("–",
"-").replace("“", "-").replace("”", "-").replace("’", "'")
+ title = title.replace(""", "\"").replace("ü",
"ü").replace("ä", "ä").replace("ö", "ö")
+ title = title.replace("Trailer", "").strip()
+ return title
+
def getUrl(url):
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; rv:11.0)
Gecko/20100101 Firefox/11.0')
- req.add_header('Referer', 'http://www.n24.de/')
- response = urllib2.urlopen(req,timeout=30)
- link=response.read()
- response.close()
- return link
+ req = urllib2.Request(url)
+ req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; rv:19.0)
Gecko/20100101 Firefox/19.0')
+ response = urllib2.urlopen(req)
+ link = response.read()
+ response.close()
+ return link
+
def parameters_string_to_dict(parameters):
- ''' Convert parameters encoded in a URL to a dict. '''
- paramDict = {}
- if parameters:
- paramPairs = parameters[1:].split("&")
- for paramsPair in paramPairs:
- paramSplits = paramsPair.split('=')
- if (len(paramSplits)) == 2:
- paramDict[paramSplits[0]] = paramSplits[1]
- return paramDict
-
-def addLink(name,url,mode,iconimage):
- u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)
- ok=True
- liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png",
thumbnailImage=iconimage)
- liz.setInfo( type="Video", infoLabels={ "Title": name } )
- liz.setProperty('IsPlayable', 'true')
-
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz)
- return ok
-
-def addDir(name,url,mode,iconimage):
- u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)
- ok=True
- liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png",
thumbnailImage=iconimage)
- liz.setInfo( type="Video", infoLabels={ "Title": name } )
-
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
- return ok
-
-params=parameters_string_to_dict(sys.argv[2])
-url=None
-mode=None
-
-try:
- url=urllib.unquote_plus(params["url"])
-except:
- pass
-try:
- mode=int(params["mode"])
-except:
- pass
-
-
-if mode==None or url==None or len(url)<1:
- index()
-
-elif mode==1:
- catToUrl(url)
-elif mode==2:
- playVideo(url)
-elif mode==7:
- listVideos(url)
-elif mode==8:
- search()
-elif mode==9:
- liveStream()
+ paramDict = {}
+ if parameters:
+ paramPairs = parameters[1:].split("&")
+ for paramsPair in paramPairs:
+ paramSplits = paramsPair.split('=')
+ if (len(paramSplits)) == 2:
+ paramDict[paramSplits[0]] = paramSplits[1]
+ return paramDict
+
+
+def addLink(name, url, mode, iconimage):
+ u =
sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+urllib.quote_plus(mode)+"&name="+urllib.quote_plus(name)
+ ok = True
+ liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png",
thumbnailImage=iconimage)
+ liz.setInfo(type="Video", infoLabels={"Title": name})
+ liz.setProperty('IsPlayable', 'true')
+ liz.addContextMenuItems([(translation(30007),
'RunPlugin(plugin://'+addonId+'/?mode=queueVideo&url='+urllib.quote_plus(u)+'&name='+urllib.quote_plus(name)+')',)])
+ ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u,
listitem=liz)
+ return ok
+
+
+def addDir(name, url, mode, iconimage):
+ u =
sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+urllib.quote_plus(mode)
+ ok = True
+ liz = xbmcgui.ListItem(name, iconImage="DefaultFolder.png",
thumbnailImage=iconimage)
+ liz.setInfo(type="Video", infoLabels={"Title": name})
+ ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u,
listitem=liz, isFolder=True)
+ return ok
+
+params = parameters_string_to_dict(sys.argv[2])
+mode = urllib.unquote_plus(params.get('mode', ''))
+url = urllib.unquote_plus(params.get('url', ''))
+name = urllib.unquote_plus(params.get('name', ''))
+
+if mode == 'listVideos':
+ listVideos(url)
+elif mode == 'playVideo':
+ playVideo(url)
+elif mode == 'playLiveStream':
+ playLiveStream(url)
+elif mode == 'queueVideo':
+ queueVideo(url, name)
+elif mode == 'search':
+ search()
+else:
+ index()
diff --git a/plugin.video.n24_de/resources/language/English/strings.xml
b/plugin.video.n24_de/resources/language/English/strings.xml
index aedffdc..b303161 100644
--- a/plugin.video.n24_de/resources/language/English/strings.xml
+++ b/plugin.video.n24_de/resources/language/English/strings.xml
@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
- <string id="30001">Most Viewed</string>
- <string id="30002">Video Search</string>
- <string id="30003">Livestream could not be played</string>
+ <string id="30001">All Videos</string>
+ <string id="30002">Documentaries</string>
+ <string id="30003">News</string>
+ <string id="30004">Shows</string>
+ <string id="30005">Live</string>
+ <string id="30006">Next Page</string>
+ <string id="30007">Add to queue</string>
+ <string id="30008">Search</string>
+ <string id="30009">Video is not available right now!</string>
</strings>
diff --git a/plugin.video.n24_de/resources/language/German/strings.xml
b/plugin.video.n24_de/resources/language/German/strings.xml
index 7fbce21..007d950 100644
--- a/plugin.video.n24_de/resources/language/German/strings.xml
+++ b/plugin.video.n24_de/resources/language/German/strings.xml
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
- <string id="30001">Meistgesehen</string>
- <string id="30002">Videosuche</string>
- <string id="30003">Livestream konnte nicht wiedergegeben werden</string>
+ <string id="30001">Alle Videos</string>
+ <string id="30002">Dokumentationen</string>
+ <string id="30003">Nachrichten</string>
+ <string id="30004">Sendungen</string>
+ <string id="30006">Nächste Seite</string>
+ <string id="30007">Zu Wiedergabeliste hinzufügen</string>
+ <string id="30008">Suchen</string>
+ <string id="30009">Dieses Video ist aktuell nicht verfügbar!</string>
</strings>
-----------------------------------------------------------------------
Summary of changes:
plugin.video.gametrailerscom/addon.py | 30 ++-
plugin.video.gametrailerscom/addon.xml | 4 +-
plugin.video.gametrailerscom/changelog.txt | 5 +
plugin.video.n24_de/addon.xml | 2 +-
plugin.video.n24_de/changelog.txt | 26 ++-
plugin.video.n24_de/default.py | 247 ++++++++++---------
.../resources/language/English/strings.xml | 12 +-
.../resources/language/German/strings.xml | 11 +-
8 files changed, 195 insertions(+), 142 deletions(-)
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons