The branch, frodo has been updated via b797a90d3ccd82b567c0266bcc09e2be076cc80a (commit) from 6dab52ff813169fd6dc7aa229de55a8518537ad6 (commit)
- Log ----------------------------------------------------------------- http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=b797a90d3ccd82b567c0266bcc09e2be076cc80a commit b797a90d3ccd82b567c0266bcc09e2be076cc80a Author: Martijn Kaijser <mcm.kaij...@gmail.com> Date: Fri May 16 21:01:06 2014 +0200 [plugin.video.newyorktimes] 1.4.1 diff --git a/plugin.video.newyorktimes/README.md b/plugin.video.newyorktimes/README.md index 88d7b0f..87d2523 100644 --- a/plugin.video.newyorktimes/README.md +++ b/plugin.video.newyorktimes/README.md @@ -5,5 +5,9 @@ Watch videos from http://video.on.nytimes.com ### Contact +idleloop -at- yahoo.com + +### Original author: + w...@jonathanbeluch.com jbel on [http://forum.xbmc.org](http://forum.xbmc.org) diff --git a/plugin.video.newyorktimes/addon.py b/plugin.video.newyorktimes/addon.py index ae480dc..8e72d03 100755 --- a/plugin.video.newyorktimes/addon.py +++ b/plugin.video.newyorktimes/addon.py @@ -6,11 +6,19 @@ http://video.on.nytimes.com/ :copyright: (c) 2012 by Jonathan Beluch + :modified on 2014 by idleloop :license: GPLv3, see LICENSE.txt for more details. ''' from xbmcswift2 import Plugin from resources.lib import api +### +# +# bigger videos settings +import xbmcaddon +settings = xbmcaddon.Addon(id='plugin.video.newyorktimes') +# +### plugin = Plugin() @@ -19,7 +27,7 @@ plugin = Plugin() def show_topics(): '''The main menu, shows available video topics''' items = [{ - 'label': name, + 'label': name.replace('&', "&"), 'path': plugin.url_for('show_topic', url=url), } for name, url in api.get_topics()] return items @@ -31,7 +39,8 @@ def show_topic(url): as videos. ''' videos = api.get_videos(url) - items = [item_from_video(v) for v in videos] + XXL4HIRES = settings.getSetting("xxl4hires") + items = [item_from_video(v, XXL4HIRES) for v in videos] subtopics = [{ 'label': name, @@ -41,26 +50,28 @@ def show_topic(url): return subtopics + items -def update_url_for_rtmp(url): +def update_url_for_rtmp(url, XXL4HIRES): '''Appends playpath option for an RTMP url. Other url types are returned unchanged. For brightcove urls, the playpath is after the '&'. ''' + if XXL4HIRES == 'true': url=url.replace('_xl_','_xxl_') + ###print "XXL4HIRES = " + XXL4HIRES + " url = " + url if url.startswith('rtmp'): return '%s playpath=%s' % (url, url.split('&', 1)[1]) return url -def item_from_video(video): +def item_from_video(video, XXL4HIRES): '''Returns a dict suitable for passing to plugin.add_items from a brightcove api Video. ''' item = { 'label': video.name, - 'path': update_url_for_rtmp(video.FLVURL), + 'path': update_url_for_rtmp(video.FLVURL, XXL4HIRES), 'info': info_from_video(video), 'is_playable': True, } diff --git a/plugin.video.newyorktimes/addon.xml b/plugin.video.newyorktimes/addon.xml index 4248663..c25876e 100644 --- a/plugin.video.newyorktimes/addon.xml +++ b/plugin.video.newyorktimes/addon.xml @@ -1,4 +1,4 @@ -<addon id="plugin.video.newyorktimes" name="New York Times" provider-name="Jonathan Beluch (jbel)" version="1.2.1"> +<addon id="plugin.video.newyorktimes" name="New York Times" provider-name="Jonathan Beluch (jbel), idleloop" version="1.4.1"> <requires> <import addon="xbmc.python" version="2.1.0" /> <import addon="script.module.beautifulsoup" version="3.2.0" /> @@ -14,5 +14,9 @@ <platform>all</platform> <summary>Watch video from the New York Times.</summary> <description>News and opinion video from The NYTimes including breaking news, investigative reporting, national and international coverage. Style and celebrity video.</description> + <license>GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007</license> + <source>https://github.com/idleloop-github/xbmc-newyorktimes</source> + <email>idleloop at yahoo dot com</email> + <disclaimer>Provided "as is". Original author: web at jonathanbeluch dot com</disclaimer> </extension> </addon> \ No newline at end of file diff --git a/plugin.video.newyorktimes/changelog.txt b/plugin.video.newyorktimes/changelog.txt index ec63fdd..19f946a 100644 --- a/plugin.video.newyorktimes/changelog.txt +++ b/plugin.video.newyorktimes/changelog.txt @@ -1,3 +1,10 @@ +Version 1.4 to 1.4.1 +* Update addon to reflect website changes + +Version 1.3 (forked by idleloop) +* Update addon to reflect website changes +* Added configuration to watch higher resolution streaming videos + Version 1.2.1 * Update python version * Bump major version to differentiate between eden diff --git a/plugin.video.newyorktimes/resources/lib/api.py b/plugin.video.newyorktimes/resources/lib/api.py index 0de922e..142ab7d 100644 --- a/plugin.video.newyorktimes/resources/lib/api.py +++ b/plugin.video.newyorktimes/resources/lib/api.py @@ -10,6 +10,7 @@ ''' import urlparse import requests +import re from BeautifulSoup import BeautifulSoup as BS from brightcove.api import Brightcove @@ -26,9 +27,11 @@ def _url(path): def get_topics(): '''Returns a list of (topic_name, url) of available topics''' html = BS(requests.get(BASE_URL).text) - menu = html.find('div', {'class': 'navigation clearfix'}) - links = menu.findAll('a', href=lambda h: h.startswith('/video/landing/')) - return [(a.text, _url(a['href'])) for a in links] + menu = html.find('div', {'class': 'header-container'}) + links = menu.findAll('a', href=lambda h: h.startswith('/video/')) + topics = [(a.text, _url(a['href'])) for a in links] + topics.insert( 0, ('Latest Videos', _url('/video/latest-video/')) ) + return topics def get_sub_topics(topic_url): @@ -37,13 +40,14 @@ def get_sub_topics(topic_url): will be returned. ''' html = BS(requests.get(topic_url).text) - menu = html.find('div', {'class': 'subCategories clearfix'}) + menu = html.find('div', {'class': 'main wrapper clearfix'}) + menu2 = menu.findAll('li', itemtype='http://schema.org/SiteNavigationElement') + links = [menu3.find('a', href=lambda h: h.startswith('/video/')) for menu3 in menu2] - if menu.find('li', {'class': 'firstItem selected'}): + if menu.find('li', {'class': 'active'}): # Viewing a sub-topic page, don't return sub topics again return [] - - links = menu.findAll('a') + return [(a.text, _url(a['href'])) for a in links] @@ -51,7 +55,9 @@ def get_videos(url): '''For a given topic url, returns a list of associated videos from the Brightcove API. ''' - ref_id = url.split('/')[-2] + html = BS(requests.get(url).text) + menu = html.find('a', {'class': 'thumb-holder'}) + ref_id = (menu['href']).split('=')[-1] brightcove = Brightcove(TOKEN) playlist = brightcove.find_playlist_by_reference_id(ref_id) return playlist.videos diff --git a/plugin.video.newyorktimes/resources/tests/test_api.py b/plugin.video.newyorktimes/resources/tests/test_api.py index 80d52ff..8d00b1c 100644 --- a/plugin.video.newyorktimes/resources/tests/test_api.py +++ b/plugin.video.newyorktimes/resources/tests/test_api.py @@ -11,15 +11,19 @@ class APIITTests(unittest.TestCase): items = api.get_topics() self.assertTrue(len(items) > 10) # currently 11 + ''' + 20140501: + Subtopics aren't listed any more, even if they still exists on urls def test_get_sub_topics(self): - url = 'http://www.nytimes.com/video/landing/world/1194811622205/index.html' + url = 'http://www.nytimes.com/video/world' items = api.get_sub_topics(url) self.assertTrue(len(items) > 4) # currently 5 - url = 'http://www.nytimes.com/video/landing/americas/1194811622209/index.html' + url = 'http://www.nytimes.com/video/americas' items2 = api.get_sub_topics(url) # Ensure we don't re-parse sub topics when already on a sub topic page self.assertEqual(len(items2), 0) + ''' def test_get_videos(self): url = 'http://www.nytimes.com/video/landing/world/1194811622205/index.html' ----------------------------------------------------------------------- Summary of changes: plugin.video.newyorktimes/README.md | 4 +++ plugin.video.newyorktimes/addon.py | 21 ++++++++++++++---- plugin.video.newyorktimes/addon.xml | 6 ++++- plugin.video.newyorktimes/changelog.txt | 7 ++++++ plugin.video.newyorktimes/resources/lib/api.py | 22 ++++++++++++------- plugin.video.newyorktimes/resources/settings.xml | 4 +++ .../resources/tests/test_api.py | 8 +++++- 7 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 plugin.video.newyorktimes/resources/settings.xml 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 Xbmc-addons@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xbmc-addons