The branch, frodo has been updated
       via  0fa877897ee71d99183095a586a56a7afcaa19ef (commit)
       via  7f89d7cc3300d83bb73e0a362c1cc7ef3626060f (commit)
      from  5ec33e57fb0bec2cd7c53d3e7b359ac7eeed2d93 (commit)

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

commit 0fa877897ee71d99183095a586a56a7afcaa19ef
Author: beenje <[email protected]>
Date:   Sun Feb 3 21:58:36 2013 +0100

    [plugin.video.svtplay] updated to version 3.1.4

diff --git a/plugin.video.svtplay/README.md b/plugin.video.svtplay/README.md
index f73e590..1311f80 100644
--- a/plugin.video.svtplay/README.md
+++ b/plugin.video.svtplay/README.md
@@ -1,15 +1,22 @@
-XBMC SVT Play addon
-===================
+#XBMC SVT Play addon
 
 With this addon you can stream content from SVT Play (svtplay.se).
+The plugin fetches the video URL from the SVT Play website and feeds it to the 
XBMC video player. HLS (m3u8) is the preferred video format by the plugin.
 
 It requires XBMC 12.0 (frodo) to function.
 
-The plugin fetches the video URL from the SVT Play website and feeds it to the 
XBMC video player. HLS (m3u8) is the preferred video format by the plugin.
+**Created by nilzen.**
+
+## Explaination of options
 
-Created by nilzen.
+* (General) Show subtitles
+  * Force programs to start with subtitles enabled. Subtitles can till be 
toggled on/off by using XBMC's controller shortcuts.
+* (General) Show both clips and episodes for programs
+  * By default the addon only displays episodes of a program. If this option 
is enable, the addon will show one section with episodes and one with clips (if 
available) for the program. If this setting is not enabled clips can only be 
found by using the search feature.
+* (Advanced) Don't use avc1.77.30 streams
+  * Forces the addon to choose the stream that supports the highest bandwidth 
but does not use the avc1.77.30 profile.
 
-Known issues:
+##Known issues:
 
-* Video playback may stutter on Apple TV2 due to the use of the h264 profile 
avc1.77.30
-  * Use the advanced plugin option "Don't use avc1.77.30 streams" to 
workaround this issue. Note that HD video is not supported on Apple TV 2 
anymore due to changes by SVT.
+* Video playback may stutter on Apple TV2  and Raspberry Pi due to the use of 
the h264 profile avc1.77.30
+  * Use the advanced plugin option "Don't use avc1.77.30 streams" to 
workaround this issue. This will force SD content only. Note that HD video is 
not supported on Apple TV 2 anymore due to changes by SVT.
diff --git a/plugin.video.svtplay/addon.xml b/plugin.video.svtplay/addon.xml
index d1d46a3..aed42c1 100644
--- a/plugin.video.svtplay/addon.xml
+++ b/plugin.video.svtplay/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="plugin.video.svtplay"
        name="SVT Play"
-       version="3.1.3"
+       version="3.1.4"
        provider-name="nilzen">
   <requires>
     <import addon="script.module.parsedom" version="1.2.0"/>
diff --git a/plugin.video.svtplay/changelog.txt 
b/plugin.video.svtplay/changelog.txt
index f89da98..842481a 100644
--- a/plugin.video.svtplay/changelog.txt
+++ b/plugin.video.svtplay/changelog.txt
@@ -1,3 +1,9 @@
+Version 3.1.4
+-------------
+- Fixed playback for live programs (linqcan)
+- Integrated BestOfSvt.se (linqcan)
+- Added new option to group clips and episodes for a program (linqcan)
+
 Version 3.1.3
 -------------
 - Added handling of programs with multiple MP4 streams (linqcan)
diff --git a/plugin.video.svtplay/default.py b/plugin.video.svtplay/default.py
index 451f75c..f0ff08c 100644
--- a/plugin.video.svtplay/default.py
+++ b/plugin.video.svtplay/default.py
@@ -9,6 +9,7 @@ import xbmcaddon
 import xbmcplugin
 import CommonFunctions
 import os
+import resources.lib.bestofsvt as bestof
 
 MODE_A_TO_O = "a-o"
 MODE_PROGRAM = "pr"
@@ -21,9 +22,11 @@ MODE_CATEGORY = "ti"
 MODE_LETTER = "letter"
 MODE_RECOMMENDED = "rp"
 MODE_SEARCH = "search"
-MODE_SEARCH_TITLES = "search_titles"
-MODE_SEARCH_EPISODES = "search_episodes"
-MODE_SEARCH_CLIPS = "search_clips"
+MODE_BESTOF_CATEGORIES = "bestofcategories"
+MODE_BESTOF_CATEGORY = "bestofcategory"
+MODE_VIEW_TITLES = "view_titles"
+MODE_VIEW_EPISODES = "view_episodes"
+MODE_VIEW_CLIPS = "view_clips"
 
 BASE_URL = "http://www.svtplay.se";
 SWF_URL = "http://www.svtplay.se/public/swf/video/svtplayer-2012.51.swf"; 
@@ -38,6 +41,12 @@ URL_TO_SEARCH = "/sok?q="
 VIDEO_PATH_RE = "/(klipp|video|live)/\d+"
 VIDEO_PATH_SUFFIX = "?type=embed"
 
+TAB_TITLES      = "titles"
+TAB_EPISODES    = "episodes"
+TAB_CLIPS       = "clips"
+TAB_NEWS        = "news"
+TAB_RECOMMENDED = "recommended"
+
 MAX_NUM_GRID_ITEMS = 12
 CURR_DIR_ITEMS = 0
 
@@ -49,18 +58,34 @@ localize = settings.getLocalizedString
 common = CommonFunctions
 common.plugin = "SVT Play 3"
 
+# Get and set settings
+common.dbg = False
 if settings.getSetting('debug') == "true":
   common.dbg = True
-else:
-  common.dbg = False
 
+HLS_STRIP = False
 if settings.getSetting("hlsstrip") == "true":
     HLS_STRIP = True
-else:
-    HLS_STRIP = False
+
+FULL_PROGRAM_PARSE = False
+if settings.getSetting("fullparse") == "true":
+  FULL_PROGRAM_PARSE = True
+
+HIDE_SIGN_LANGUAGE = False
+if settings.getSetting("hidesignlanguage") == "true":
+  HIDE_SIGN_LANGUAGE = True
+
+SHOW_SUBTITLES = False
+if settings.getSetting("showsubtitles") == "true":
+  SHOW_SUBTITLES = True
+
+USE_ALPHA_CATEGORIES = False
+if settings.getSetting("alpha") == "true":
+  USE_ALPHA_CATEGORIES = True
 
 MAX_DIR_ITEMS = int(float(settings.getSetting("diritems")))
 
+
 def viewStart():
 
   addDirectoryItem(localize(30000), { "mode": MODE_A_TO_O })
@@ -70,6 +95,8 @@ def viewStart():
   addDirectoryItem(localize(30003), { "mode": MODE_LATEST, "page": 1 })
   addDirectoryItem(localize(30004), { "mode": MODE_LATEST_NEWS, "page": 1 })
   addDirectoryItem(localize(30006), { "mode": MODE_SEARCH })
+  addDirectoryItem(localize(30007), { "mode": MODE_BESTOF_CATEGORIES })
+
 
 
 def viewAtoO():
@@ -185,11 +212,17 @@ def viewCategory(url,page,index):
   createDirectory(url,page,index,MODE_CATEGORY,MODE_PROGRAM)
 
 def viewProgram(url,page,index):
-  createDirectory(url,page,index,MODE_PROGRAM,MODE_VIDEO)
+  if FULL_PROGRAM_PARSE:
+    createTabIndex(url)
+  else:
+    createDirectory(url,page,index,MODE_PROGRAM,MODE_VIDEO)
 
 def viewSearch():
 
   keyword = common.getUserInput(localize(30102))
+  if not keyword:
+    viewStart()
+    return
   keyword = urllib.quote(keyword)
   common.log("Search string: " + keyword)
 
@@ -200,51 +233,54 @@ def viewSearch():
   keyword = re.sub(r" ","+",keyword) 
 
   url = URL_TO_SEARCH + keyword
+  
+  createTabIndex(url)
+
+def createTabIndex(url):
+  """
+  Creates a directory item for each available tab; Klipp, Hela program, 
Programtitlar
+  """
   html = getPage(BASE_URL + url)
   foundTab = False
  
