The branch, frodo has been updated via e4652cda5c8830f80ed5bb07b644e30ff573c4e2 (commit) via 7f01855dc8583b79dde5232f49920195d8978da5 (commit) from f2f7f780bb262fecc669e8dfc77a8cf2081fcd78 (commit)
- Log ----------------------------------------------------------------- http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=e4652cda5c8830f80ed5bb07b644e30ff573c4e2 commit e4652cda5c8830f80ed5bb07b644e30ff573c4e2 Author: Martijn Kaijser <mcm.kaij...@gmail.com> Date: Mon Aug 18 17:18:44 2014 +0200 [plugin.video.filmsforaction] 1.0.4 diff --git a/plugin.video.filmsforaction/addon.xml b/plugin.video.filmsforaction/addon.xml index 5a80afe..705f193 100644 --- a/plugin.video.filmsforaction/addon.xml +++ b/plugin.video.filmsforaction/addon.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<addon id="plugin.video.filmsforaction" name="Films For Action" version="1.0.3" provider-name="Jose Antonio Montes (jamontes)"> +<addon id="plugin.video.filmsforaction" name="Films For Action" version="1.0.4" provider-name="Jose Antonio Montes (jamontes)"> <requires> <import addon="xbmc.python" version="2.1.0"/> <import addon="plugin.video.youtube" version="4.4.8"/> diff --git a/plugin.video.filmsforaction/changelog.txt b/plugin.video.filmsforaction/changelog.txt index 7264a51..0ee706f 100644 --- a/plugin.video.filmsforaction/changelog.txt +++ b/plugin.video.filmsforaction/changelog.txt @@ -1,3 +1,6 @@ +1.0.4 +- Fixed Next/Previous Page entries due to website changes. +- Updated Dailymotion scraper to support more video formats. 1.0.3 - Rewriten video list parser to make it more tolerant to website changes. - Replaced builtin Disclose TV parser on behalf of Disclose TV add-on (credits: sphere) diff --git a/plugin.video.filmsforaction/resources/lib/ffa_api.py b/plugin.video.filmsforaction/resources/lib/ffa_api.py index dd7c4e8..3f32ca2 100644 --- a/plugin.video.filmsforaction/resources/lib/ffa_api.py +++ b/plugin.video.filmsforaction/resources/lib/ffa_api.py @@ -60,57 +60,63 @@ def get_videolist(url, localized=lambda x: x): video_rating_pattern = '([0-9.]+?[ ]+?[Ss]tars)' video_views_pattern = '([0-9,]+?[ ]+?[Vv]iews)' video_author_pattern = '([Aa]dded by).*?<a href=["\']/[^/]*?/["\'][ ]*?>([^<]*?)</a>' - page_count_pattern = '<span id="C_SR_LabelResultsCount[^"]*?">([0-9]*?)-([0-9]*?) of ([0-9]*?) [^<]*?</span>' - prev_page_pattern = '<div style="float:left">[^<]*?<a href="([^"]*?)"><img id="C_SR_IPrevious"' - next_page_pattern = '<div style="float:right">[^<]*?<a href="([^"]*?)"><img id="C_SR_INext"' + page_num_pattern = 'href=["\']http[^"\']*?p=([0-9]+?)' + page_num_url_pattern = 'href=["\'](http[^"\']*?p=%d[^"\']*?)["\']' + page_num_cur_pattern = 'p=([0-9]+?)' buffer_url = l.carga_web(url) video_list = [] - first_video, last_video, total_videos = l.find_first(buffer_url, page_count_pattern) or ('0', '0', '0') - current_page = (int(first_video) / 50) + 1 - last_page = (int(total_videos) / 50) + 1 - next_page_num = current_page + 1 if current_page < last_page else 0 - prev_page_num = current_page - 1 reset_cache = False + current_page_num = int(l.find_first(url, page_num_cur_pattern) or '1') + last_page_num = int(max(l.find_multiple(buffer_url, page_num_pattern) or ('1',), key=int)) - if prev_page_num: - previous_page_url = l.find_first(buffer_url, prev_page_pattern) + if current_page_num != 1: + prev_page_num = current_page_num - 1 + previous_page_url = l.find_first(buffer_url, page_num_url_pattern % prev_page_num) video_entry = { 'url': previous_page_url, 'title': '<< %s (%d)' % (localized('Previous page'), prev_page_num), 'IsPlayable': False } video_list.append(video_entry) reset_cache = True - for video_index, video_section in enumerate(buffer_url.split(video_entry_sep)): - if video_index: - category = l.find_first(video_section, video_cat_pattern) - if category: - url = l.find_first(video_section, video_url_pattern) - thumb = l.find_first(video_section, video_thumb_pattern) - title = l.find_first(video_section, video_title_pattern) - plot = l.find_first(video_section, video_plot_pattern) - duration = l.find_first(video_section, video_duration_pattern) - rating = l.find_first(video_section, video_rating_pattern) - views = l.find_first(video_section, video_views_pattern) - label, author = l.find_first(video_section, video_author_pattern) or ('', '') - l.log('Video info. url: "%s" thumb: "%s" title: "%s" category: "%s"' % (url, thumb, title, category)) - l.log('Video tags. duration: "%s" rating: "%s" views: "%s" author: "%s %s"' % (duration, rating, views, label, author)) - video_entry = { - 'url': root_url + url, - 'title': title.strip() or '.', - 'thumbnail': root_url + thumb, - 'plot': "%s\n%s - %s - %s - %s\n%s %s" % (plot.strip(), category, duration, views, rating, label, author), - 'duration': int(duration.split()[0]) if duration else 0, - 'rating': rating.split()[0] if rating else '', - 'genre': category, - 'credits': author, - 'IsPlayable': True - } - video_list.append(video_entry) - - if next_page_num: - next_page_url = l.find_first(buffer_url, next_page_pattern) - video_entry = { 'url': next_page_url, 'title': '>> %s (%d/%d)' % (localized('Next page'), next_page_num, last_page), 'IsPlayable': False } + for video_section in buffer_url.split(video_entry_sep)[1:]: + category = l.find_first(video_section, video_cat_pattern) + if category: + url = l.find_first(video_section, video_url_pattern) + thumb = l.find_first(video_section, video_thumb_pattern) + title = l.find_first(video_section, video_title_pattern) + plot = l.find_first(video_section, video_plot_pattern) + duration = l.find_first(video_section, video_duration_pattern) + rating = l.find_first(video_section, video_rating_pattern) + views = l.find_first(video_section, video_views_pattern) + label, author = l.find_first(video_section, video_author_pattern) or ('', '') + l.log('Video info. url: "%s" thumb: "%s" title: "%s" category: "%s"' % (url, thumb, title, category)) + l.log('Video tags. duration: "%s" rating: "%s" views: "%s" author: "%s %s"' % (duration, rating, views, label, author)) + video_entry = { + 'url' : root_url + url, + 'title' : title.strip() or '.', + 'thumbnail' : root_url + thumb, + 'plot' : "%s\n%s - %s - %s - %s\n%s %s" % ( + plot.strip(), + category, + duration, + views, + rating, + label, + author, + ), + 'duration' : int(duration.split()[0]) if duration else 0, + 'rating' : rating.split()[0] if rating else '', + 'genre' : category, + 'credits' : author, + 'IsPlayable' : True + } + video_list.append(video_entry) + + if current_page_num < last_page_num: + next_page_num = current_page_num + 1 + next_page_url = l.find_first(buffer_url, page_num_url_pattern % next_page_num) + video_entry = { 'url': next_page_url, 'title': '>> %s (%d/%d)' % (localized('Next page'), next_page_num, last_page_num), 'IsPlayable': False } video_list.append(video_entry) return { 'video_list': video_list, 'reset_cache': reset_cache } @@ -170,13 +176,18 @@ def get_playable_youtube_url(video_id): def get_playable_dailymotion_url(video_id): """This function returns the playable URL for the Dalymotion embedded video from the video_id retrieved.""" - pattern_daily_video = '"stream_h264_hq_url":"(.+?)"' + daily_video_patterns = ( + '"stream_h264_hq_url":"(.+?)"', + '"stream_h264_url":"(.+?)"', + '"stream_h264_ld_url":"(.+?)"', + ) daily_url = 'http://www.dailymotion.com/embed/video/' + video_id buffer_link = l.carga_web(daily_url) - video_url = l.find_first(buffer_link, pattern_daily_video) - if video_url: - return video_url.replace('\\','') + for pattern_daily_video in daily_video_patterns: + video_url = l.find_first(buffer_link, pattern_daily_video) + if video_url: + return video_url.replace('\\', '') def get_playable_archiveorg_url(archive_url): diff --git a/plugin.video.filmsforaction/resources/tests/test_api.py b/plugin.video.filmsforaction/resources/tests/test_api.py index 32e277e..959162d 100644 --- a/plugin.video.filmsforaction/resources/tests/test_api.py +++ b/plugin.video.filmsforaction/resources/tests/test_api.py @@ -43,7 +43,7 @@ class ITTests(unittest.TestCase): self.assertTrue(len(api.get_playable_url(url)) > 10) def test_dailymotion_scraper(self): - url='http://www.filmsforaction.org/watch/plastic-paradise-the-great-pacific-garbage-patch-2013/' + url='http://www.filmsforaction.org/watch/pbs_frontline_is_walmart_good_for_america_2005/' self.assertTrue(len(api.get_playable_url(url)) > 10) def test_tagtele_scraper(self): http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=7f01855dc8583b79dde5232f49920195d8978da5 ----------------------------------------------------------------------- Summary of changes: plugin.video.filmsforaction/addon.xml | 2 +- plugin.video.filmsforaction/changelog.txt | 3 + .../resources/lib/ffa_api.py | 99 ++-- .../resources/tests/test_api.py | 2 +- plugin.video.gameone/LICENSE.txt | 621 -------------------- plugin.video.gameone/addon.xml | 20 - plugin.video.gameone/changelog.txt | 31 - plugin.video.gameone/default.py | 366 ------------ plugin.video.gameone/icon.png | Bin 75267 -> 0 bytes .../resources/language/English/strings.xml | 25 - .../resources/language/German/strings.xml | 26 - plugin.video.gameone/resources/settings.xml | 8 - 12 files changed, 60 insertions(+), 1143 deletions(-) delete mode 100644 plugin.video.gameone/LICENSE.txt delete mode 100644 plugin.video.gameone/addon.xml delete mode 100644 plugin.video.gameone/changelog.txt delete mode 100644 plugin.video.gameone/default.py delete mode 100644 plugin.video.gameone/icon.png delete mode 100644 plugin.video.gameone/resources/language/English/strings.xml delete mode 100644 plugin.video.gameone/resources/language/German/strings.xml delete mode 100644 plugin.video.gameone/resources/settings.xml hooks/post-receive -- Plugins ------------------------------------------------------------------------------ _______________________________________________ Xbmc-addons mailing list Xbmc-addons@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xbmc-addons