The branch, gotham has been updated
       via  eeb5979d2104c6f7026d5d7e0b79c06637a3eef2 (commit)
      from  d8d05c98d2d0fd8e70da18115a923de4ae5826b8 (commit)

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

commit eeb5979d2104c6f7026d5d7e0b79c06637a3eef2
Author: sphere <sph...@dersphere.de>
Date:   Tue Jul 8 10:18:56 2014 +0200

    [plugin.video.svtplay] updated to version 4.0.4

diff --git a/plugin.video.svtplay/addon.xml b/plugin.video.svtplay/addon.xml
index 6eda787..ec2aed7 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="4.0.3"
+       version="4.0.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 83aa2a2..edc716a 100644
--- a/plugin.video.svtplay/changelog.txt
+++ b/plugin.video.svtplay/changelog.txt
@@ -1,3 +1,7 @@
+Version 4.0.4
+-------------
+- Add favorites feature
+
 Version 4.0.3
 -------------
 - Add fanart, mirroring thumbnail
diff --git a/plugin.video.svtplay/default.py b/plugin.video.svtplay/default.py
index 9b43b76..a22b1da 100644
--- a/plugin.video.svtplay/default.py
+++ b/plugin.video.svtplay/default.py
@@ -13,6 +13,7 @@ import resources.lib.bestofsvt as bestof
 import resources.lib.helper as helper
 import resources.lib.svt as svt
 import resources.lib.PlaylistManager as PlaylistManager
+import resources.lib.FavoritesManager as FavoritesManager
 from resources.lib.PlaylistDialog import PlaylistDialog
 
 MODE_CHANNELS = "kanaler"
@@ -36,6 +37,7 @@ MODE_VIEW_TITLES = "view_titles"
 MODE_VIEW_EPISODES = "view_episodes"
 MODE_VIEW_CLIPS = "view_clips"
 MODE_PLAYLIST_MANAGER = "playlist-manager"
+MODE_FAVORITES = "favorites"
 
 S_DEBUG = "debug"
 S_HIDE_SIGN_LANGUAGE = "hidesignlanguage"
@@ -63,8 +65,28 @@ def viewStart():
   addDirectoryItem(localize(30001), { "mode": MODE_CATEGORIES })
   addDirectoryItem(localize(30007), { "mode": MODE_BESTOF_CATEGORIES })
   addDirectoryItem(localize(30006), { "mode": MODE_SEARCH })
+  addDirectoryItem(localize(30405), { "mode": MODE_FAVORITES })
   addDirectoryItem(localize(30400), { "mode": MODE_PLAYLIST_MANAGER }, 
folder=False)
 
+def viewFavorites():
+  favorites = FavoritesManager.get_all()
+
+  for item in favorites:
+    list_item = xbmcgui.ListItem(item["title"])
+    fm_script = 
"special://home/addons/plugin.video.svtplay/resources/lib/FavoritesManager.py"
+    fm_action = "remove"
+    list_item.addContextMenuItems(
+      [
+        (
+          localize(30407),
+          "XBMC.RunScript("+fm_script+", "+fm_action+", "+item["id"]+")"
+         )
+      ], replaceItems=True)
+    params = {}
+    params["url"] = item["url"]
+    params["mode"] = MODE_PROGRAM
+    xbmcplugin.addDirectoryItem(PLUGIN_HANDLE, sys.argv[0] + '?' + 
urllib.urlencode(params), list_item, True)
+
 
 def viewManagePlaylist():
   plm_dialog = PlaylistDialog()
@@ -77,14 +99,12 @@ def viewAtoO():
   for program in programs:
     addDirectoryItem(program["title"], { "mode": MODE_PROGRAM, "url": 
program["url"] })
 
-
 def viewCategories():
   categories = svt.getCategories()
 
   for category in categories:
     addDirectoryItem(category["title"], { "mode": MODE_CATEGORY, "url": 
category["url"] }, thumbnail=category["thumbnail"])
 
-
 def viewAlphaDirectories():
   alphas = svt.getAlphas()
   if not alphas:
@@ -92,7 +112,6 @@ def viewAlphaDirectories():
   for alpha in alphas:
     addDirectoryItem(alpha["title"], { "mode": MODE_LETTER, "letter": 
alpha["char"] })
 
-
 def viewProgramsByLetter(letter):
   programs = svt.getProgramsByLetter(letter)
 
@@ -300,14 +319,25 @@ def addDirectoryItem(title, params, thumbnail = None, 
folder = True, live = Fals
       plm_script = 
"special://home/addons/plugin.video.svtplay/resources/lib/PlaylistManager.py"
       plm_action = "add"
       if not thumbnail:
-        thumnail= ""
+        thumbnail= ""
       li.addContextMenuItems(
         [
           (
             localize(30404),
             "XBMC.RunScript("+plm_script+", "+plm_action+", "+params["url"]+", 
"+title+", "+thumbnail+")"
            )
-        ])
+        ], replaceItems=True)
+  if params["mode"] == MODE_PROGRAM:
+    # Add context menu item for adding programs as favorites
+    fm_script = 
"special://home/addons/plugin.video.svtplay/resources/lib/FavoritesManager.py"
+    fm_action = "add"
+    li.addContextMenuItems(
+      [
+        (
+          localize(30406),
+          "XBMC.RunScript("+fm_script+", "+fm_action+", "+title+", 
"+params["url"]+")"
+         )
+      ], replaceItems=True)
 
   if info:
     li.setInfo("Video", info)
