The branch, frodo has been updated
via e439c5341030a6f53a47bb229e1f0b97be5b1477 (commit)
from 7dfea45f4e559e6d9f39047f10532109a5a71dba (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=e439c5341030a6f53a47bb229e1f0b97be5b1477
commit e439c5341030a6f53a47bb229e1f0b97be5b1477
Author: sphere <[email protected]>
Date: Fri Apr 11 08:21:46 2014 +0200
[plugin.video.jworg] updated to version 0.5.0
diff --git a/plugin.video.jworg/addon.py b/plugin.video.jworg/addon.py
index 33c5919..3efc0b5 100644
--- a/plugin.video.jworg/addon.py
+++ b/plugin.video.jworg/addon.py
@@ -21,13 +21,19 @@ from program import jw_exec_news
from program import jw_exec_week_program
from program import jw_exec_activity
+from generic import jw_menu
+
"""
START
"""
# call arguments
params = jw_config.plugin_params
-content_type = params["content_type"][0]
+try:
+ content_type = params["content_type"][0]
+except:
+ content_type = "menu"
+ pass
mode = None
try:
@@ -39,8 +45,14 @@ except:
"""
Call router
"""
+if content_type == "menu" :
+ jw_menu.showMenu()
+
if content_type == "video" :
if mode is None :
+ jw_video.showVideoIndex(0, "none")
+
+ if mode == "open_video_filter":
jw_video.showVideoFilter()
if mode == "open_video_index":
@@ -83,6 +95,7 @@ if content_type == "video" :
thumb = params ["thumb"][0]
jw_sign.selBook(url, thumb)
+
if content_type == "audio" :
if mode is None :
jw_audio.showAudioIndex()
diff --git a/plugin.video.jworg/addon.xml b/plugin.video.jworg/addon.xml
index 5ab0732..cd38396 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.4.3"
+ version="0.5.0"
provider-name="Realtebo">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
@@ -19,6 +19,7 @@
<summary lang="de">Ein einfacher Browser für jw.org
Medieninhalte</summary>
<summary lang="el">ÎÎ½Î±Ï Î±ÏλÏÏ ÏεÏιηγηÏήÏ
ÏεÏιεÏομÎνοÏ
για Ïο jw.org</summary>
<summary lang="en">A simple browser for jw.org media content</summary>
+ <summary lang="en_NZ">A simple browser for jw.org media
content</summary>
<summary lang="es">Un navegador simple para jw.org contenido de
medios</summary>
<summary lang="fr">Un navigateur simple pour le contenu du site
jw.org</summary>
<summary lang="fr_CA">Un navigateur simple pour le contenu des médias
de jw.org</summary>
@@ -37,6 +38,7 @@
<description lang="de">Mit direktes Streaming von www.jw.org, ist
folgendes möglich:[CR]- Videos anschauen[CR]- Magazine, Lieder und Melodien
aus dem Königreich, Bibellesungen, Audio Dramen und dramatische
Bibellesungen[CR]- den Täglichen Text lesen </description>
<description lang="el">Îε άμεÏη Ïοή αÏÏ Ïο www.jw.org,
μÏοÏείÏε να:[CR]- ΠαÏακολοÏ
θήÏεÏε βίνÏεο[CR]-
ÎκοÏÏεÏε αναγνÏÏÎµÎ¹Ï ÏεÏιοδικÏν, ÏÏαγοÏ
διÏν και βαÏιλικÏν μελÏδιÏν, βιβλικÎÏ
αναγνÏÏειÏ, ηÏηÏικά δÏάμαÏα και
δÏαμαÏοÏοιημÎÎ½ÎµÏ Î²Î¹Î²Î»Î¹ÎºÎÏ Î±Î½Î±Î³Î½ÏÏειÏ[CR]-
ÎιαβάÏεÏε Ïο ÎÎ¹Î²Î»Î¹ÎºÏ Î£ÏίÏο και Ïα ÎÎα ÏηÏ
ÎμÎÏαÏ</description>
<description lang="en">Directly streaming from www.jw.org, you
can:[CR]- watch videos[CR]- listen magazine readings, songs and kingdom
melodies, bible reading, audio dramas and dramatic bible readings[CR]- Read the
daily text and news</description>
+ <description lang="en_NZ">Directly streaming from www.jw.org, you
can:[CR]- watch videos[CR]- listen magazine readings, songs and kingdom
melodies, bible reading, audio dramas and dramatic bible readings[CR]- Read the
daily text and news</description>
<description lang="es">Directamente fluye de www.jw.org, puede: [CR] -
ver vÃdeos [CR] - escuchar lecturas de revistas, canciones y melodÃas reino,
lectura de la Biblia, los dramas de audio y lecturas bÃblicas dramáticas [CR]
- Lee el texto diario y noticias</description>
<description lang="fr">Lecture directement du site www.jw.org vous
pouvez:[CR]-Regarder des vidéos[CR]- Ãcouter la lecture de revues, cantiques
et mélodies du royaume, lecture de la bible, drames audio et lectures biblique
dramatiques[CR]- Lire le texte du jour et nouvelles</description>
<description lang="fr_CA">Lecture en transit direct de www.jw.org,
vous pouvez :[CR]- Regarder des vidéos[CR]- écouter des lectures de
magazines, des chansons et mélodies du royaume, lecture de la bible, théâtre
audio et des lectures théâtralisée de la bible[CR]- Lire le texte et les
nouvelles quotidiennes.</description>
@@ -50,11 +52,11 @@
<description lang="pt_BR">Fluxo direto de www.jw.org, você pode:[CR]-
assistir vÃdeos[CR]- ouvir leitura de revistas, músicas e cantigos, leituras
da bÃblia, dramas em áudio e leituras bÃblicas dramatizadas[CR]- Ler textos
do dia e notÃcias</description>
<description lang="sv">Med direktström från www.jw.org kan du:[CR]-
se filmer[CR]- lyssna på tidningsuppläsningar, sånger och andlig musik,
bibelläsning, ljuddraman och dramatiska bibeluppläsningar[CR]- läsa den
dagliga texten och nyheter</description>
<language>af de el en es it nl pl pt pt_BR sv</language>
- <platform />
-
<website>http://wiki.xbmc.org/index.php?title=Add-on:Jw.org_audio/video_browser</website>
- <source>https://github.com/realtebo/plugin.video.jworg</source>
+ <platform></platform>
<license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
- <email>[email protected]</email>
<forum>http://forum.xbmc.org/showthread.php?tid=180407</forum>
+
<website>http://wiki.xbmc.org/index.php?title=Add-on:Jw.org_audio/video_browser</website>
+ <email>[email protected]</email>
+ <source>https://github.com/realtebo/plugin.video.jworg</source>
</extension>
</addon>
diff --git a/plugin.video.jworg/audio/jw_audio.py
b/plugin.video.jworg/audio/jw_audio.py
index 795015c..81f46ac 100644
--- a/plugin.video.jworg/audio/jw_audio.py
+++ b/plugin.video.jworg/audio/jw_audio.py
@@ -56,6 +56,7 @@ def showAudioIndex():
)
xbmcplugin.endOfDirectory(handle=jw_config.plugin_pid)
+ jw_common.setDefaultView()
# Track list
diff --git a/plugin.video.jworg/audio/jw_audio_drama.py
b/plugin.video.jworg/audio/jw_audio_drama.py
index cc8f7d5..3780ee6 100644
--- a/plugin.video.jworg/audio/jw_audio_drama.py
+++ b/plugin.video.jworg/audio/jw_audio_drama.py
@@ -54,7 +54,7 @@ def showDramaIndex(start):
handle = jw_config.plugin_pid,
url = url,
listitem = listItem,
- isFolder = True
+ isFolder = False
)
drama_num = drama_num + 1
diff --git a/plugin.video.jworg/audio/jw_audio_dramatic_reading.py
b/plugin.video.jworg/audio/jw_audio_dramatic_reading.py
index 73a4e4a..28cc81e 100644
--- a/plugin.video.jworg/audio/jw_audio_dramatic_reading.py
+++ b/plugin.video.jworg/audio/jw_audio_dramatic_reading.py
@@ -50,7 +50,7 @@ def showDramaticReadingIndex(start):
handle = jw_config.plugin_pid,
url = url,
listitem = listItem,
- isFolder = True
+ isFolder = False
)
reading_num = reading_num + 1
diff --git a/plugin.video.jworg/changelog.txt b/plugin.video.jworg/changelog.txt
index d23e2e0..172fd0a 100644
--- a/plugin.video.jworg/changelog.txt
+++ b/plugin.video.jworg/changelog.txt
@@ -1,3 +1,20 @@
+0.5.0
+-----
+
+Changes:
++ Complete rewrite of video indexing
++ Video page shows directly the video list
++ The filter function is still available, but as link on very first video list
page
++ Now every video json file info (in set of 10) will be parsed to autodetect
if it's available the default resolution choose; if yes, a playable item is
added to the list, if no a folder item is added to the list [these items are
bold and blue, to easy identify a folder item and distinguish it from playable
items]
++ Doubled the cache system for even faster item browsing: list of items is
cached for 24h, but single item json file is cached for a whole month, because
it's highly plausible it will not change anymore.
++ Added a progress bar to help user to be patient when loading video index for
first time (once per video page)
++ Enhanched fallback for video images detection; now you can play even the
some old videos that was causing crashes before of today
+
+Fix:
++ I'm happy to tell that all of this work finally fixes issue (#23) related to
"gotham" (xbmc v13).
++ Also Issue #24 is closed, now you can start plugin from shortcut on
confluence start screen.
++ Forced default view for audio menu, because of some strange differences on
gotham 13 on some android
+
0.4.3
-----
diff --git a/plugin.video.jworg/fanart.jpg b/plugin.video.jworg/fanart.jpg
index 1625dcb..076e3b8 100644
Binary files a/plugin.video.jworg/fanart.jpg and
b/plugin.video.jworg/fanart.jpg differ
diff --git a/plugin.video.jworg/jw_common.py b/plugin.video.jworg/jw_common.py
index 1184444..ae3a34f 100644
--- a/plugin.video.jworg/jw_common.py
+++ b/plugin.video.jworg/jw_common.py
@@ -67,6 +67,9 @@ def setThumbnailView() :
if jw_config.skin_used == 'skin.confluence':
xbmc.executebuiltin('Container.SetViewMode(500)')
+def setDefaultView() :
+ xbmc.executebuiltin('Container.SetViewMode(50)')
+
"""
REMOTE CONTENT LOAD
"""
@@ -83,6 +86,7 @@ def loadUrl (url):
pass
return html
+
def loadNotCachedJsonFromUrl(url, ajax):
data = ""
try:
@@ -100,9 +104,9 @@ def loadNotCachedJsonFromUrl(url, ajax):
data = json.loads(response)
except urllib2.URLError, e:
- xbmc.log ("JWORG http error", xbmc.LOGERROR)
- xbmc.log (e.code, xbmc.LOGERROR)
- xbmc.log (e.read(), xbmc.LOGERROR)
+ xbmc.log ("JWORG url error", xbmc.LOGERROR)
+ for arg in e.args :
+ print arg
pass
except urllib2.HTTPError, e:
@@ -115,10 +119,16 @@ def loadNotCachedJsonFromUrl(url, ajax):
return data
-def loadJsonFromUrl (url, ajax):
- data = jw_config.cache.cacheFunction(loadNotCachedJsonFromUrl, url,
ajax)
+
+def loadJsonFromUrl (url, ajax, month_cache = False ):
+
+ if month_cache == True :
+ data =
jw_config.cache_month.cacheFunction(loadNotCachedJsonFromUrl, url, ajax)
+ else :
+ data = jw_config.cache.cacheFunction(loadNotCachedJsonFromUrl,
url, ajax)
return data
+
"""
URL HELPER
"""
diff --git a/plugin.video.jworg/jw_config.py b/plugin.video.jworg/jw_config.py
index f0e6e22..35499e0 100644
--- a/plugin.video.jworg/jw_config.py
+++ b/plugin.video.jworg/jw_config.py
@@ -300,7 +300,9 @@ try:
except:
from resources.lib import storageserverdummy as StorageServer
-cache = StorageServer.StorageServer(plugin_name, 24) # 2
hour cache
+cache = StorageServer.StorageServer(plugin_name, 24) # 24
hour cache
+cache_month = StorageServer.StorageServer(plugin_name + "month",
24*30) # 30 days cache
+
audio_sorting = str(int(addon.getSetting("audio_sorting")) + 1)
video_sorting = str(int(addon.getSetting("video_sorting")) + 1)
diff --git a/plugin.video.jworg/program/jw_exec_activity.py
b/plugin.video.jworg/program/jw_exec_activity.py
index ff7dc36..8b946de 100644
--- a/plugin.video.jworg/program/jw_exec_activity.py
+++ b/plugin.video.jworg/program/jw_exec_activity.py
@@ -108,7 +108,7 @@ def showActivitySection(url):
handle = jw_config.plugin_pid,
url = url,
listitem = listItem,
- isFolder = True
+ isFolder = False
)
xbmcplugin.endOfDirectory(handle=jw_config.plugin_pid)
diff --git a/plugin.video.jworg/program/jw_exec_daily_text.py
b/plugin.video.jworg/program/jw_exec_daily_text.py
index 19e9ecb..889ae3e 100644
--- a/plugin.video.jworg/program/jw_exec_daily_text.py
+++ b/plugin.video.jworg/program/jw_exec_daily_text.py
@@ -28,7 +28,7 @@ def showDailyText(date):
dialog.customInit(text)
dialog.doModal()
del dialog
- xbmc.executebuiltin('Action("back")')
+
# Window showing daily text
diff --git a/plugin.video.jworg/program/jw_exec_index.py
b/plugin.video.jworg/program/jw_exec_index.py
index d61b3f4..f103a0f 100644
--- a/plugin.video.jworg/program/jw_exec_index.py
+++ b/plugin.video.jworg/program/jw_exec_index.py
@@ -28,7 +28,7 @@ def showExecIndex():
handle = jw_config.plugin_pid,
url = url,
listitem = listItem,
- isFolder = True
+ isFolder = False
)
# 2. Week program
@@ -44,7 +44,7 @@ def showExecIndex():
handle = jw_config.plugin_pid,
url = url,
listitem = listItem,
- isFolder = True
+ isFolder = False
)
# 3. News
diff --git a/plugin.video.jworg/program/jw_exec_news.py
b/plugin.video.jworg/program/jw_exec_news.py
index 2ba1088..e6917af 100644
--- a/plugin.video.jworg/program/jw_exec_news.py
+++ b/plugin.video.jworg/program/jw_exec_news.py
@@ -53,7 +53,7 @@ def showNewsIndex():
handle = jw_config.plugin_pid,
url = url,
listitem = listItem,
- isFolder = True
+ isFolder = False
)
count = count + 1
@@ -69,8 +69,6 @@ def showNewsPage(url):
new.customInit(html)
new.doModal()
del new
- xbmc.executebuiltin('Action("back")')
-
# Window showing news text
diff --git a/plugin.video.jworg/program/jw_exec_week_program.py
b/plugin.video.jworg/program/jw_exec_week_program.py
index 25245ac..7f989cf 100644
--- a/plugin.video.jworg/program/jw_exec_week_program.py
+++ b/plugin.video.jworg/program/jw_exec_week_program.py
@@ -32,8 +32,6 @@ def showWeekProgram(date):
dialog.doModal()
del dialog
- xbmc.executebuiltin('Action("back")')
-
# Window showing daily text
class WeekProgram(xbmcgui.WindowDialog):
diff --git a/plugin.video.jworg/resources/language/English/strings.po
b/plugin.video.jworg/resources/language/English/strings.po
index aad8fc8..5de1be5 100644
--- a/plugin.video.jworg/resources/language/English/strings.po
+++ b/plugin.video.jworg/resources/language/English/strings.po
@@ -196,3 +196,43 @@ msgstr ""
msgctxt "#30040"
msgid "Video in sign language"
msgstr ""
+
+#. Link to video filter page
+msgctxt "#30041"
+msgid "Filter by topic"
+msgstr ""
+
+#. Progress bar title
+msgctxt "#30042"
+msgid "Loading video list"
+msgstr ""
+
+#. Progress bar row 1
+msgctxt "#30043"
+msgid "Reading video infos, please wait."
+msgstr ""
+
+#. Progress bar row 2
+msgctxt "#30044"
+msgid "This helps video list browsing."
+msgstr ""
+
+#. Progress bar row 3 - It's like "Video 9 out of 10"
+msgctxt "#30045"
+msgid "Video {0} out of {1}"
+msgstr ""
+
+# Use the same string used in main screen
+msgctxt "#30046"
+msgid "Videos"
+msgstr ""
+
+# Use the same string used in main screen
+msgctxt "#30047"
+msgid "Music"
+msgstr ""
+
+# Use the same string used in main screen
+msgctxt "#30048"
+msgid "Programs"
+msgstr ""
\ No newline at end of file
diff --git a/plugin.video.jworg/resources/lib/empty_cache.py
b/plugin.video.jworg/resources/lib/empty_cache.py
index 76249e5..3a1d66c 100644
--- a/plugin.video.jworg/resources/lib/empty_cache.py
+++ b/plugin.video.jworg/resources/lib/empty_cache.py
@@ -11,6 +11,8 @@ except:
cache = StorageServer.StorageServer("plugin://plugin.video.jworg/", 24)
cache.delete("%")
+cache_month = StorageServer.StorageServer("plugin://plugin.video.jworg/" +
"month", 24 * 7)
+cache_month.delete("%")
dialog = xbmcgui.Dialog()
diff --git a/plugin.video.jworg/video/jw_sign.py
b/plugin.video.jworg/video/jw_sign.py
index a4d1955..4d4dfb9 100644
--- a/plugin.video.jworg/video/jw_sign.py
+++ b/plugin.video.jworg/video/jw_sign.py
@@ -222,6 +222,15 @@ def showVideoCategorySpecificIssue(category_url, thumb,
pub_title_index) :
except :
continue
+ res_found = searchResolution(category_url, row_index)
+
+ if res_found == False :
+ chapter_title = "[COLOR=blue][B]" +
chapter_title + "[/B][/COLOR]"
+ is_folder = True
+ else :
+ chapter_title = chapter_title + " [" +
res_found + "]"
+ is_folder = False
+
listItem = xbmcgui.ListItem(
label = chapter_title,
thumbnailImage = thumb
@@ -236,21 +245,75 @@ def showVideoCategorySpecificIssue(category_url, thumb,
pub_title_index) :
}
url = jw_config.plugin_name + '?' +
urllib.urlencode(params)
+
xbmcplugin.addDirectoryItem(
- handle = jw_config.plugin_pid,
- url = url,
- listitem = listItem,
- isFolder = True
- )
-
+ handle = jw_config.plugin_pid,
+ url = url,
+ listitem = listItem,
+ isFolder = is_folder
+ )
+
xbmcplugin.endOfDirectory(handle=jw_config.plugin_pid)
+# very similar to showVideoCategorySpecificRow
+# return a boolean false or found resolution
+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;
+
+ row_index = int(row_index) #because it's a string actually !
+ html = jw_common.loadUrl(category_url)
+ soup = BeautifulSoup(html)
+
+ row = soup.findAll('tr')[row_index]
+
+ row_cells = row.findAll("td")
+
+ start_cell = 2 # zero-base indexing
+ first_cell_class = row.findAll("td")[0]["class"]
+ if first_cell_class == "calign":
+ start_cell = 3
+
+ video_dict = {}
+
+ cell_index = -1
+ for cell in row_cells :
+ cell_index = cell_index + 1
+ if cell_index == (start_cell -1):
+ article_title =
jw_common.cleanUpText(cell.contents[0].encode("utf-8"))
+
+ if cell_index >= start_cell :
+
+ # This is needed for resolution cell empty
+ if cell.find("a") is None :
+ continue
+
+ video_src = cell.find("a").get("href")
+ video_quality =
cell.find("a").contents[0].encode("utf-8")
+
+ video_dict [ video_quality ] = video_src
+
+ # Look for choosen resolution
+ max_resolution_string = max_resolution + "p"
+
+ keys = sorted(list(video_dict.keys()), reverse=True)
+ for key in keys :
+ if (key <= max_resolution_string ) :
+ return key;
+
+ # If am here, I surely have NOT the default resolution found
+ return False;
+
+
# Get the list of playable item (a list of video resolution and title)
# from a specific row of the page
def showVideoCategorySpecificRow(category_url, thumb, row_index) :
- row_index = int(row_index) #because it's a string actually !
+ row_index = int(row_index) #because it's a string actually !
html = jw_common.loadUrl(category_url)
soup = BeautifulSoup(html)
diff --git a/plugin.video.jworg/video/jw_video.py
b/plugin.video.jworg/video/jw_video.py
index c54d91e..63eb2b5 100644
--- a/plugin.video.jworg/video/jw_video.py
+++ b/plugin.video.jworg/video/jw_video.py
@@ -7,6 +7,7 @@ import xbmc
import xbmcplugin
import xbmcgui
+from BeautifulSoup import BeautifulSoup
import re
import urllib
@@ -43,24 +44,6 @@ def showVideoFilter():
isFolder = True
)
- # Sign language link
- sign_index = jw_config.const[language]["sign_index"]
- if sign_index != False :
-
- title = jw_common.t(30040)
- listItem = xbmcgui.ListItem( title )
- params = {
- 'content_type' : 'video',
- 'mode' : "open_sign_index",
- }
- url = jw_config.plugin_name + '?' + urllib.urlencode(params)
- xbmcplugin.addDirectoryItem(
- handle = jw_config.plugin_pid,
- url = url,
- listitem = listItem,
- isFolder = True
- )
-
xbmcplugin.endOfDirectory(handle=jw_config.plugin_pid)
@@ -70,16 +53,36 @@ def showVideoIndex(start, video_filter):
language = jw_config.language
url = jw_common.getUrl(language) +
jw_config.const[language]["video_path"] + "/?start=" + str(start) +
"&videoFilter=" + video_filter + "&sortBy=" + jw_config.video_sorting
html = jw_common.loadUrl (url)
- max_resolution = xbmcplugin.getSetting(jw_config.plugin_pid,
"max_resolution")
+
+ # I mix two method to patch quick and dirty. One day I'll cleanup
+ soup = BeautifulSoup(html)
+ index_list = soup.findAll("div", { "id" : 'videosIndexList' })
+ boxes = index_list[0].findAll("div", { "class" :
re.compile(r'\bmixDesc\b') }, recursive=False)
+
+ count = 0
+ posters = {}
+
+ # Scraping for video images
+ for box in boxes :
+ img = box.find("span", {"class" : 'jsRespImg' })
+ if img is None :
+ img = box.find("img")
+ if img is None :
+ posters[count] = None
+ else :
+ posters[count] = img.get('src')
+ else :
+ posters[count] = img.get('data-img-size-lg')
+ if posters[count] is None :
+ posters[count] = img.get('data-img-size-md')
+
+ count = count + 1
+
# Grep video titles
regexp_video_title = 'data-onpagetitle="([^"]+)"'
videos = re.findall(regexp_video_title, html)
- # Grep poster of video
- regexp_video_poster = 'data-img-size-md=["\']([^"\']+)["\']'
- posters = re.findall(regexp_video_poster, html)
-
# Grep url of json wich contain data on different version of the video
[240,360, etc..]
regexp_video_json = '.*[^"] data-jsonurl="([^"]+)".*'
video_json = re.findall(regexp_video_json, html)
@@ -91,28 +94,69 @@ def showVideoIndex(start, video_filter):
count = 0
+ total = len(videos)
+
+ progress = xbmcgui.DialogProgress()
+ progress.create(jw_common.t(30042), jw_common.t(30043),
jw_common.t(30044) )
+
# Output video list
for title in videos:
+ if posters[count] is None :
+ count = count + 1
+ continue;
+
+ json_url = video_json[count]
+
+ # if video has a video in default resolution
+ # the url will be a playable item
+ # otherwise it will be a xbmc folder url
+ setVideoUrl(title, json_url, posters[count])
+
+ count = count + 1
+ percent = float(count) / float(total) * 100
+ message = jw_common.t(30045).format(count, total)
+ progress.update( int(percent), "", "", message)
+
+ if progress.iscanceled():
+ break
+
+ progress.close()
+
+ # if it's the first page, I show the 'filter'
+ if start == 0 :
listItem = xbmcgui.ListItem(
- label = title,
- thumbnailImage = posters[count]
+ label = jw_common.t(30041)
)
- json_url = video_json[count]
params = {
"content_type" : "video",
- "mode" : "open_json_video",
- "json_url" : json_url,
- "thumb" : posters[count]
+ "mode" : "open_video_filter",
}
url = jw_config.plugin_name + '?' + urllib.urlencode(params)
xbmcplugin.addDirectoryItem(
- handle=jw_config.plugin_pid,
- url=url,
- listitem=listItem,
- isFolder=True
- )
- count = count + 1
+ handle = jw_config.plugin_pid,
+ url = url,
+ listitem = listItem,
+ isFolder = True
+ )
+
+ # Sign language link
+ sign_index = jw_config.const[language]["sign_index"]
+ if sign_index != False :
+
+ title = jw_common.t(30040)
+ listItem = xbmcgui.ListItem( title )
+ params = {
+ 'content_type' : 'video',
+ 'mode' : "open_sign_index",
+ }
+ url = jw_config.plugin_name + '?' +
urllib.urlencode(params)
+ xbmcplugin.addDirectoryItem(
+ handle = jw_config.plugin_pid,
+ url = url,
+ listitem = listItem,
+ isFolder = True
+ )
jw_common.setNextPageLink(html, "open_video_index", "video",
"video_filter", video_filter)
@@ -120,6 +164,118 @@ def showVideoIndex(start, video_filter):
jw_common.setThumbnailView()
+def setVideoUrl(main_video_title, json_url, thumb) :
+ language = jw_config.language
+ json_url = "http://www.jw.org" + json_url
+ json = jw_common.loadJsonFromUrl(url = json_url,
ajax = False, month_cache = True)
+
+ max_resolution =
xbmcplugin.getSetting(jw_config.plugin_pid, "max_resolution")
+ max_resolution_string = max_resolution + "p"
+
+ # json equals to [] when a cached json was empty
+ if json is None or json == [] :
+ string = jw_common.t(30033) + " "
+ xbmcgui.Dialog().ok("Jw.org audio/video browser", string)
+ return
+
+ language_code = jw_config.const[language]["lang_code"]
+
+ # Case: "Bible from Japan" Video
+ # No speak, so no language, so only one "" entry suitable for every
language
+ if len(json["languages"]) == 0:
+ language_code = ""
+
+ try :
+ temp = json["files"][language_code]
+ except :
+ language_code = "univ"
+ pass
+
+ video_dict = {}
+ for mp4 in json["files"][language_code]["MP4"]:
+ res = mp4["label"]
+ url_to_play = mp4["file"]["url"]
+ mp4_title_cleaned = jw_common.cleanUpText (mp4["title"])
+ title = mp4_title_cleaned + " [" +
res + "]"
+
+ if mp4_title_cleaned not in video_dict :
+ video_dict[mp4_title_cleaned] = {}
+
+ if res not in video_dict[mp4_title_cleaned] :
+ video_dict[mp4_title_cleaned][res] = {}
+
+ video_dict[mp4_title_cleaned][res] = {"title" : title,
"full_title" : mp4_title_cleaned, "url" : url_to_play, "resolution" : res }
+
+ if max_resolution == '0' :
+ addVideoFolderItem(main_video_title, json_url, thumb )
+ return
+
+ if (len(video_dict) ==1) :
+ # good, only one video title
+ if max_resolution_string in video_dict[mp4_title_cleaned] :
+ # max resolution available !
+
addPlayableItem(video_dict[mp4_title_cleaned][max_resolution_string], thumb )
+ else :
+ # look max resolution available under the choosen one
+ for available_res in video_dict[mp4_title_cleaned] :
+ if available_res < max_resolution_string :
+
addPlayableItem(video_dict[mp4_title_cleaned][available_res], thumb )
+ break
+ else :
+ # more then one video related to this title - show the list
+ addVideoFolderItem(main_video_title, json_url, thumb )
+
+ return
+
+# helper
+def addVideoFolderItem(main_video_title, json_url, thumb) :
+
+ listItem = xbmcgui.ListItem(
+ label = "[COLOR blue][B]"
+ + main_video_title
+ +"[/B][/COLOR]",
+ thumbnailImage = thumb
+ )
+
+ params = {
+ "content_type" : "video",
+ "mode" : "open_json_video",
+ "json_url" : json_url,
+ "thumb" : thumb
+ }
+ url = jw_config.plugin_name + '?' + urllib.urlencode(params)
+ xbmcplugin.addDirectoryItem(
+ handle = jw_config.plugin_pid,
+ url = url,
+ listitem = listItem,
+ isFolder = True
+ )
+
+
+# helper
+def addPlayableItem(video_data, thumb) :
+
+ title = video_data["title"]
+ mp4_title_cleaned = video_data["full_title"]
+ url = video_data["url"]
+
+ listItem = xbmcgui.ListItem(
+ label = title,
+ thumbnailImage = thumb
+ )
+ listItem.setInfo(
+ type = 'Video',
+ infoLabels = {'Title': mp4_title_cleaned}
+ )
+ listItem.setProperty("IsPlayable","true")
+
+ xbmcplugin.addDirectoryItem(
+ handle = jw_config.plugin_pid,
+ url = url,
+ listitem = listItem,
+ isFolder = False
+ )
+
# show available resolutions for a video (ed eventually other related titles,
like interviews, etc.)
# v 0.4.0: if user choose a default max resolution, it will be used (or the
highest under it if not
@@ -127,8 +283,8 @@ def showVideoIndex(start, video_filter):
def showVideoJsonUrl(json_url, thumb):
language = jw_config.language
- json_url = "http://www.jw.org" + json_url
- json = jw_common.loadJsonFromUrl(url = json_url,
ajax = False)
+ json_url = json_url
+ json = jw_common.loadJsonFromUrl(url = json_url,
ajax = False, month_cache = True)
max_resolution = xbmcplugin.getSetting(jw_config.plugin_pid,
"max_resolution")
# json equals to [] when a cached json was empty
@@ -232,3 +388,4 @@ def showVideoJsonUrl(json_url, thumb):
xbmcplugin.endOfDirectory(handle=jw_config.plugin_pid)
+
-----------------------------------------------------------------------
Summary of changes:
plugin.video.jworg/addon.py | 15 ++-
plugin.video.jworg/addon.xml | 12 +-
plugin.video.jworg/audio/jw_audio.py | 1 +
plugin.video.jworg/audio/jw_audio_drama.py | 2 +-
.../audio/jw_audio_dramatic_reading.py | 2 +-
plugin.video.jworg/changelog.txt | 17 ++
plugin.video.jworg/fanart.jpg | Bin 82047 -> 91688 bytes
.../generic}/__init__.py | 0
plugin.video.jworg/generic/jw_menu.py | 55 +++++
plugin.video.jworg/jw_common.py | 20 ++-
plugin.video.jworg/jw_config.py | 4 +-
plugin.video.jworg/program/jw_exec_activity.py | 2 +-
plugin.video.jworg/program/jw_exec_daily_text.py | 2 +-
plugin.video.jworg/program/jw_exec_index.py | 4 +-
plugin.video.jworg/program/jw_exec_news.py | 4 +-
plugin.video.jworg/program/jw_exec_week_program.py | 2 -
.../language/{Georgian => Azerbaijani}/strings.po | 10 +-
.../{Swedish => English (New Zealand)}/strings.po | 66 +++---
.../resources/language/English/strings.po | 40 ++++
plugin.video.jworg/resources/lib/empty_cache.py | 2 +
plugin.video.jworg/video/jw_sign.py | 77 ++++++-
plugin.video.jworg/video/jw_video.py | 231 ++++++++++++++++---
22 files changed, 463 insertions(+), 105 deletions(-)
copy {plugin.audio.abcradionational/resources =>
plugin.video.jworg/generic}/__init__.py (100%)
create mode 100644 plugin.video.jworg/generic/jw_menu.py
copy plugin.video.jworg/resources/language/{Georgian =>
Azerbaijani}/strings.po (74%)
copy plugin.video.jworg/resources/language/{Swedish => English (New
Zealand)}/strings.po (67%)
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons