The branch, frodo has been updated
       via  8c4418d3e32496f6df24d8e6dacf6010d72175a7 (commit)
      from  3e9439db69e6079707769153fedbf3c6ee02d9ab (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=8c4418d3e32496f6df24d8e6dacf6010d72175a7

commit 8c4418d3e32496f6df24d8e6dacf6010d72175a7
Author: beenje <[email protected]>
Date:   Fri May 17 19:20:18 2013 +0200

    [plugin.video.spiegelonline] updated to version 1.2.0

diff --git a/plugin.video.spiegelonline/addon.xml 
b/plugin.video.spiegelonline/addon.xml
index dd970c1..3c47693 100644
--- a/plugin.video.spiegelonline/addon.xml
+++ b/plugin.video.spiegelonline/addon.xml
@@ -1,16 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<addon id="plugin.video.spiegelonline" name="Spiegel Online" version="1.1" 
provider-name="mad-max (credits to peterpanzki for Dharma Version">
+<addon id="plugin.video.spiegelonline" name="Spiegel Online" version="1.2.0" 
provider-name="cdwertmann (credits to peterpanzki and mad-max for previous 
versions">
     <requires>
-        <import addon="xbmc.python" version="2.0"/>
+        <import addon="xbmc.python" version="2.1.0"/>
     </requires>
     <extension point="xbmc.python.pluginsource" library="default.py">
         <provides>video</provides>
     </extension>
     <extension point="xbmc.addon.metadata">
         <platform>all</platform>
+        <language>de</language>
         <summary lang="de">Spiegel Online</summary>
         <summary lang="en">Spiegel Online</summary>
         <description lang="de">Spiegel Online - Videos vom Spiegel Online 
Portal inkl. Spiegel TV Magazin</description>
-        <description lang="en">Spiegel Online</description>
+        <description lang="en">Spiegel Online - Videos in German 
language</description>
+        
<website>https://github.com/cdwertmann/plugin.video.spiegelonline</website>
+        
<source>git://github.com/cdwertmann/plugin.video.spiegelonline.git</source>
+        <license>GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007</license>
     </extension>
 </addon>
diff --git a/plugin.video.spiegelonline/default.py 
b/plugin.video.spiegelonline/default.py
index 8ae4d79..45c0355 100644
--- a/plugin.video.spiegelonline/default.py
+++ b/plugin.video.spiegelonline/default.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 # Copyright 2010 by peterpanzki
-import urllib,urllib2,re,time,xbmcplugin,xbmcgui,xbmcaddon
+import urllib,urllib2,re,time,xbmcplugin,xbmcgui,xbmcaddon,threading
 
 # plugin handle
 SITE = 
"http://www1.spiegel.de/active/playlist/fcgi/playlist.fcgi/asset=flashvideo/mode=list/displaycategory=";
@@ -9,6 +9,7 @@ VIDS_PER_SITE = "/count=" + str(VIDS) + "/"
 handle = int(sys.argv[1])
 __addon__        = xbmcaddon.Addon()
 __language__     = __addon__.getLocalizedString
+items = []
 
 def show_root_menu():
     addDirectoryItem(__addon__.getLocalizedString(30003), {"cat": 
"newsmitfragmenten", "site": 1})  
@@ -28,9 +29,23 @@ def show_cat_menu(cat, vnr):
     for m in match:
         parts = 
re.compile('<videoid>(.+?)</videoid><thema>(.+?)</thema><headline>(.+?)</headline><teaser>(.+?)</teaser>.+?<date>(.+?)</date><playtime>(.+?)</playtime><thumb>(.+?)</thumb>',re.DOTALL).findall(m)
         for vid,name,headline,teaser,date,playtime,pic in parts:
-            liStyle=xbmcgui.ListItem(name + " - " + headline, 
iconImage="default.png", thumbnailImage=pic)
-            liStyle.setInfo( type="Video", infoLabels={ "Title": name, 
"duration": playtime, "plotoutline": headline, "plot": teaser, "date": date})
-            addLinkItem("http://video.spiegel.de/flash/"; + getVideo(vid), 
liStyle)
+            name=convert_to_UTF8(name)
+            headline=convert_to_UTF8(headline)
+            teaser=convert_to_UTF8(teaser)
+            liStyle=xbmcgui.ListItem((name + " - " + headline), 
iconImage="default.png", thumbnailImage=pic)
+            liStyle.setInfo( type="Video", infoLabels={ "Title": name, 
"plotoutline": headline, "plot": teaser, "date": date})
+            liStyle.addStreamInfo('video', {'duration': getSeconds(playtime)})
+            items.append({'vid': vid, "li" :liStyle})
+    threads = []
+    for index,i in enumerate(items):
+      # pass the index to the thread function to preserve the original video 
order
+      thread = threading.Thread(target=setVideoURL, args=(i['vid'],index,))
+      thread.start()
+      threads.append(thread)
+    for t in threads:
+      t.join()
+    for i in items:
+      addLinkItem(i['url'],i['li'])
     content = getUrl(SITE + cat + VIDS_PER_SITE + "start=" + str(int(vnr) + 
VIDS))
     match = re.compile('<listitem>(.+?)</listitem>',re.DOTALL).findall(content)
     if len(match) > 0:
@@ -67,8 +82,11 @@ def addDirectoryItem(name, parameters={},pic=""):
     url = sys.argv[0] + '?' + urllib.urlencode(parameters)
     return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, 
listitem=li, isFolder=True)
 
-def addLinkItem(url,li):
-    return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, 
listitem=li, isFolder=False)
+def addLinkItem(url, li):
+    return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, 
listitem=li, isFolder=False, totalItems=len(items))
+
+def setVideoURL(vid, index):
+    items[index]['url']="http://video.spiegel.de/flash/"; + getVideo(vid)
 
 def getUrl(url):
     req = urllib2.Request(url)
@@ -77,6 +95,20 @@ def getUrl(url):
     response.close()
     return link
 
+def convert_to_UTF8(str):
+    return str.decode('iso-8859-1').encode('utf8')
+
+def getSeconds(playtime):
+    t = map(int, re.split(r"[:]", playtime))
+    if len(t)==1:
+      return t[0]
+    elif len(t)==2:
+      return t[0]*60+t[1]
+    elif len(t)==3:
+      return t[0]*3600+t[1]*60+t[2]
+    else:
+      return 0
+
 # parameter values
 params = parameters_string_to_dict(sys.argv[2])
 site = str(params.get("site", ""))

-----------------------------------------------------------------------

Summary of changes:
 plugin.video.spiegelonline/addon.xml  |   10 +++++--
 plugin.video.spiegelonline/default.py |   44 ++++++++++++++++++++++++++++----
 2 files changed, 45 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to