The branch, frodo has been updated
       via  bd27e1e982473c02279509591350c4fdf0f1ec39 (commit)
       via  a6d90fa74c3949d1a4d56fc984004d15135d8078 (commit)
      from  178bf16f8b1e966b9adc7c668c04619e63c5734b (commit)

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

commit bd27e1e982473c02279509591350c4fdf0f1ec39
Author: sphere <[email protected]>
Date:   Tue Mar 25 23:10:17 2014 +0100

    [plugin.video.jworg] updated to version 0.4.3

diff --git a/plugin.video.jworg/addon.xml b/plugin.video.jworg/addon.xml
index f85dd97..5ab0732 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.2" 
+    version="0.4.3" 
     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 708ef7a..7033212 100644
--- a/plugin.video.jworg/audio/jw_audio_bible.py
+++ b/plugin.video.jworg/audio/jw_audio_bible.py
@@ -4,6 +4,7 @@ AUDIO BIBLE RELATED FUNCTION
 import xbmcgui
 import xbmcplugin
 
+from BeautifulSoup import BeautifulSoup 
 import urllib
 import re
 
@@ -18,21 +19,25 @@ def showAudioBibleIndex():
        bible_index_url = jw_common.getUrl(language) + 
jw_config.const[language]["bible_index_audio"]
        html                    = jw_common.loadUrl(bible_index_url) 
        
-       # Grep book names
-       regexp_book_names = '<a>([^<]+)</a>'
-       book_names = re.findall(regexp_book_names, html)        
+       soup            = BeautifulSoup(html)
 
-       # Grep bible cover image
-       regexp_cover = "data-img-size-md='([^']+)'"
-       bible_cover = re.findall(regexp_cover, html)
-       cover_img_url = bible_cover[0]
+       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');
+
+       boxes   = soup.findAll('li',{"class": re.compile(r'\bbookName\b')})
 
        book_num = 0