-  # Try fetching the "titles" tab. If it exists; create link to result 
directory   
-  try:
-    common.parseDOM(html, "div", attrs = { "data-tabname": "titles" })[0]
-    foundTab = True
-  except:
-    # Do nothing
-    common.log("No titles found")
-  else:
+  # Search for the "titles" tab. If it exists; create link to result directory 
  
+  foundTab = tabExists(url,TAB_TITLES)
+  if foundTab:
     addDirectoryItem(localize(30104), { 
-                    "mode": MODE_SEARCH_TITLES,
+                    "mode": MODE_VIEW_TITLES,
                     "url": url,
                     "page": 1,
                     "index": 0 })
-
-  # Try fetching the "episodes" tab. If it exists; create link to result 
directory   
-  try:
-    common.parseDOM(html, "div", attrs = { "data-tabname": "episodes" })[0]
-    foundTab = True
-  except:
-    # Do nothing
-    common.log("No episodes found")
   else:
+    # Do nothing
+    common.log("No titles found")
+
+
+  # Search for the "episodes" tab. If it exists; create link to result 
directory   
+  foundTab = tabExists(url,TAB_EPISODES)
+  if foundTab:
     addDirectoryItem(localize(30105), { 
-                    "mode": MODE_SEARCH_EPISODES,
+                    "mode": MODE_VIEW_EPISODES,
                     "url": url,
                     "page": 1,
                     "index": 0 })
-
-  # Try fetching the "clips" tab. If it exists; create link to result 
directory   
-  try:
-    common.parseDOM(html, "div", attrs = { "data-tabname": "clips" })[0]
-    foundTab = True
-  except:
-    # Do nothing 
-    common.log("No clips found")
   else:
+    # Do nothing
+    common.log("No episodes found")
+
+
+  # Search for the "clips" tab. If it exists; create link to result directory  
 
+  foundTab = tabExists(url,TAB_CLIPS)
+  if foundTab:
     addDirectoryItem(localize(30106), { 
-                    "mode": MODE_SEARCH_CLIPS,
+                    "mode": MODE_VIEW_CLIPS,
                     "url": url,
                     "page": 1,
                     "index": 0 })
- 
+  else:
+    # Do nothing 
+    common.log("No clips found")
+
   if not foundTab:
     # Raise dialog with a "No results found" message
     common.log("No search result") 
@@ -253,7 +289,26 @@ def viewSearch():
     viewSearch()
     return
 
-def viewSearchResults(url,mode,page,index):
+def tabExists(url,tabname):
+  """
+  Check if a specific tab exists in the DOM.
+  """
+  html = getPage(BASE_URL + url)
+  return elementExists(html,"div",{ "data-tabname": tabname})
+
+def elementExists(html,etype,attrs):
+  """
+  Check if a specific element exists in the DOM.
+
+  Returns True if the element exists and False if not.
+  """
+
+  htmlelement = common.parseDOM(html,etype, attrs = attrs)
+
+  return len(htmlelement) > 0
+
+
+def viewPageResults(url,mode,page,index):
   """
   Creates a directory for the search results from
   the tab specified by the mode parameter.
@@ -261,11 +316,11 @@ def viewSearchResults(url,mode,page,index):
   common.log("url: " + url + " mode: " + mode)
   dirtype = None
 
-  if MODE_SEARCH_TITLES == mode:
+  if MODE_VIEW_TITLES == mode:
     dirtype = MODE_PROGRAM
-  elif MODE_SEARCH_EPISODES == mode:
+  elif MODE_VIEW_EPISODES == mode:
     dirtype = MODE_VIDEO
-  elif MODE_SEARCH_CLIPS == mode:
+  elif MODE_VIEW_CLIPS == mode:
     dirtype = MODE_VIDEO
   else:
     common.log("Undefined mode")
@@ -274,6 +329,32 @@ def viewSearchResults(url,mode,page,index):
 
   createDirectory(url,page,index,mode,dirtype)
 
+def viewBestOfCategories():
+  """
+  Creates a directory displaying each of the
+  categories from the bestofsvt page
+  """
+  categories = bestof.getCategories()
+  params = {}
+  params["mode"] = MODE_BESTOF_CATEGORY
+
+  for category in categories:
+    params["url"] = category["url"]
+    addDirectoryItem(category["title"], params)
+
+def viewBestOfCategory(url):
+  """
+  Creates a directory containing all shows displayed
+  for a category
+  """
+  shows = bestof.getShows(url)
+  params = {}
+  params["mode"] = MODE_VIDEO
+
+  for show in shows:
+    params["url"] = show["url"] + VIDEO_PATH_SUFFIX
+    addDirectoryItem(show["title"], params, show["thumbnail"], False)
+
 def createDirectory(url,page,index,callertype,dirtype):
   """
   Parses Ajax URL and last page number from the argument url and