@@ -359,5 +389,7 @@ elif ARG_MODE == MODE_BESTOF_CATEGORY:
   viewBestOfCategory(ARG_URL)
 elif ARG_MODE == MODE_PLAYLIST_MANAGER:
   viewManagePlaylist()
+elif ARG_MODE == MODE_FAVORITES:
+  viewFavorites()
 
 xbmcplugin.endOfDirectory(PLUGIN_HANDLE)
diff --git a/plugin.video.svtplay/resources/language/English/strings.xml 
b/plugin.video.svtplay/resources/language/English/strings.xml
index f96edc2..b179ebc 100644
--- a/plugin.video.svtplay/resources/language/English/strings.xml
+++ b/plugin.video.svtplay/resources/language/English/strings.xml
@@ -26,6 +26,9 @@
   <string id="30402">Close</string>
   <string id="30403">Play</string>
   <string id="30404">Add to playlist</string>
+  <string id="30405">Favorites</string>
+  <string id="30406">Add to favorites</string>
+  <string id="30407">Remove from favorites</string>
   <string id="30500">Debug</string>
   <string id="30501">Show subtitles</string>
   <string id="30502">Group programs in A-Ö by first character</string>
diff --git a/plugin.video.svtplay/resources/language/Swedish/strings.xml 
b/plugin.video.svtplay/resources/language/Swedish/strings.xml
index 65f09e4..3d82046 100644
--- a/plugin.video.svtplay/resources/language/Swedish/strings.xml
+++ b/plugin.video.svtplay/resources/language/Swedish/strings.xml
@@ -26,6 +26,9 @@
   <string id="30402">Stäng</string>
   <string id="30403">Spela</string>
   <string id="30404">Lägg till i spellista</string>
+  <string id="30405">Favoriter</string>
+  <string id="30406">Lägg till som favorit</string>
+  <string id="30407">Ta bort från favoriter</string>
   <string id="30500">Debug</string>
   <string id="30501">Visa undertexter</string>
   <string id="30502">Gruppera program i A-Ö efter första bokstav</string>
diff --git a/plugin.video.svtplay/resources/lib/svt.py 
b/plugin.video.svtplay/resources/lib/svt.py
index a09d18e..67811dc 100644
--- a/plugin.video.svtplay/resources/lib/svt.py
+++ b/plugin.video.svtplay/resources/lib/svt.py
@@ -80,8 +80,6 @@ def getProgramsForCategory(url):
   html = getPage(url)
 
   container = common.parseDOM(html, "div", attrs = { "id" : 
"[^\"']*playJs-alphabetic-list[^\"']*" })
-  if url == "/nyheter":
-    container = common.parseDOM(html, "div", attrs = { "id" : 
"[^\"']*playJs-title-pages[^\"']*" })
 
   if not container:
     common.log("Could not find container for URL "+url)
diff --git a/plugin.video.svtplay/tests/lib/xbmc.py 
b/plugin.video.svtplay/tests/lib/xbmc.py
index 5811b5f..db74327 100644
--- a/plugin.video.svtplay/tests/lib/xbmc.py
+++ b/plugin.video.svtplay/tests/lib/xbmc.py
@@ -10,11 +10,13 @@ def log(msg, level=None):
   print(msg)
 
 def translatePath(path):
+  if path.startswith("special://profile/addon_data/"):
+    return "favorites.json"
   return "./"
 
 
 class Player:
-  
+
   def play(item=None, listitem=None, windowed=None, startpos=None):
     if item:
       log("Player is playing "+str(item))

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

Summary of changes:
 plugin.video.svtplay/addon.xml                     |    2 +-
 plugin.video.svtplay/changelog.txt                 |    4 +
 plugin.video.svtplay/default.py                    |   42 +++++++-
 .../resources/language/English/strings.xml         |    3 +
 .../resources/language/Swedish/strings.xml         |    3 +
 .../resources/lib/FavoritesManager.py              |  102 ++++++++++++++++++++
 plugin.video.svtplay/resources/lib/svt.py          |    2 -
 plugin.video.svtplay/tests/lib/xbmc.py             |    4 +-
 plugin.video.svtplay/tests/testFM.py               |   92 ++++++++++++++++++
 9 files changed, 245 insertions(+), 9 deletions(-)
 create mode 100644 plugin.video.svtplay/resources/lib/FavoritesManager.py
 create mode 100644 plugin.video.svtplay/tests/testFM.py


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Xbmc-addons mailing list
Xbmc-addons@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to