The branch, frodo has been updated
       via  4d76b9c89f5689545fcfe7e1a71e6e519cad2384 (commit)
      from  2124027dffdb2116f59e915b6ed09d059446feb5 (commit)

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

commit 4d76b9c89f5689545fcfe7e1a71e6e519cad2384
Author: sphere <[email protected]>
Date:   Wed May 21 09:50:30 2014 +0200

    [plugin.video.jworg] updated to version 0.6.0

diff --git a/plugin.video.jworg/addon.xml b/plugin.video.jworg/addon.xml
index cd38396..ade0d6a 100644
--- a/plugin.video.jworg/addon.xml
+++ b/plugin.video.jworg/addon.xml
@@ -2,7 +2,7 @@
 <addon 
     id="plugin.video.jworg" 
     name="Jw.org audio/video browser" 
-    version="0.5.0" 
+    version="0.6.0" 
     provider-name="Realtebo">
     <requires>
         <import addon="xbmc.python" version="2.1.0"/>
diff --git a/plugin.video.jworg/audio/jw_audio_bible.py 
b/plugin.video.jworg/audio/jw_audio_bible.py
index 7033212..e6f9c59 100644
--- a/plugin.video.jworg/audio/jw_audio_bible.py
+++ b/plugin.video.jworg/audio/jw_audio_bible.py
@@ -17,13 +17,12 @@ def showAudioBibleIndex():
        
        language                = jw_config.language
        bible_index_url = jw_common.getUrl(language) + 
jw_config.const[language]["bible_index_audio"]
-       html                    = jw_common.loadUrl(bible_index_url) 
+       html                    = jw_common.loadUrl(url = bible_index_url, 
month_cache = True) 
        
        soup            = BeautifulSoup(html)
-
        cover_div       = soup.findAll('div',{"class": re.compile(r'\bcvr\b')})
        span            = cover_div[0].findAll('span')
-       img_url     = span[0].get('data-img-size-md');
+       img_url     = span[0].get('data-img-size-md')
 
        boxes   = soup.findAll('li',{"class": re.compile(r'\bbookName\b')})
 
@@ -69,7 +68,7 @@ def showAudioBibleBookJson(book_num):
        json_url        = json_url + "&booknum=" 
        json_url        = json_url + book_num
 
-       json            = jw_common.loadJsonFromUrl(url = json_url, ajax = 
False)
+       json            = jw_common.loadJsonFromUrl(url = json_url, ajax = 
False, month_cache = True)
        lang_code       = lang_code
        book_name       = json["pubName"]
        cover_url   = json["pubImage"]["url"]
diff --git a/plugin.video.jworg/audio/jw_audio_drama.py 
b/plugin.video.jworg/audio/jw_audio_drama.py
index 3780ee6..f4bce3f 100644
--- a/plugin.video.jworg/audio/jw_audio_drama.py
+++ b/plugin.video.jworg/audio/jw_audio_drama.py
@@ -5,6 +5,7 @@ AUDIO DRAMAS RELATED FUNCTIONS
 import jw_config
 import jw_common
 
+from BeautifulSoup import BeautifulSoup 
 import re
 import urllib
 
@@ -21,33 +22,37 @@ def showDramaIndex(start):
        drama_index_url = drama_index_url + 
jw_config.const[language]["dramas_index"] 
        drama_index_url = drama_index_url + "?start=" + start + "&sortBy=" + 
jw_config.audio_sorting
        