@@ -284,15 +365,21 @@ def createDirectory(url,page,index,callertype,dirtype):
   if not url.startswith("/"):
     url = "/" + url
 
-  tabname = "episodes"
+  tabname = TAB_EPISODES
   if MODE_RECOMMENDED == callertype:
-    tabname = "recommended"
+    tabname = TAB_RECOMMENDED
   elif MODE_LATEST_NEWS == callertype:
-    tabname = "news"
-  elif MODE_SEARCH_CLIPS == callertype:
-    tabname = "clips"
-  elif MODE_CATEGORY == callertype or MODE_SEARCH_TITLES == callertype:
-    tabname = "titles"
+    tabname = TAB_NEWS
+  elif MODE_VIEW_CLIPS == callertype:
+    tabname = TAB_CLIPS
+  elif MODE_CATEGORY == callertype or MODE_VIEW_TITLES == callertype:
+    tabname = TAB_TITLES
+
+  if not tabExists(url,tabname) and tabname == TAB_EPISODES:
+    tabname = TAB_CLIPS # In case there are no episodes for a show, get the 
clips instead
+  elif not tabExists(url,tabname):
+    common.log("Could not find tab "+tabname+" on page. Aborting!")
+    return 
 
   (foundUrl,ajaxurl,lastpage) = parseAjaxUrlAndLastPage(url,tabname)
 