-       for book in book_names:
-               book_num = book_num + 1
+       for box in boxes :
+               book_num = book_num +1
+               
+               anchors =box.findAll('a')
+
+               book_name = anchors[0].contents[0]
+
                listItem        = xbmcgui.ListItem(
-                       label                   = book_names[book_num -1] ,
-                       thumbnailImage  = cover_img_url
+                       label                   = book_name,
+                       thumbnailImage  = img_url
                )       
                params          = {
                        "content_type"  : "audio", 
diff --git a/plugin.video.jworg/changelog.txt b/plugin.video.jworg/changelog.txt
index 8667da7..d23e2e0 100644
--- a/plugin.video.jworg/changelog.txt
+++ b/plugin.video.jworg/changelog.txt
@@ -1,3 +1,15 @@
+0.4.3
+-----
+
+Fix:
++ Updated to react to jw.org website changes
+
+Code:
++ Switched to BeautifulSoup 3 another portion of code;
+
+Known Issues:
++ With Gotham (13), you must set default video resolution to zero, otherwise a 
useless alert box will appear when default resolution video is played 
automatically; I'm still working on this
+
 0.4.2
 -----
 

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

commit a6d90fa74c3949d1a4d56fc984004d15135d8078
Author: sphere <[email protected]>
Date:   Tue Mar 25 22:58:46 2014 +0100

    [plugin.video.ted.talks] updated to version 4.2.3

diff --git a/plugin.video.ted.talks/addon.xml b/plugin.video.ted.talks/addon.xml
index cdef66a..65c2300 100644
--- a/plugin.video.ted.talks/addon.xml
+++ b/plugin.video.ted.talks/addon.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.ted.talks" name="TED Talks" version="4.2.2" 
provider-name="rwparris2, moreginger">
+<addon id="plugin.video.ted.talks" name="TED Talks" version="4.2.3" 
provider-name="rwparris2, moreginger">
   <requires>
     <import addon="xbmc.python" version="2.1.0"/>
     <import addon="script.module.elementtree" version="1.2.7"/>
diff --git a/plugin.video.ted.talks/changelog.txt 
b/plugin.video.ted.talks/changelog.txt
index dbafaa4..e7ea746 100644
--- a/plugin.video.ted.talks/changelog.txt
+++ b/plugin.video.ted.talks/changelog.txt
@@ -1,5 +1,8 @@
+[B]Version 4.2.3[/B]
+Fix workaround for newest talks with Python <2.7 [issue#41]
+
 [B]Version 4.2.2[/B]
-Fix botched removal of User module (issue#47)
+Fix issue that stopped plugin loading (issue#47)
 
 [B]Version 4.2.1[/B]
 Fix speakers (issue#45)
diff --git a/plugin.video.ted.talks/resources/lib/model/rss_scraper.py 
b/plugin.video.ted.talks/resources/lib/model/rss_scraper.py
index e4ab7df..0e2ebf8 100644
--- a/plugin.video.ted.talks/resources/lib/model/rss_scraper.py
+++ b/plugin.video.ted.talks/resources/lib/model/rss_scraper.py
@@ -6,17 +6,8 @@ so keep it for now.
 
 import urllib2
 import time
-from datetime import timedelta
-try:
-    timedelta.total_seconds
-except AttributeError:
-    # People still using Python <2.7 201303 :(
-    # Cleverness from 
http://stackoverflow.com/questions/3318348/how-can-i-extend-pythons-datetime-datetime-with-my-own-methods/14214646#14214646
-    def total_seconds(td):
-        return float((td.microseconds + (td.seconds + td.days * 24 * 3600) * 
10 ** 6)) / 10 ** 6
-    d = _get_dict(timedelta)[0]
-    d['total_seconds'] = total_seconds
 
+from datetime import timedelta
 try:
     from elementtree.ElementTree import fromstring
 except ImportError:
@@ -50,7 +41,7 @@ class NewTalksRss:
         pic = 
item.find('./{http://search.yahoo.com/mrss/}thumbnail').get('url')
         duration = 
item.find('./{http://www.itunes.com/dtds/podcast-1.0.dtd}duration').text
         duration = time.strptime(duration, '%H:%M:%S')
-        duration_seconds = timedelta(hours=duration.tm_hour, 
minutes=duration.tm_min, seconds=duration.tm_sec).total_seconds()
+        duration_seconds = 
self.__total_seconds__(timedelta(hours=duration.tm_hour, 
minutes=duration.tm_min, seconds=duration.tm_sec))
         plot = 
item.find('./{http://www.itunes.com/dtds/podcast-1.0.dtd}summary').text
         link = item.find('./link').text
 
@@ -65,6 +56,13 @@ class NewTalksRss:
 
         return {'title':title, 'author':author, 'thumb':pic, 'plot':plot, 
'duration':duration_seconds, 'date':date, 'link':link}
 
+    def __total_seconds__(self, delta):
+        try:
+            return delta.total_seconds()
+        except AttributeError:
+            # People still using Python <2.7 201303 :(
+            return float((delta.microseconds + (delta.seconds + delta.days * 
24 * 3600) * 10 ** 6)) / 10 ** 6
+
     def get_new_talks(self):
         """
         Returns talks as dicts {title:, author:, thumb:, date:, duration:, 
link:}.
diff --git a/plugin.video.ted.talks/resources/lib/model/rss_scraper_test.py 
b/plugin.video.ted.talks/resources/lib/model/rss_scraper_test.py
index a4f43e3..2ab9ee7 100644
--- a/plugin.video.ted.talks/resources/lib/model/rss_scraper_test.py
+++ b/plugin.video.ted.talks/resources/lib/model/rss_scraper_test.py
@@ -59,4 +59,3 @@ class TestNewTalksRss(unittest.TestCase):
         self.assertIsNotNone(talk['title'])
         self.assertIsNotNone(talk['plot'])
         self.assertIsNotNone(talk['duration'])
-
diff --git a/plugin.video.ted.talks/resources/lib/model/search_scraper.py 
b/plugin.video.ted.talks/resources/lib/model/search_scraper.py
index 4c21732..331c8a4 100644
--- a/plugin.video.ted.talks/resources/lib/model/search_scraper.py
+++ b/plugin.video.ted.talks/resources/lib/model/search_scraper.py
@@ -3,6 +3,7 @@ from url_constants import URLTED, URLSEARCH
 # Custom xbmc thing for fast parsing. Can't rely on lxml being available as of 
2012-03.
 import CommonFunctions as xbmc_common
 import re
+import HTMLParser
 
 __results_count_re__ = re.compile(r'.*\d+ - (\d+) of (\d+) results.*')
 __result_count_re__ = re.compile(r'.*\d+ +results?.*')  # Two spaces at the 
moment i.e. "1  result"
@@ -26,9 +27,10 @@ class Search:
 
         results = xbmc_common.parseDOM(html, 'article', {'class': 'm1 
search__result'})
 
+        html_parser = HTMLParser.HTMLParser()
         for result in results:
             header = xbmc_common.parseDOM(result, 'h3')[0]
-            title = xbmc_common.parseDOM(header, 'a')[0].strip()
+            title = html_parser.unescape(xbmc_common.parseDOM(header, 
'a')[0].strip())
             url = URLTED + xbmc_common.parseDOM(header, 'a', ret='href')[0]
             img = xbmc_common.parseDOM(result, 'img', ret='src')[0]
             yield title, url, img
diff --git a/plugin.video.ted.talks/resources/lib/model/search_scraper_test.py 
b/plugin.video.ted.talks/resources/lib/model/search_scraper_test.py
index 727a730..d025716 100644
--- a/plugin.video.ted.talks/resources/lib/model/search_scraper_test.py
+++ b/plugin.video.ted.talks/resources/lib/model/search_scraper_test.py
@@ -27,6 +27,12 @@ class TestSearchScraper(unittest.TestCase):
         self.assertEqual(0, remaining_talks)
         self.assertLess(0, len(talks))
 
+    def test_get_talks_for_search_decodes_entities(self):
+        scraper = Search(test_util.get_HTML)
+        talks_generator = scraper.get_talks_for_search('Onora', 1)
+        timeit.itertools.islice(talks_generator, 1).next()
+        self.assertTrue("Onora O'Neill: What we don't understand about trust" 
in [t[0] for t in list(talks_generator)])  # "'" is encoded so we need to 
decode it
+
     def test_search_for_speaker_name(self):
         scraper = Search(test_util.get_HTML)
         talks_generator = scraper.get_talks_for_search('Christopher Soghoian', 
1)  # Random name I haven't heard of
diff --git a/plugin.video.ted.talks/resources/lib/plugin.py 
b/plugin.video.ted.talks/resources/lib/plugin.py
index 2291182..2ec3403 100644
--- a/plugin.video.ted.talks/resources/lib/plugin.py
+++ b/plugin.video.ted.talks/resources/lib/plugin.py
@@ -1,6 +1,8 @@
 """
 Contains constants that we initialize to the correct values at runtime.
 """
+import sys
+
 __plugin__ = "TED Talks Uninitialized Plugin"
 getLS = lambda x: x
 __pluginLS__ = __plugin__
@@ -20,7 +22,7 @@ def init():
     __author__ = addon.getAddonInfo('author')
     __version__ = addon.getAddonInfo('version')
     import xbmc
-    xbmc.log("[PLUGIN] '%s: version %s' initialized!" % (__plugin__, 
__version__), level=xbmc.LOGERROR)
+    xbmc.log("[PLUGIN] Initialized %s v%s using Python: %s'" % (__plugin__, 
__version__, sys.version), level=xbmc.LOGNOTICE)
 
 def report(gnarly_message, friendly_message=None):
     import xbmc

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

Summary of changes:
 plugin.video.jworg/addon.xml                       |    2 +-
 plugin.video.jworg/audio/jw_audio_bible.py         |   27 +++++++++++--------
 plugin.video.jworg/changelog.txt                   |   12 +++++++++
 plugin.video.ted.talks/addon.xml                   |    2 +-
 plugin.video.ted.talks/changelog.txt               |    5 +++-
 .../resources/lib/model/rss_scraper.py             |   20 ++++++--------
 .../resources/lib/model/rss_scraper_test.py        |    1 -
 .../resources/lib/model/search_scraper.py          |    4 ++-
 .../resources/lib/model/search_scraper_test.py     |    6 ++++
 plugin.video.ted.talks/resources/lib/plugin.py     |    4 ++-
 10 files changed, 55 insertions(+), 28 deletions(-)


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to