-       html                    = jw_common.loadUrl(drama_index_url) 
-       
-       # Grep drama titles
-       regexp_dramas_titles = '"pubAdTitleBlock">([^<]+)<'
-       drama_titles = re.findall(regexp_dramas_titles, html)   
-       
-       # Grep drama json
-       regexp_drama_json = 'class="jsDownload" 
data-jsonurl="([^"]+MP3[^"]+)".*'
-       drama_json = re.findall(regexp_drama_json, html)
+       html                    = jw_common.loadUrl(url = drama_index_url, 
month_cache = True) 
 
-       # Grep drama  image - [^\'.]+ discards ".prd_md" duplicated images
-       regexp_drama_thumb = 
'data-img-size-md=\'(http://assets.jw.org/assets/[^\'.]+_md\.jpg)\''
-       drama_thumb = re.findall(regexp_drama_thumb, html)
+       soup                    = BeautifulSoup(html)
+       publications    = soup.findAll("div", { "class" : 
re.compile(r'\bPublication\b') })
 
-       drama_num = 0
-       for drama in drama_titles:
+       for publication in publications :
+               title = publication.find('h3').contents[0].encode("utf-8");
+               title = jw_common.cleanUpText(title);
 
-               title = jw_common.cleanUpText(drama_titles[drama_num])
+               json_url = None
+               try :
+                       json_url = publication.find("a", { "class" : 
"jsDownload" }).get('data-jsonurl')
+               except :
+                       pass
+
+               # placeholder if cover is missing
+               cover_url = 
"http://assets.jw.org/themes/content-theme/images/thumbProduct_placeholder.jpg";
+               try :
+                       cover_url = publication.findAll("img")[1].get('src')
+               except :
+                       pass 
 
                listItem = xbmcgui.ListItem(
                        label                   = title,
-                       thumbnailImage  = drama_thumb[drama_num]
+                       thumbnailImage  = cover_url
                )       
+
                params = {
                        "content_type"  : "audio", 
-                       "mode"                  : "open_drama_json",
-                       "json_url"              : drama_json[drama_num] 
+                       "mode"                  : "open_music_json", 
+                       "json_url"              : json_url
                }
                url = jw_config.plugin_name + '?' + urllib.urlencode(params)    
                xbmcplugin.addDirectoryItem(
@@ -55,8 +60,7 @@ def showDramaIndex(start):
                        url             = url, 
                        listitem        = listItem, 
                        isFolder        = False 
-               )  
-               drama_num = drama_num + 1
+               )
 
        jw_common.setNextPageLink(html, "open_drama_index", "audio")
 
diff --git a/plugin.video.jworg/audio/jw_audio_dramatic_reading.py 
b/plugin.video.jworg/audio/jw_audio_dramatic_reading.py
index 28cc81e..12b7f8d 100644
--- a/plugin.video.jworg/audio/jw_audio_dramatic_reading.py
+++ b/plugin.video.jworg/audio/jw_audio_dramatic_reading.py
@@ -4,6 +4,7 @@ DRAMATICA BIBLE READING RELATED FUNCTIONS
 import jw_config
 import jw_common
 
+from BeautifulSoup import BeautifulSoup 
 import re
 import urllib
 
@@ -21,29 +22,36 @@ def showDramaticReadingIndex(start):
        reading_index_url       = reading_index_url + "?start=" + start  + 
"&sortBy=" + jw_config.audio_sorting
        
        html                            = jw_common.loadUrl(reading_index_url) 
-       
-       # Grep reading titles
-       regexp_reading_titles = '"pubAdTitleBlock">([^<]+)<'
-       reading_title = re.findall(regexp_reading_titles, html)         
-       
-       # Grep reading json
-       regexp_reading_json = 'class="jsDownload" 
data-jsonurl="([^"]+MP3[^"]+)".*'
-       reading_json = re.findall(regexp_reading_json, html)
 
-       # Grep reading images - [^\'.]+ discards ".prd_md" duplicated images
-       regexp_reading_thumb = 
'data-img-size-md=\'(http://assets.jw.org/assets/[^\'.]+_md\.jpg)\''
-       reading_thumb = re.findall(regexp_reading_thumb, html)
+       soup                    = BeautifulSoup(html)
+       publications    = soup.findAll("div", { "class" : 
re.compile(r'\bPublication\b') })
+
+       for publication in publications :
+               title = publication.find('h3').contents[0].encode("utf-8");
+               title = jw_common.cleanUpText(title);
+
+               json_url = None
+               try :
+                       json_url = publication.find("a", { "class" : 
"jsDownload" }).get('data-jsonurl')
+               except :
+                       pass
+
+               # placeholder if cover is missing
+               cover_url = 
"http://assets.jw.org/themes/content-theme/images/thumbProduct_placeholder.jpg";
+               try :
+                       cover_url = publication.findAll("img")[1].get('src')
+               except :
+                       pass 
 
-       reading_num = 0
-       for reading in reading_title:
                listItem = xbmcgui.ListItem(
-                       label                   = reading_title[reading_num], 
-                       thumbnailImage  = reading_thumb[reading_num]
+                       label                   = title,
+                       thumbnailImage  = cover_url
                )       
+
                params = {
                        "content_type"  : "audio", 
-                       "mode"                  : "open_dramatic_reading_json", 
-                       "json_url"              : reading_json[reading_num] 
+                       "mode"                  : "open_music_json", 
+                       "json_url"              : json_url
                }
                url = jw_config.plugin_name + '?' + urllib.urlencode(params)    
                xbmcplugin.addDirectoryItem(
@@ -51,8 +59,7 @@ def showDramaticReadingIndex(start):
                        url             = url, 
                        listitem        = listItem, 
                        isFolder        = False 
-               )  
-               reading_num = reading_num + 1
+               )
 
        jw_common.setNextPageLink(html, "open_dramatic_reading_index", "audio")
 