@@ -338,12 +425,15 @@ def parseAjaxUrlAndLastPage(url,tabname):
   container = common.parseDOM(html,
                               "div",
                               attrs = { "class": 
"[^\"']*[playBoxBody|playBoxAltBody][^\"']*", "data-tabname": tabname })[0]
-  try:
+
+  attrs = { "class": classexp, "data-name": dataname}
+  
+  if elementExists(container,"a", attrs):
     ajaxurl = common.parseDOM(container,
-                                "a",
-                                attrs = { "class": classexp, "data-name": 
dataname },
-                                ret = "data-baseurl")[0]
-  except:
+                              "a",
+                              attrs = attrs,
+                              ret = "data-baseurl")[0]
+  else:
     return (False,"","")
 
   lastpage = common.parseDOM(container,
@@ -405,8 +495,7 @@ def createDirItem(article,mode):
 
   (title,url,thumbnail,info) = article
 
-  if settings.getSetting("hidesignlanguage") == "false" or \
-     title.lower().endswith("teckentolkad") == False:
+  if (not HIDE_SIGN_LANGUAGE) or title.lower().endswith("teckentolkad") == 
False:
 
     params = {}
     params["mode"] = mode
@@ -513,6 +602,7 @@ def startVideo(url):
   if not url.startswith("/"):
     url = "/" + url
 
+  common.log("url: " + url)
   html = getPage(BASE_URL + url)
 
   jsonString = common.parseDOM(html, "param", attrs = { "name": "flashvars" }, 
ret = "value")[0]
@@ -529,6 +619,7 @@ def startVideo(url):
   startTime = time.time()
   videoUrl = None
   extension = "None"
+  args = ""
 
   for video in jsonObj["video"]["videoReferences"]:
     """
@@ -536,23 +627,29 @@ def startVideo(url):
     m3u8 is preferred, hence the break.
     Order: m3u8, f4m, mp4, flv
     """
-    if video["url"].endswith(".m3u8"):
+    tmpurl = video["url"]
+    argpos = tmpurl.rfind("?")
+    if argpos > 0:
+      args = tmpurl[argpos:]
+      tmpurl = tmpurl[:argpos]
+
+    if tmpurl.endswith(".m3u8"):
       extension = "HLS"
-      videoUrl = video["url"]
+      videoUrl = tmpurl
       break
-    if video["url"].endswith(".f4m"):
+    if tmpurl.endswith(".f4m"):
       extension = "F4M"
-      videoUrl = video["url"]
+      videoUrl = tmpurl
       continue
-    if video["url"].endswith(".mp4"):
+    if tmpurl.endswith(".mp4"):
       extension = "MP4"
-      videoUrl = video["url"]
+      videoUrl = tmpurl
       continue
-    if video["url"].endswith(".flv"):
+    if tmpurl.endswith(".flv"):
       extension = "FLV"
-      videoUrl = video["url"]
+      videoUrl = tmpurl
       continue
-    videoUrl = video["url"]
+    videoUrl = tmpurl
 
   for sub in jsonObj["video"]["subtitleReferences"]:
     if sub["url"].endswith(".wsrt"):
@@ -570,12 +667,16 @@ def startVideo(url):
   if extension == "MP4":
     videoUrl = mp4Handler(jsonObj)
 
-  if extension == "None":
+  if extension == "None" and videoUrl:
     # No supported video was found
     common.log("No supported video extension found for URL: " + videoUrl)
     videoUrl = None
 
   if videoUrl:
+    
+    if args:
+      common.log("Appending arguments: "+args)
+      videoUrl = videoUrl + args
 
     if extension == "MP4" and videoUrl.startswith("rtmp://"):
       videoUrl = videoUrl + " swfUrl="+SWF_URL+" swfVfy=1"
@@ -589,7 +690,7 @@ def startVideo(url):
 
       player.setSubtitles(subtitle)
 
-      if settings.getSetting("showsubtitles") == "false":
+      if not SHOW_SUBTITLES:
         player.showSubtitles(False)
   else:
     dialog = xbmcgui.Dialog()
@@ -751,7 +852,7 @@ if not index:
 if not mode:
   viewStart()
 elif mode == MODE_A_TO_O:
-  if settings.getSetting("alpha") == "true":
+  if USE_ALPHA_CATEGORIES:
     viewAlphaDirectories()
   else:
     viewAtoO()
@@ -775,9 +876,13 @@ elif mode == MODE_RECOMMENDED:
   viewLatest(mode,page,index)
 elif mode == MODE_SEARCH:
   viewSearch()
-elif mode == MODE_SEARCH_TITLES or \
-     mode == MODE_SEARCH_EPISODES or \
-     mode == MODE_SEARCH_CLIPS:
-  viewSearchResults(url,mode,page,index)
+elif mode == MODE_VIEW_TITLES or \
+     mode == MODE_VIEW_EPISODES or \
+     mode == MODE_VIEW_CLIPS:
+  viewPageResults(url,mode,page,index)
+elif mode == MODE_BESTOF_CATEGORIES:
+  viewBestOfCategories()
+elif mode == MODE_BESTOF_CATEGORY:
+  viewBestOfCategory(url)
 
 xbmcplugin.endOfDirectory(pluginHandle)
diff --git a/plugin.video.svtplay/resources/language/English/strings.xml 
b/plugin.video.svtplay/resources/language/English/strings.xml
index 8ccce3d..1547aae 100644
--- a/plugin.video.svtplay/resources/language/English/strings.xml
+++ b/plugin.video.svtplay/resources/language/English/strings.xml
@@ -7,6 +7,7 @@
   <string id="30004">Latest news broadcast</string>
   <string id="30005">Recommended</string>
   <string id="30006">Search</string>
+  <string id="30007">BestOfSVT.se</string>
   <string id="30100">This program is only available at www.svtplay.se</string>
   <string id="30101">Show more...</string>
   <string id="30102">Search for:</string>
@@ -20,6 +21,7 @@
   <string id="30503">Number of programs per page</string>
   <string id="30504">Hide sign language interpreted programs</string>
   <string id="30505">Don't use avc1.77.30 streams</string>
+  <string id="30506">Show both clips and episodes for programs</string>
   <string id="40001">General</string>
   <string id="40002">Advanced</string>
 </strings>
diff --git a/plugin.video.svtplay/resources/language/Swedish/strings.xml 
b/plugin.video.svtplay/resources/language/Swedish/strings.xml
index 82773f5..ab0843b 100644
--- a/plugin.video.svtplay/resources/language/Swedish/strings.xml
+++ b/plugin.video.svtplay/resources/language/Swedish/strings.xml
@@ -7,6 +7,7 @@
   <string id="30004">Senaste nyhetsprogram</string>
   <string id="30005">Rekommenderat</string>
   <string id="30006">Sök</string>
+  <string id="30007">BestOfSVT.se</string>
   <string id="30100">Detta program är endast tillgängligt på 
www.svtplay.se</string>
   <string id="30101">Visa fler...</string>
   <string id="30102">Sök efter:</string>
@@ -20,6 +21,7 @@
   <string id="30503">Antal program per sida</string>
   <string id="30504">Dölj teckentolkade program</string>
   <string id="30505">Använd inte avc1.77.30 videoströmmar</string>
+  <string id="30506">Visa både klipp och avsnitt för program</string>
   <string id="40001">Allmänt</string>
   <string id="40002">Avancerat</string>
 </strings>
diff --git a/plugin.video.svtplay/resources/settings.xml 
b/plugin.video.svtplay/resources/settings.xml
index f41aa0c..02a8e24 100644
--- a/plugin.video.svtplay/resources/settings.xml
+++ b/plugin.video.svtplay/resources/settings.xml
@@ -3,6 +3,7 @@
   <category label="40001">
     <setting id="diritems" type="slider" label="30503" default="20" 
range="20,10,100" option="int" />
     <setting id="alpha" type="bool" label="30502" default="false" />
+    <setting id="fullparse" type="bool" label="30506" default="false" />
     <setting id="hidesignlanguage" type="bool" label="30504" default="false" />
     <setting id="showsubtitles" type="bool" label="30501" default="false" />
     <setting id="debug" type="bool" label="30500" default="false" />

http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=7f89d7cc3300d83bb73e0a362c1cc7ef3626060f

commit 7f89d7cc3300d83bb73e0a362c1cc7ef3626060f
Author: beenje <[email protected]>
Date:   Sun Feb 3 21:58:34 2013 +0100

    [plugin.video.nolife] updated to version 2.16.1

diff --git a/plugin.video.nolife/addon.xml b/plugin.video.nolife/addon.xml
index 6702b85..142fb6e 100644
--- a/plugin.video.nolife/addon.xml
+++ b/plugin.video.nolife/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="plugin.video.nolife"
        name="Nolife Online"
-       version="2.15.1"
+       version="2.16.1"
        provider-name="gormux">
   <requires>
     <import addon="xbmc.python" version="2.1.0"/>
diff --git a/plugin.video.nolife/default.py b/plugin.video.nolife/default.py
index b85d548..9455d2f 100644
--- a/plugin.video.nolife/default.py
+++ b/plugin.video.nolife/default.py
@@ -17,9 +17,10 @@ Nolife Online addon for XBMC
 Authors:     gormux, DeusP
 """
 
-import os, re, xbmcplugin, xbmcgui, xbmcaddon, urllib, urllib2, sys, 
cookielib, pickle
+import os, re, xbmcplugin, xbmcgui, xbmcaddon, urllib, urllib2, sys, 
cookielib, pickle, datetime
 from BeautifulSoup import BeautifulSoup
 
+
 """
 Class used as a C-struct to store video informations
 """
@@ -52,6 +53,12 @@ language = settings.getLocalizedString
 subscription = FREE
 fanartimage = os.path.join(settings.getAddonInfo("path"), "fanart.jpg")
 
+"""
+Data directory for cookie saving
+"""
+data_dir = xbmc.translatePath(settings.getAddonInfo('profile'))
+cookie_file = os.path.join(settings.getAddonInfo('path'), 'cookies')
+
 def remove_html_tags(data):
     """Permits to remove all HTML tags
         
@@ -122,6 +129,7 @@ def login():
     This method log the user into the website, checks credentials and return 
the current
     """
     
+    xbmc.log(msg=pluginLogHeader + "Logging in",level=xbmc.LOGDEBUG)
     settings = xbmcaddon.Addon(id='plugin.video.nolife')
     user     = settings.getSetting( "username" )
     pwd      = settings.getSetting( "password" )
@@ -133,7 +141,6 @@ def login():
                                 'vb_login_md5password': '',
                                 'vb_login_md5password_utf': ''})
     
-
     requestHandler.addheaders = [("User-agent", useragent)]
     page = requestHandler.open("http://forum.nolife-tv.com/login.php";, 
loginrequest)
     res = BeautifulSoup(page.read())
@@ -141,14 +148,17 @@ def login():
         xbmc.log(msg=pluginLogHeader + "Invalid username, 
aborting",level=xbmc.LOGFATAL)
         err = xbmcgui.Dialog()
         err.ok(unicode(language(35002)), unicode(language(34001)), 
unicode(language(34002)))
+        settings.setSetting('loginok', "")
         raise loginExpcetion()
     elif re.compile('votre quota').findall(str(res)):
         xbmc.log(msg=pluginLogHeader + "User account 
locked",level=xbmc.LOGSEVERE)
         err = xbmcgui.Dialog()
         err.ok(unicode(language(35001)), unicode(language(34003)), 
unicode(language(34004)), unicode(language(34005)))
+        settings.setSetting('loginok', "")
         raise loginExpcetion()
     else:
         xbmc.log(msg=pluginLogHeader + "Valid User",level=xbmc.LOGDEBUG)
+        settings.setSetting('loginok', "ok")
 
 def initialIndex():
     """Creates initial index
@@ -165,23 +175,30 @@ def getlastVideos():
     Get the videos in the "last videos" menu option
     """
     showseen   = settings.getSetting( "showseen" )
-    postrequest = urllib.urlencode({'emissions': 0,
+    i = 0
+    finished = False
+    while finished == False:
+        postrequest = urllib.urlencode({'emissions': i,
                                    'famille': 0,
                                    'a': 'ge'})
     
-    page = requestHandler.open("http://mobile.nolife-tv.com/do.php";, 
postrequest)
-    liste = BeautifulSoup(page.read()).findAll('li')
-    for element in liste:
-        extractVideoInfo(element)
+        page = requestHandler.open("http://mobile.nolife-tv.com/do.php";, 
postrequest)
+        liste = BeautifulSoup(page.read()).findAll('li')
+        for element in liste:
+            if == len(emissions) == 30:
+                finished = True
+                break
+
+            extractVideoInfo(element)
         
-        videoInfo = extractVideoInfo(element)
-        if (showseen == "true" or (showseen == "false" and videoInfo.seen == 
False)):
-            if isAvailableForUser(videoInfo.availability):
-                addlink( videoInfo.name + " - " + videoInfo.desc,
-                    "plugin://plugin.video.nolife?id=" + videoInfo.vid,
-                    videoInfo.thumb,
-                    videoInfo.duration,
-                    videoInfo.seen )
+            videoInfo = extractVideoInfo(element)
+            if (showseen == "true" or (showseen == "false" and videoInfo.seen 
== False)):
+                if isAvailableForUser(videoInfo.availability):
+                    addlink( videoInfo.name + " - " + videoInfo.desc,
+                        "plugin://plugin.video.nolife?id=" + videoInfo.vid,
+                        videoInfo.thumb,
+                        videoInfo.duration,
+                        videoInfo.seen )
     
 def getcategories():
     """Gets all categories and adds directories
@@ -356,7 +373,7 @@ def playvideo(requestHandler, video):
                                    thumbnailImage='', 
                                    path=url )
 
