The branch, eden has been updated
       via  fee2353712c77cde63e2469e66eb09a0d49cc238 (commit)
       via  ef04114d317c540e2fa62d015b83950bf4dabb88 (commit)
      from  16b1e2c6c5ef724cea7b563e8b619dd87d47aed6 (commit)

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

commit fee2353712c77cde63e2469e66eb09a0d49cc238
Author: spiff <[email protected]>
Date:   Mon Oct 15 10:36:23 2012 +0200

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

diff --git a/plugin.video.ted.talks/addon.xml b/plugin.video.ted.talks/addon.xml
index 53dd750..1d5424e 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="3.1.4" 
provider-name="rwparris2, moreginger">
+<addon id="plugin.video.ted.talks" name="TED Talks" version="3.1.5" 
provider-name="rwparris2, moreginger">
   <requires>
     <import addon="xbmc.python" version="2.0"/>
     <import addon="script.module.simplejson" version="2.0.10"/>
diff --git a/plugin.video.ted.talks/changelog.txt 
b/plugin.video.ted.talks/changelog.txt
index 3aeb29d..4a387c0 100644
--- a/plugin.video.ted.talks/changelog.txt
+++ b/plugin.video.ted.talks/changelog.txt
@@ -1,3 +1,7 @@
+[B]Version 3.1.5[/B]
+Fix subtitles (issue#29)
+Fix for listItem API change in XBMC on Raspberry Pi builds and/or Frodo 
(issue#28)
+
 [B]Version 3.1.4[/B]
 Respect order of custom language codes when fetching subtitles (issue#26)
 Allow subtitles to be disabled (issue#27)
diff --git a/plugin.video.ted.talks/resources/lib/model/subtitles_scraper.py 
b/plugin.video.ted.talks/resources/lib/model/subtitles_scraper.py
index 4959081..c2b8aa4 100644
--- a/plugin.video.ted.talks/resources/lib/model/subtitles_scraper.py
+++ b/plugin.video.ted.talks/resources/lib/model/subtitles_scraper.py
@@ -9,6 +9,8 @@ import urllib
 import re
 
 __friendly_message__ = 'Error showing subtitles'
+__talkIdKey__ = 'talkId'
+__introDurationKey__ = 'introDuration'
 
 def format_time(time):
     millis = time % 1000
@@ -41,19 +43,29 @@ def get_flashvars(soup):
     Blow up if we can't find it or if we fail to parse.
     returns dict of values, no guarantees are made about which values are 
present.
     '''
-    input_tag = soup.find('input', id='embedthisvideo')
+    input_tag = soup.find('script', type='text/javascript', 
text=re.compile('var flashVars'))
     if not input_tag:
-        raise Exception('Could not find flashVars')
-    value = urllib.unquote(input_tag['value'])
-    # Appears to be XML with tags escaped, but can't parse because
-    # has text content which is single-escaped and then won't parse. Weird.
-    flashvar_re = re.compile('^<param name="flashvars" value="(.+)" />$', 
re.MULTILINE)
-    flashvar_match = flashvar_re.search(value)
+        raise Exception('Could not find flashVars container')
+
+    flashvar_re = re.compile('var flashVars = \{([^}]+)\}', re.MULTILINE)
+    flashvar_match = flashvar_re.search(input_tag.string)
+
     if not flashvar_match:
-        raise Exception('Could not find flashVars')
-    flashvars = 
urllib.unquote(flashvar_match.group(1)).encode('ascii').split('&')
+        raise Exception('Could not get flashVars')
+
+    talkId_re = re.compile('"%s":(\d+)' % (__talkIdKey__))
+    introDuration_re = re.compile('"%s":(\d+)' % (__introDurationKey__))
+    flashvars = urllib.unquote(flashvar_match.group(1).encode('ascii'))
+
+    talkId_match = talkId_re.search(flashvars)
+    if not talkId_match:
+        raise Exception('Could not get talk ID')
+
+    introDuration_match = introDuration_re.search(flashvars)
+    if not introDuration_match:
+        raise Exception('Could not get intro duration')
 
-    return dict([(v[0], v[1]) for v in [v.split('=') for v in flashvars]])
+    return {__talkIdKey__ : talkId_match.group(1), __introDurationKey__ : 
introDuration_match.group(1)}
 
 def get_subtitles(talk_id, language):
     url = 'http://www.ted.com/talks/subtitles/id/%s/lang/%s' % (talk_id, 
language)
@@ -81,10 +93,10 @@ def get_subtitles_for_talk(talk_soup, accepted_languages, 
logger):
         logger('Could not display subtitles: %s' % (e), __friendly_message__)
         return None
 
-    if 'ti' not in flashvars:
+    if __talkIdKey__ not in flashvars:
         logger('Could not determine talk ID for subtitles.', 
__friendly_message__)
         return None
-    if 'introDuration' not in flashvars:
+    if __introDurationKey__ not in flashvars:
         logger('Could not determine intro duration for subtitles.', 
__friendly_message__)
         return None
 
@@ -103,5 +115,5 @@ def get_subtitles_for_talk(talk_soup, accepted_languages, 
logger):
         logger(msg, msg)
         return None
 
-    raw_subtitles = get_subtitles(flashvars['ti'], matches[0])
-    return format_subtitles(raw_subtitles, int(flashvars['introDuration']))
+    raw_subtitles = get_subtitles(flashvars[__talkIdKey__], matches[0])
+    return format_subtitles(raw_subtitles, 
int(flashvars[__introDurationKey__]) * 1000)
diff --git 
a/plugin.video.ted.talks/resources/lib/model/subtitles_scraper_test.py 
b/plugin.video.ted.talks/resources/lib/model/subtitles_scraper_test.py
index 9735966..5af783c 100644
--- a/plugin.video.ted.talks/resources/lib/model/subtitles_scraper_test.py
+++ b/plugin.video.ted.talks/resources/lib/model/subtitles_scraper_test.py
@@ -44,15 +44,19 @@ World
         soup = 
MinimalSoup(urllib.urlopen('http://www.ted.com/talks/richard_wilkinson.html').read())
         flashvars = subtitles_scraper.get_flashvars(soup)
 
-        self.assertTrue('15330', flashvars['introDuration']) # TED intro, need 
to offset subtitles with this
-        self.assertEquals('1253', flashvars['ti']) # talk ID
+        # TED intro, need to offset subtitles with this.
+        # Used to have this at ms granularity - now only s :(
+        self.assertEquals('15', flashvars['introDuration'])
+
+        # Talk ID, need this to request subtitles.
+        self.assertEquals('1253', flashvars['talkId'])
 
         expected = set(['sq', 'ar', 'hy', 'bg', 'ca', 'zh-cn', 'zh-tw', 'hr', 
'cs', 'da', 'nl', 'en', 'fr', 'ka', 'de', 'el', 'he', 'hu', 'id', 'it', 'ja', 
'ko', 'fa', 'mk', 'pl', 'pt', 'pt-br', 'ro', 'ru', 'sr', 'sk', 'es', 'th', 
'tr', 'uk', 'vi'])
         self.assertEquals(expected, set(subtitles_scraper.get_languages(soup)))
 
         subs = subtitles_scraper.get_subtitles_for_talk(soup, ['banana', 'fr', 
'en'], None)
         self.assertTrue(subs.startswith('''1
-00:00:15,330 --> 00:00:18,330
+00:00:15,000 --> 00:00:18,000
 Vous savez tous que ce que je vais dire est vrai.
 
 2'''))
diff --git a/plugin.video.ted.talks/resources/lib/ted_talks.py 
b/plugin.video.ted.talks/resources/lib/ted_talks.py
index 79a5502..3b4364c 100644
--- a/plugin.video.ted.talks/resources/lib/ted_talks.py
+++ b/plugin.video.ted.talks/resources/lib/ted_talks.py
@@ -46,7 +46,7 @@ class UI:
         #let xbmc know the script is done adding items to the list.
         xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), updateListing=False)
 
-    def addItem(self, title, mode, url=None, img=None, video_info={}, 
talkID=None, isFolder=True, total_items=0):
+    def addItem(self, title, mode, url=None, img="", video_info={}, 
talkID=None, isFolder=True, total_items=0):
         # Create action url
         args = {'mode': mode}
         if url:

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

commit ef04114d317c540e2fa62d015b83950bf4dabb88
Author: spiff <[email protected]>
Date:   Mon Oct 15 10:35:33 2012 +0200

    [plugin.video.wimp] updated to version 2.0.0

diff --git a/plugin.video.wimp/addon.py b/plugin.video.wimp/addon.py
index 57657aa..e1f5301 100644
--- a/plugin.video.wimp/addon.py
+++ b/plugin.video.wimp/addon.py
@@ -1,134 +1,139 @@
-import os

-from xbmcswift import Plugin, xbmcplugin, xbmcgui

-import resources.lib.scraper as scraper

-

-

-class Plugin_adv(Plugin):

-

-    def add_items(self, iterable, sort_method_ids=[]):

-        items = []

-        urls = []

-        for i, li_info in enumerate(iterable):

-            items.append(self._make_listitem(**li_info))

-            if self._mode in ['crawl', 'interactive', 'test']:

-                print '[%d] %s%s%s (%s)' % (i + 1, '', li_info.get('label'),

-                                            '', li_info.get('url'))

-                urls.append(li_info.get('url'))

-        if self._mode is 'xbmc':

-            xbmcplugin.addDirectoryItems(self.handle, items, len(items))

-            for id in sort_method_ids:

-                xbmcplugin.addSortMethod(self.handle, id)

-            xbmcplugin.endOfDirectory(self.handle, cacheToDisc=False)

-        return urls

-

-    def set_resolved_url(self, url, title=None):

-        if self._mode in ['crawl', 'interactive', 'test']:

-            print 'ListItem resolved to %s' % url

-        li = xbmcgui.ListItem(path=url)

-        if title:

-            li.setLabel(title)

-        xbmcplugin.setResolvedUrl(self.handle, True, li)

-        if self._mode in ['interactive', 'crawl', 'test']:

-            return []

-

-

-plugin = Plugin_adv('Wimp.com', 'plugin.video.wimp', __file__)

-

-

[email protected]('/', default=True)

+#!/usr/bin/python

+# -*- coding: utf-8 -*-

+#

+#     Copyright (C) 2012 Tristan Fischer

+#

+#    This program is free software: you can redistribute it and/or modify

+#    it under the terms of the GNU General Public License as published by

+#    the Free Software Foundation, either version 3 of the License, or

+#    (at your option) any later version.

+#

+#    This program is distributed in the hope that it will be useful,

+#    but WITHOUT ANY WARRANTY; without even the implied warranty of

+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+#    GNU General Public License for more details.

+#

+#    You should have received a copy of the GNU General Public License

+#    along with this program. If not, see <http://www.gnu.org/licenses/>.

+#

+

+from xbmcswift2 import Plugin, xbmc

+from resources.lib.api import WimpApi, NetworkError

+

+plugin = Plugin()

+api = WimpApi()

+

+STRINGS = {

+    'current': 30000,

+    'archive': 30002,

+    'search': 30003,

+    'network_error': 30020

+}

+

+

[email protected]('/')

 def show_root():

-    log('show_root started')

-    categories = [{'label': plugin.get_string(30000),

-                   'url': plugin.url_for('show_current')},

-                  {'label': plugin.get_string(30001),

-                   'url': plugin.url_for('watch_random'),

-                   'is_folder': False,

-                   'is_playable': True},

-                  {'label': plugin.get_string(30002),

-                   'url': plugin.url_for('show_archive')},

-                  {'label': plugin.get_string(30003),

-                   'url': plugin.url_for('search')}]

-    return plugin.add_items(categories)

+    items = [

+        {'label': _('current'),

+         'path': plugin.url_for('show_current')},

+        {'label': _('archive'),

+         'path': plugin.url_for('show_archive')},

+        {'label': _('search'),

+         'path': plugin.url_for('search')}

+    ]

+    return plugin.finish(items)

 

 

 @plugin.route('/current/')

 def show_current():

-    log('show_current started')

-    videos = scraper.get_current_videos()

+    videos = api.get_current_videos()

     return __add_videos(videos)

 

 

[email protected]('/watch/<video_id>/')

-def watch_video(video_id):

-    log('watch_video started with video_id=%s' % video_id)

-    mobile = __mobile()

-    video_url, title = scraper.get_video_url(video_id, mobile=mobile)

-    log('watch_video finished with video_url=%s' % video_url)

[email protected]('/watch/<video_url>')

+def watch_video(video_url):

     return plugin.set_resolved_url(video_url)

 

 

[email protected]('/random/')

-def watch_random():

-    log('watch_random started')

-    mobile = __mobile()

-    video_url, title = scraper.get_random_video_url(mobile=mobile)

-    log('watch_random finished with video_url=%s' % video_url)

-    return plugin.set_resolved_url(video_url, title=title)

-

-

 @plugin.route('/archive/')

 def show_archive():

-    log('show_archive started')

-    archive_dates = scraper.get_archive_dates()

-    items = [{'label': archive_date['title'],

-              'url': plugin.url_for('show_archived_videos',

-                                    archive_id=archive_date['archive_id']),

-             } for archive_date in archive_dates]

-    return plugin.add_items(items)

-

-

[email protected]('/archive/<archive_id>/')

-def show_archived_videos(archive_id):

-    log('show_archived_videos started with archive_id: %s' % archive_id)

-    videos = scraper.get_videos_by_archive_date(archive_id)

+    archive_dates = api.get_archive_dates()

+    items = [{

+        'label': archive_date['title'],

+        'path': plugin.url_for(

+            'show_archived_videos',

+            year=str(archive_date['year']),

+            month=str(archive_date['month'])

+        ),

+    } for archive_date in archive_dates]

+    items.reverse()

+    return plugin.finish(items)

+

+

[email protected]('/archive/<year>/<month>/')

+def show_archived_videos(year, month):

+    videos = api.get_archived_videos(

+        year=int(year),

+        month=int(month)

+    )

     return __add_videos(videos)

 

 

 @plugin.route('/search/')

 def search():

-    log('search start')

-    search_string = None

-    keyboard = xbmc.Keyboard('', plugin.get_string(30003))

-    keyboard.doModal()

-    if keyboard.isConfirmed() and keyboard.getText():

-        search_string = keyboard.getText()

-        log('search gots a string: "%s"' % search_string)

-        videos = scraper.get_search_result(search_string)

-        return __add_videos(videos)

+    search_string = __keyboard(_('search'))

+    if search_string:

+        url = plugin.url_for(

+            'search_result',

+            search_string=search_string

+        )

+        plugin.redirect(url)

+

+

[email protected]('/search/<search_string>/')

+def search_result(search_string):

+    videos = api.get_serch_result(search_string)

+    return __add_videos(videos)

 

 

 def __add_videos(videos):

-    p = plugin._plugin.getAddonInfo('path').decode('utf-8')

-    icon = os.path.join(xbmc.translatePath(p), 'icon.png')

-    items = [{'label': video['title'],

-              'thumbnail': icon,

-              'url': plugin.url_for('watch_video',

-                                    video_id=video['video_id']),

-              'info': {'date': video['date']},

-              'is_folder': False,

-              'is_playable': True,

-             } for video in videos]

-    sort_methods = [xbmcplugin.SORT_METHOD_DATE,

-                    xbmcplugin.SORT_METHOD_LABEL]

-    return plugin.add_items(items, sort_method_ids=sort_methods)

-

+    items = [{

+        'label': video['title'],

+        'thumbnail': video['thumb'],

+        'path': plugin.url_for(

+            'watch_video',

+            video_url=video['video_url']

+        ),

+        'info': {

+            'date': video['date']

+        },

+        'is_playable': True,

+    } for video in videos]

+    finish_kwargs = {

+        'sort_methods': ('DATE', )

+    }

+    if plugin.get_setting('force_viewmode') == 'true':

+        finish_kwargs['view_mode'] = 'thumbnail'

+    return plugin.finish(items, **finish_kwargs)

+

+

+def __keyboard(title, text=''):

+    keyboard = xbmc.Keyboard(text, title)

+    keyboard.doModal()

+    if keyboard.isConfirmed() and keyboard.getText():

+        return keyboard.getText()

 

-def __mobile():

-    return plugin.get_setting('pref_video') == '1'

 

+def _(string_id):

+    if string_id in STRINGS:

+        return plugin.get_string(STRINGS[string_id])

+    else:

+        plugin.log.warning('String is missing: %s' % string_id)

+        return string_id

 

-def log(msg):

-    xbmc.log('%s addon: %s' % ('wimp.com', msg))

 

 if __name__ == '__main__':

-    plugin.run()

+    try:

+        plugin.run()

+    except NetworkError:

+        plugin.notify(msg=_('network_error'))

diff --git a/plugin.video.wimp/addon.xml b/plugin.video.wimp/addon.xml
index 731944c..71c356d 100644
--- a/plugin.video.wimp/addon.xml
+++ b/plugin.video.wimp/addon.xml
@@ -1,17 +1,17 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.wimp" name="Wimp.com" version="1.0.1" 
provider-name="sphere, Insayne">
-  <requires>
-    <import addon="xbmc.python" version="2.0"/>
-    <import addon="script.module.beautifulsoup" version="3.0.8"/>
-    <import addon="script.module.xbmcswift" version="0.2.0"/>
-  </requires>
-  <extension point="xbmc.python.pluginsource" library="addon.py">
+<addon id="plugin.video.wimp" name="Wimp.com" version="2.0.0" 
provider-name="Tristan Fischer ([email protected])">
+    <requires>
+        <import addon="xbmc.python" version="2.0"/>
+        <import addon="script.module.simplejson" version="2.0.10"/>
+        <import addon="script.module.xbmcswift2" version="1.2.0"/>
+    </requires>
+    <extension point="xbmc.python.pluginsource" library="addon.py">
         <provides>video</provides>
-  </extension>
-  <extension point="xbmc.addon.metadata">
-    <platform>all</platform>
-    <summary lang="en">Stream Wimp.com</summary>
-    <description lang="de">Videos von Wimp.com</description>
-    <description lang="en">The Content of Wimp.com on your Media 
Center</description>
-  </extension>
+    </extension>
+    <extension point="xbmc.addon.metadata">
+        <language>en</language>
+        <platform>all</platform>
+        <summary lang="en">Wimp.com - Family Friendly Videos</summary>
+        <description lang="en">A collection of the best online videos. Our 
editors make sure clips added are family friendly.</description>
+    </extension>
 </addon>
diff --git a/plugin.video.wimp/changelog.txt b/plugin.video.wimp/changelog.txt
index f64e8a0..d35ce32 100644
--- a/plugin.video.wimp/changelog.txt
+++ b/plugin.video.wimp/changelog.txt
@@ -1,3 +1,10 @@
+2.0.0

+- Rewrite

+- THUMBNAILS!!! :)

+- use api instead scraping html

+- New Icon

+- Thubmnail View

+

 1.0.1

 - Fix video-listing (website changes)

 

diff --git a/plugin.video.wimp/icon.png b/plugin.video.wimp/icon.png
index 35c371b..1a4f594 100644
Binary files a/plugin.video.wimp/icon.png and b/plugin.video.wimp/icon.png 
differ
diff --git a/plugin.video.wimp/resources/language/English/strings.xml 
b/plugin.video.wimp/resources/language/English/strings.xml
index 7f4989f..74dba2d 100644
--- a/plugin.video.wimp/resources/language/English/strings.xml
+++ b/plugin.video.wimp/resources/language/English/strings.xml
@@ -2,11 +2,10 @@
 <strings>
     <!-- Root Menu -->
     <string id="30000">Current Videos</string>
-    <string id="30001">Random Video</string>
     <string id="30002">Archive</string>
     <string id="30003">Search</string>
     <!-- Settings -->
-    <string id="30010">Preferred Video</string>
-    <string id="30011">Flash</string>
-    <string id="30012">Mobile</string>
+    <string id="30010">Force ViewMode to Thumbnail</string>
+    <!-- Messages -->
+    <string id="30020">Network Error</string>
 </strings>
diff --git a/plugin.video.wimp/resources/language/German/strings.xml 
b/plugin.video.wimp/resources/language/German/strings.xml
index 640f7db..229df4f 100644
--- a/plugin.video.wimp/resources/language/German/strings.xml
+++ b/plugin.video.wimp/resources/language/German/strings.xml
@@ -2,11 +2,10 @@
 <strings>
     <!-- Root Menu -->
     <string id="30000">Aktuelle Videos</string>
-    <string id="30001">Zufälliges Video</string>
     <string id="30002">Archiv</string>
     <string id="30003">Suche</string>
     <!-- Settings -->
-    <string id="30010">Bevorzugtes Video</string>
-    <string id="30011">Flash</string>
-    <string id="30012">Mobil</string>
+    <string id="30010">ViewMode "Thumbnail" erzwingen</string>
+    <!-- Messages -->
+    <string id="30020">Netzwerkfehler</string>
 </strings>
diff --git a/plugin.video.wimp/resources/settings.xml 
b/plugin.video.wimp/resources/settings.xml
index 89401a3..443db55 100644
--- a/plugin.video.wimp/resources/settings.xml
+++ b/plugin.video.wimp/resources/settings.xml
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>

 <settings>

-       <setting id="pref_video" type="enum" lvalues="30011|30012" 
label="30010" default="0" />

+       <setting id="force_viewmode" type="bool" label="30010" default="true"/>

 </settings>


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

Summary of changes:
 plugin.video.ted.talks/addon.xml                   |    2 +-
 plugin.video.ted.talks/changelog.txt               |    4 +
 .../resources/lib/model/subtitles_scraper.py       |   40 +++--
 .../resources/lib/model/subtitles_scraper_test.py  |   10 +-
 plugin.video.ted.talks/resources/lib/ted_talks.py  |    2 +-
 plugin.video.wimp/addon.py                         |  221 ++++++++++----------
 plugin.video.wimp/addon.xml                        |   28 ++--
 plugin.video.wimp/changelog.txt                    |    7 +
 plugin.video.wimp/icon.png                         |  Bin 9159 -> 73016 bytes
 .../resources/language/English/strings.xml         |    7 +-
 .../resources/language/German/strings.xml          |    7 +-
 plugin.video.wimp/resources/lib/api.py             |  108 ++++++++++
 plugin.video.wimp/resources/lib/scraper.py         |  132 ------------
 plugin.video.wimp/resources/settings.xml           |    2 +-
 14 files changed, 288 insertions(+), 282 deletions(-)
 create mode 100644 plugin.video.wimp/resources/lib/api.py
 delete mode 100644 plugin.video.wimp/resources/lib/scraper.py


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to