diff --git a/plugin.video.jworg/audio/jw_audio_magazine.py 
b/plugin.video.jworg/audio/jw_audio_magazine.py
index 27ce029..270a280 100644
--- a/plugin.video.jworg/audio/jw_audio_magazine.py
+++ b/plugin.video.jworg/audio/jw_audio_magazine.py
@@ -1,6 +1,7 @@
 import jw_common
 import jw_config
 
+from BeautifulSoup import BeautifulSoup 
 import urllib
 import sys
 import re
@@ -65,7 +66,8 @@ def showMagazineFilterIndex(pub_filter = None):
         if item["title"] == "-" :
             continue
 
-        listItem    = xbmcgui.ListItem( item["title"] )     
+        title_text  = jw_common.cleanUpText( item["title"] )
+        listItem    = xbmcgui.ListItem( title_text )     
 
         params      = {
             "content_type"  : "audio", 
@@ -95,64 +97,47 @@ def showMagazineFilteredIndex(pub_filter = None, 
year_filter = None):
     
     html            = jw_common.loadUrl(magazine_url) 
 
-    # Grep issue date and publication title
-    regexp_issue = "<span class='issueDate'>([^<]+)</span> (<span 
class='cvrTtl'>([^<]+)</span>)?"
-    issues = re.findall(regexp_issue, html)      
+    soup            = BeautifulSoup(html)
+    publications    = soup.findAll("div", { "class" : 
re.compile(r'\bPublicationIssue\b') })
 
-    # The following regexp use two 'generic spaces' \s to filter out unwanted 
items
-    regexp_json = '\s\sdata-jsonurl="([^"]+)"'
-    json = re.findall(regexp_json, html)
+    for publication in publications :
 
-    # Cover
-    regexp_cover = 
"data-img-size-md='(http://assets.jw.org/assets/[^.]+md\.jpg)'"
-    cover = re.findall(regexp_cover, html)
+        cover_title = publication.find("span", { "class" : 
re.compile(r'\bperiodicalTitleBlock\b') })
 
-    # publication dates where
-    # pub_dates[0] = publication (w,wp, ws, g)
-    # pub_dates[1] = issue date (201301, 2013015, etc.. different by 
publication type)
-    regexp_pub_date = '"toc-([wgps]+)([0-9]+)"'
-    pub_dates = re.findall(regexp_pub_date, html)
-
-    cover_available = {}
-
-    # I create a dict of "pub_date : cover_url"
-    # So i can test if a pub_date really has a cover_url
-    for cover_url in cover:
-        regexp_cover_date = "([wsgp]+)_[A-Z]+_([0-9]+).md.jpg"
-        dates = re.findall(regexp_cover_date, cover_url)
-        the_key = dates[0][0] + "-" + dates[0][1]
-        cover_available[the_key] = cover_url
+        issue_date = cover_title.find("span", { "class" : 
re.compile(r'\bissueDate\b') }).contents[0].encode("utf-8")
+        issue_date = jw_common.cleanUpText(issue_date)
+        try :
+            # wp and g
+            issue_title = cover_title.find("span", { "class" : 
re.compile(r'\bcvrTtl\b') }).contents[0].encode("utf-8")
+        except :
+            # w (study edtion)
+            issue_title = cover_title.find("span", { "class" : 
re.compile(r'\bpubName\b') }).contents[0].encode("utf-8")
 