-    xbmcplugin.setResolvedUrl(0, True, listitem)
+    xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
 
 def get_params():
     """
@@ -523,6 +540,35 @@ def extractVideoSearchInfo(element):
 
     return info
 
+def createCookie():
+    """
+    Create a cookie.
+    If an older cookie exists its removed before the creation of the new cookie
+    """
+    xbmc.log(msg=pluginLogHeader + "Creation of new 
cookie",level=xbmc.LOGDEBUG)
+    settings.setSetting('loginok', "")
+    if os.path.isfile(cookie_file):
+        os.remove(cookie_file)
+    cj = cookielib.LWPCookieJar()
+    return cj
+    
+
+def loadCookie():
+    """
+    Load a cookie file
+    """
+    xbmc.log(msg=pluginLogHeader + "Loading cookie",level=xbmc.LOGDEBUG)
+    cj = cookielib.LWPCookieJar()
+    cj.load(filename=cookie_file, ignore_discard=True)
+    return cj
+    
+def saveCookie():
+    """
+    Save cookieJar to cookie file
+    """
+    xbmc.log(msg=pluginLogHeader + "Saving cookie",level=xbmc.LOGDEBUG)
+    cj.save(filename=cookie_file, ignore_discard=True)
+
 ## Start of the add-on
 xbmc.log(msg=pluginLogHeader + "-----------------------",level=xbmc.LOGDEBUG)
 xbmc.log(msg=pluginLogHeader + "Nolife plugin main loop",level=xbmc.LOGDEBUG)
@@ -532,7 +578,6 @@ pluginHandle = int(sys.argv[1])
 params = get_params()
 xbmc.log(msg=pluginLogHeader + "Parameters read",level=xbmc.LOGDEBUG)
 
-
 try:
     url = urllib.unquote_plus(params["url"])
 except:
@@ -551,18 +596,31 @@ xbmc.log(msg=pluginLogHeader + "requested url : " + 
url,level=xbmc.LOGDEBUG)
 xbmc.log(msg=pluginLogHeader + "requested id : " + 
str(_id),level=xbmc.LOGDEBUG)
 
 # Starting request handler
-# FIXME : Find a way to keep the cookies in the add-on session to avoid 
relogin all the time
-xbmc.log(msg=pluginLogHeader + "No cookies, adding a jar",level=xbmc.LOGDEBUG)
-cj = cookielib.CookieJar()
-requestHandler = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
+if not os.path.isfile(cookie_file) or (datetime.datetime.now() - 
datetime.datetime.fromtimestamp(os.stat(cookie_file).st_mtime)).seconds > 900:
+        xbmc.log(msg=pluginLogHeader + "Cookie is too old or does not 
exists",level=xbmc.LOGDEBUG)
+        cj = createCookie()
+        saveCookie()
 
-# The login is only done for authenticated mode
-if settings.getSetting( "authenticate" ) == "true":
-    xbmc.log(msg=pluginLogHeader + "authentication 
requested",level=xbmc.LOGDEBUG)
-    login()
+cj = loadCookie()
+requestHandler = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
 
+xbmc.log(msg=pluginLogHeader + "Login state : " + 
settings.getSetting('loginok'),level=xbmc.LOGDEBUG)
+if settings.getSetting('authenticate') == "true":
+    if not settings.getSetting('loginok') == "ok":
+        xbmc.log(msg=pluginLogHeader + "User not logged",level=xbmc.LOGDEBUG)
+        xbmc.log(msg=pluginLogHeader + "Process to login",level=xbmc.LOGDEBUG)
+        login()
+        xbmc.log(msg=pluginLogHeader + "Reading subscription 
mode",level=xbmc.LOGDEBUG)
+        settings.setSetting('subscriptionMode',str(get_subscription_mode()))
+        saveCookie()
+else:
+    xbmc.log(msg=pluginLogHeader + "Authenticated mode not 
requested",level=xbmc.LOGDEBUG)
+    xbmc.log(msg=pluginLogHeader + "Reading subscription 
mode",level=xbmc.LOGDEBUG)
+    settings.setSetting('subscriptionMode','0')
+    
 # Find the access mode of the user
-subscription = get_subscription_mode()
+subscription = settings.getSetting('subscriptionMode')
+xbmc.log(msg=pluginLogHeader + "User mode value : " + 
subscription,level=xbmc.LOGDEBUG)
 
 # Determining and executing action
 if( mode == None or url == None or len(url) < 1 ) and _id == 0:

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

Summary of changes:
 .../LICENSE.txt                                    |    0
 plugin.video.nolife/addon.xml                      |    2 +-
 plugin.video.nolife/default.py                     |  110 +++-
 plugin.video.nolife/gpl.txt                        |  674 --------------------
 plugin.video.svtplay/README.md                     |   21 +-
 plugin.video.svtplay/addon.xml                     |    2 +-
 plugin.video.svtplay/changelog.txt                 |    6 +
 plugin.video.svtplay/default.py                    |  245 +++++--
 plugin.video.svtplay/resources/__init__.py         |    1 +
 .../resources/language/English/strings.xml         |    2 +
 .../resources/language/Swedish/strings.xml         |    2 +
 plugin.video.svtplay/resources/lib/__init__.py     |    1 +
 plugin.video.svtplay/resources/lib/bestofsvt.py    |   61 ++
 plugin.video.svtplay/resources/settings.xml        |    1 +
 14 files changed, 349 insertions(+), 779 deletions(-)
 copy {plugin.audio.dradio => plugin.video.nolife}/LICENSE.txt (100%)
 delete mode 100644 plugin.video.nolife/gpl.txt
 create mode 100644 plugin.video.svtplay/resources/__init__.py
 create mode 100644 plugin.video.svtplay/resources/lib/__init__.py
 create mode 100644 plugin.video.svtplay/resources/lib/bestofsvt.py


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to