-    count = 0
-    for issue in issues:
+        issue_title = jw_common.cleanUpText(issue_title)
 
-        title = issue[0]
-        if issue[2].strip() != "":
-            title = title + " - " + issue[2]
+        json_url = None
+        try :
+            json_url = publication.find("a", { "class" : 
re.compile(r'\bstream\b') }).get('data-jsonurl')
+        except :
+            pass
 
-        # somethings like "wp-20131201" or "g-201401"
-        pub_date = pub_dates[count][0] + "-" + pub_dates[count][1]
-        # placeholder to use if the cover is missing
+        # placeholder if cover is missing
         cover_url = 
"http://assets.jw.org/themes/content-theme/images/thumbProduct_placeholder.jpg";
         try :
-            cover_url = cover_available[pub_date]
-        except:
-            # this exception happens when there is no cover, but only 
placeholder
-            pass
+            cover_url = publication.findAll("img")[1].get('src')
+        except :
+            pass 
 
         listItem    = xbmcgui.ListItem( 
-            label           = title,
+            label           = issue_date + ": " + issue_title,
             thumbnailImage  = cover_url
-        )     
+        ) 
 
         params      = {
             "content_type"  : "audio", 
             "mode"          : "open_magazine_json",
+            "json_url"      : json_url,
         } 
-        try:
-            params["json_url"] = json[count]
-        except:
-            params["json_url"] = None
 
         url = jw_config.plugin_name + '?' + urllib.urlencode(params)
 
@@ -161,8 +146,6 @@ def showMagazineFilteredIndex(pub_filter = None, 
year_filter = None):
             url         = url, 
             listitem    = listItem, 
             isFolder    = True 
-        )  
+        )
 
-        count = count +1
-    
-    xbmcplugin.endOfDirectory(handle=jw_config.plugin_pid)
\ No newline at end of file
+    xbmcplugin.endOfDirectory(handle=jw_config.plugin_pid)
diff --git a/plugin.video.jworg/audio/jw_audio_music.py 
b/plugin.video.jworg/audio/jw_audio_music.py
index e58a357..ce5f708 100644
--- a/plugin.video.jworg/audio/jw_audio_music.py
+++ b/plugin.video.jworg/audio/jw_audio_music.py
@@ -4,6 +4,7 @@ AUDIO BIBLE RELATED FUNCTIONSS
 import xbmcgui
 import xbmcplugin
 
+from BeautifulSoup import BeautifulSoup 
 import urllib
 import re
 
@@ -19,30 +20,37 @@ def showMusicIndex(start):
        music_index_url = music_index_url + 
jw_config.const[language]["music_index"]
        music_index_url = music_index_url + "?start=" + start + "&sortBy=" + 
jw_config.audio_sorting
        
-       html                    = jw_common.loadUrl(music_index_url) 
+       html                    = jw_common.loadUrl(url = music_index_url, 
month_cache = True) 
        
-       # Grep compilation titles
-       regexp_music_title = '"pubAdTitleBlock">([^<]+)<'
-       music_title = re.findall(regexp_music_title, html)      
+       soup                    = BeautifulSoup(html)
+       publications    = soup.findAll("div", { "class" : 
re.compile(r'\bPublication\b') })
 
-       # Grep music json
-       regexp_music_json = 'class="jsDownload" 
data-jsonurl="([^"]+MP3[^"]+)".*'
-       music_json = re.findall(regexp_music_json, html)
+       for publication in publications :
+               title = publication.find('h3').contents[0].encode("utf-8");
+               title = jw_common.cleanUpText(title);
 
-       # Grep compilation image - [A-Z]+ discards ".prd_md" duplicated images
-       regexp_music_thumb = 
'data-img-size-md=["\']([^"\']+[A-Z]+_md\.jpg)["\']'
-       music_thumb = re.findall(regexp_music_thumb, html)
+               json_url = None
+               try :
+                       json_url = publication.find("a", { "class" : 
"jsDownload" }).get('data-jsonurl')
+               except :
+                       pass
+
+               # placeholder if cover is missing
+               cover_url = 
"http://assets.jw.org/themes/content-theme/images/thumbProduct_placeholder.jpg";
+               try :
+                       cover_url = publication.findAll("img")[1].get('src')
+               except :
+                       pass 
 
-       album_num = 0
-       for album in music_title:
                listItem = xbmcgui.ListItem(
-                       label                   = music_title[album_num], 
-                       thumbnailImage  = music_thumb[album_num]
+                       label                   = title,
+                       thumbnailImage  = cover_url
                )       
+
                params = {
                        "content_type"  : "audio", 
                        "mode"                  : "open_music_json", 
-                       "json_url"              : music_json[album_num] 
+                       "json_url"              : json_url
                }
                url = jw_config.plugin_name + '?' + urllib.urlencode(params)    
                xbmcplugin.addDirectoryItem(
@@ -50,8 +58,7 @@ def showMusicIndex(start):
                        url             = url, 
                        listitem        = listItem, 
                        isFolder        = True 
-               )  
-               album_num = album_num + 1
+               )
 
        jw_common.setNextPageLink(html, "open_music_index", "audio")
 
diff --git a/plugin.video.jworg/changelog.txt b/plugin.video.jworg/changelog.txt
index 172fd0a..8f6060b 100644
--- a/plugin.video.jworg/changelog.txt
+++ b/plugin.video.jworg/changelog.txt
@@ -1,3 +1,18 @@
+0.6.0
+-----
+
+Fix:
++ Video issue due to json layout of some new video
++ Fixed magazine index parsing to fix a bug when 'All magazine' mode
++ Stripped out '&nbsp;' from some titles from magazines' index
++ Fixed music index, due to another changes in html of website
++ Fixed dramas index, due, you can guess, to html changes 
++ And also fixed dramatic reading issues, for the same reason
+
+Enhancements:
++ Bible book index now load faster !
++ Also music index !
+
 0.5.0
 -----
 
diff --git a/plugin.video.jworg/jw_common.py b/plugin.video.jworg/jw_common.py
index ae3a34f..652a15a 100644
--- a/plugin.video.jworg/jw_common.py
+++ b/plugin.video.jworg/jw_common.py
@@ -78,10 +78,13 @@ def loadNotCachedUrl(url):
        html = response.read()
        return html             
 
-def loadUrl (url):
+def loadUrl (url, month_cache = False ):
        html = ""
        try :
-               html = jw_config.cache.cacheFunction(loadNotCachedUrl, url)
+               if month_cache == True :
+                       html = 
jw_config.cache_month.cacheFunction(loadNotCachedUrl, url)       
+               else :
+                       html = jw_config.cache.cacheFunction(loadNotCachedUrl, 
url)     
        except:
                pass 
        return html     
diff --git a/plugin.video.jworg/program/jw_exec_activity.py 
b/plugin.video.jworg/program/jw_exec_activity.py
index 8b946de..ae6770c 100644
--- a/plugin.video.jworg/program/jw_exec_activity.py
+++ b/plugin.video.jworg/program/jw_exec_activity.py
@@ -59,7 +59,7 @@ def showActivityIndex():
 
        xbmcplugin.endOfDirectory(handle=jw_config.plugin_pid)
 
-       return;
+       return
 
 
 
@@ -70,7 +70,7 @@ def showActivitySection(url):
        soup    = BeautifulSoup(html)
 
     # container of news, so we can leave out the sidebar
-       article = soup.findAll("div", {'id' : 'article'});
+       article = soup.findAll("div", {'id' : 'article'})
 
        news    = article[0].findAll('div', {'class' : 
re.compile(r'\bPublicationArticle')})
 
diff --git a/plugin.video.jworg/program/jw_exec_news.py 
b/plugin.video.jworg/program/jw_exec_news.py
index e6917af..c118e74 100644
--- a/plugin.video.jworg/program/jw_exec_news.py
+++ b/plugin.video.jworg/program/jw_exec_news.py
@@ -5,6 +5,7 @@ NEWS RELATED FUNCTIONS
 import jw_config
 import jw_common
 
+from BeautifulSoup import BeautifulSoup 
 import re
 import urllib
 
@@ -36,7 +37,7 @@ def showNewsIndex():
 
                # Stop news parsing at the first lateral link (an head) found
                if "/?v=" in news[0] :
-                       break;
+                       break
 
                listItem = xbmcgui.ListItem( 
                        label                   = title,
@@ -109,7 +110,7 @@ class News(xbmcgui.WindowDialog):
                        'font35_title', "0xFF0000FF"
                )
                self.ctrlText= xbmcgui.ControlTextBox(
-            border, 20, 
+            border, 120, 
             1280 - border *2, 3000, 
             'font30', "0xFF000000"
         )
@@ -118,16 +119,17 @@ class News(xbmcgui.WindowDialog):
                self.addControl (self.ctrlText)
                self.addControl (self.ctrlBackgound2)
                self.addControl (self.ctrlTitle)
-               
-               self.ctrlTitle.setText( self.getTitle(text) )
-               self.ctrlText.setText( self.getText(text) )
+                       
+               soup = BeautifulSoup(text)
+               self.ctrlTitle.setText( self.getTitle(soup) )
+               self.ctrlText.setText( self.getText(soup) )
                
 
        def onAction(self, action):
                (x,y) =  self.ctrlText.getPosition()
 
                if action == ACTION_MOVE_UP or action == ACTION_SCROLL_UP :
-                       if y > 0:
+                       if y > 120:
                                return
                        y = y + 50
                        self.ctrlText.setPosition(x,y)
@@ -140,7 +142,7 @@ class News(xbmcgui.WindowDialog):
                        return
 
                if action == ACTION_PAGE_UP:
-                       if y > 0:
+                       if y > 120:
                                return
                        y = y + 500
                        self.ctrlText.setPosition(x,y)
@@ -155,16 +157,20 @@ class News(xbmcgui.WindowDialog):
                self.close()
 
        # Grep news title
-       def getTitle(self, text):
-               regexp_header = "<header><h1([^>]*)>(.*)</h1>"
-               headers = re.findall(regexp_header, text)
-               return headers[0][1]
-
-       def getText(self, text):
-               regexp_pars = '<p id="p[0-9]+" class="p[0-9]+">([^<]+)</p>'
-               pars = re.findall(regexp_pars, text)
-               out = ""
-               for par in pars:
-                       out = out + "\n\n" + par
+       def getTitle(self, soup):
+               header = soup.find("h1").contents[0].encode("utf-8")
+               return header
+
+       def getText(self, soup):
+               paragraphs = soup.findAll("p", { "class" : 
re.compile(r'\bp\d+\b') })
+
+               out =  ""
+               for p in paragraphs :
+                       text = "".join(p.findAll(text = True))
+                       text =  re.sub("<strong>", "[B]", text)
+                       text =  re.sub("</strong>", "[/B]", text)
+                       
+                       out = out + text + "\n\n";
+
                out = out + "\n\n[COLOR=FF0000FF][I]" + 
jw_common.t(30038).encode("utf8") + "[/I][/COLOR]"
                return out
\ No newline at end of file
diff --git a/plugin.video.jworg/video/jw_sign.py 
b/plugin.video.jworg/video/jw_sign.py
index 4d4dfb9..da7dea1 100644
--- a/plugin.video.jworg/video/jw_sign.py
+++ b/plugin.video.jworg/video/jw_sign.py
@@ -263,7 +263,7 @@ def searchResolution(category_url, row_index) :
        # looking for choosen resolution or first available resolution unde it
        max_resolution  = xbmcplugin.getSetting(jw_config.plugin_pid, 
"max_resolution")
        if max_resolution == 0 :
-               return False;
+               return False
 
        row_index       = int(row_index) #because it's a string actually !
        html            = jw_common.loadUrl(category_url)
@@ -303,10 +303,10 @@ def searchResolution(category_url, row_index) :
        keys = sorted(list(video_dict.keys()), reverse=True)
        for key in keys :
                if (key <= max_resolution_string )  :
-                       return key;
+                       return key
 
        # If am here, I surely have NOT the default resolution found
-       return False;
+       return False
 
 
 # Get the list of playable item (a list of video resolution and title)
@@ -385,7 +385,7 @@ def showVideoCategorySpecificRow(category_url, thumb, 
row_index) :
 
                                xbmc.Player().play(item=url_to_play, 
listitem=listItem)
 
-                               return;
+                               return
 
 
        # this will be executed only if no available res found
diff --git a/plugin.video.jworg/video/jw_video.py 
b/plugin.video.jworg/video/jw_video.py
index 63eb2b5..b4aaea4 100644
--- a/plugin.video.jworg/video/jw_video.py
+++ b/plugin.video.jworg/video/jw_video.py
@@ -103,7 +103,7 @@ def showVideoIndex(start, video_filter):
        for title in videos:
                if posters[count] is None :
                        count = count + 1
-                       continue;
+                       continue
 
                json_url = video_json[count]
 
@@ -188,11 +188,18 @@ def setVideoUrl(main_video_title, json_url, thumb) :
        try :
                temp = json["files"][language_code]
        except :
-               language_code = "univ"
-               pass
+               try:
+                       temp = json["files"]["univ"]
+               except:
+                       # e.g. 
http://www.jw.org/apps/TRGCHlZRQVNYVrXF?docid=802014548&output=json&fileformat=mp4&alllangs=1&track=1&langwritten=I&txtCMSLang=I
+                       temp = json["files"]["E"] 
+                       pass
 
        video_dict = {}
-       for mp4 in json["files"][language_code]["MP4"]:
+
+       xbmc.log ("JWORG: json_url " + json_url.encode("utf-8"), xbmc.LOGERROR)
+
+       for mp4 in temp["MP4"]:
                res                             = mp4["label"]          
                url_to_play                     = mp4["file"]["url"]
                mp4_title_cleaned       = jw_common.cleanUpText (mp4["title"])
@@ -300,6 +307,17 @@ def showVideoJsonUrl(json_url, thumb):
        if len(json["languages"]) == 0:
                language_code = ""
        
+       try :
+               temp = json["files"][language_code]
+       except :
+               try:
+                       temp = json["files"]["univ"]
+                       language_code = "univ"
+               except:
+                       # e.g. 
http://www.jw.org/apps/TRGCHlZRQVNYVrXF?docid=802014548&output=json&fileformat=mp4&alllangs=1&track=1&langwritten=I&txtCMSLang=I
+                       temp = json["files"]["E"] 
+                       language_code = "E"
+                       pass
 
        # Create in memory dict of dict with all available videos
        video_dict = {}

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

Summary of changes:
 plugin.video.jworg/addon.xml                       |    2 +-
 plugin.video.jworg/audio/jw_audio_bible.py         |    7 +-
 plugin.video.jworg/audio/jw_audio_drama.py         |   44 ++++++-----
 .../audio/jw_audio_dramatic_reading.py             |   45 +++++++-----
 plugin.video.jworg/audio/jw_audio_magazine.py      |   77 ++++++++------------
 plugin.video.jworg/audio/jw_audio_music.py         |   41 ++++++-----
 plugin.video.jworg/changelog.txt                   |   15 ++++
 plugin.video.jworg/jw_common.py                    |    7 ++-
 plugin.video.jworg/program/jw_exec_activity.py     |    4 +-
 plugin.video.jworg/program/jw_exec_news.py         |   42 ++++++-----
 plugin.video.jworg/video/jw_sign.py                |    8 +-
 plugin.video.jworg/video/jw_video.py               |   26 ++++++-
 12 files changed, 180 insertions(+), 138 deletions(-)


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to