From fed342e994479fd6c7596eef41d0c6725adeeccc Mon Sep 17 00:00:00 2001 From: Lee Smith Date: Sun, 4 Sep 2016 03:07:49 +0100 Subject: [plugin.video.spurs-tv] 2.11.0 (#649) --- plugin.video.spurs-tv/addon.py | 42 ++++++++++++++++------------ plugin.video.spurs-tv/addon.xml | 2 +- plugin.video.spurs-tv/changelog.txt | 3 ++ plugin.video.spurs-tv/resources/lib/utils.py | 1 + 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/plugin.video.spurs-tv/addon.py b/plugin.video.spurs-tv/addon.py index a995a51..df63a21 100644 --- a/plugin.video.spurs-tv/addon.py +++ b/plugin.video.spurs-tv/addon.py @@ -116,7 +116,7 @@ def get_page_links(soup, endpoint, **kwargs): form_data['field'] = input['name'].rpartition('$')[0] page, npages = [int(n) for n in PAGE_RE.search(intro.contents[0]).groups()] - + if page > 1: item = {'label': u"[B]<< {} ({:d})[/B]".format(plugin.get_string(30013), page - 1), 'path': plugin.url_for(endpoint, @@ -124,7 +124,7 @@ def get_page_links(soup, endpoint, **kwargs): **kwargs) } links.append(item) - + if page < npages: item = {'label': u"[B]{} ({:d}) >>[/B]".format(plugin.get_string(30012), page + 1), 'path': plugin.url_for(endpoint, @@ -134,7 +134,7 @@ def get_page_links(soup, endpoint, **kwargs): links.append(item) return page, links - + def video_item(entry_id, title, date_str, date_format="%d %B %Y", duration_str=None, duration=None): item = {'label': title, 'thumbnail': THUMB_URL_FMT.format(entry_id), @@ -143,21 +143,21 @@ def video_item(entry_id, title, date_str, date_format="%d %B %Y", duration_str=N video_date = utils.date_from_str(date_str, date_format) utils.add_item_info(item, title, video_date) - + if duration is not None: item['stream_info'] = {'video': {'duration': duration}} elif duration_str is not None: minutes, seconds = duration_str.split(':') duration = timedelta(minutes=int(minutes), seconds=int(seconds)) item['stream_info'] = {'video': {'duration': duration.seconds}} - + return item def get_videos(soup, path): page, links = get_page_links(soup, 'show_video_list', path=path) for page_link in links: yield page_link - + if page is None or page == 1: featured_video = soup.find('div', 'video') if featured_video: @@ -167,13 +167,13 @@ def get_videos(soup, path): featured_date = featured_video.find_previous('p', 'featured-date') date_str = " ".join(featured_date.string.replace(u'\xa0', u' ').split()[2:5]) yield video_item(featured_entry_id, title, date_str, duration_str=duration_str) - + for card in soup(class_='card'): entry_id = ENTRY_ID_RE.search(card.a['style']).group(1) title = card.find('span', 'video-title').contents[0] duration_str = card.find('span', 'duration').string date_str = card.find('em', 'video-date').string - + yield video_item(entry_id, title, date_str, duration_str=duration_str) form_data['viewstate'] = get_viewstate(soup) @@ -194,20 +194,21 @@ def get_search_result_videos(soup, query): page, links = get_page_links(soup, 'search_result', query=query) for page_link in links: yield page_link - + for card in soup(class_='card'): entry_id = ENTRY_ID_RE.search(card.a['style']).group(1) title = card.parent.find('h3').text date_str = " ".join(card.parent.find('span', 'date').text.split()[-4:-1]) yield video_item(entry_id, title, date_str, date_format="%d %b %Y") - + form_data['viewstate'] = get_viewstate(soup) def get_stadium_cams(): soup = get_soup(urljoin(HOST, "/new-scheme/stadium-tv/")) - for video in soup('div', 'video-new'): - title = video.find_previous('h2').get_text() - entry_id = json.loads(PLAYER_VARS_RE.search(video('script')[-1].string).group(1))['entry_id'] + js = requests.get(urljoin(HOST, "/components/js/stadium-tv.js")).text + entry_ids = re.findall('"entry_id":\s+"(\w+)"', js) + for entry_id, video in zip(entry_ids, soup('div', 'video-new')): + title = video.find_previous('h2').get_text().strip() yield title, entry_id def get_stadium_index(): @@ -218,7 +219,7 @@ def get_stadium_index(): yield {'label': plugin.get_string(30019), 'path': plugin.url_for('show_playlist', playlist_id='0_n8hezta2')} - + def get_categories(path): yield {'label': "[B]{}[/B]".format(plugin.get_string(30010)), 'path': plugin.url_for('show_video_list', path=path)} @@ -330,7 +331,7 @@ def show_subcategories(path): @plugin.cached_route('/stadium') def show_stadium_index(): return list(get_stadium_index()) - + @plugin.route('/videos/path/') def show_video_list(path): url = urljoin(BASE_URL, path) @@ -366,7 +367,7 @@ def search(): def search_result(query): search_data = {FIELD_NAME_ROOT_FMT.format(0) + "drpTaxonomyCategoriesFilter": '144', FIELD_NAME_ROOT_FMT.format(0) + "hdSearchTerm": query} - + if 'navigate' in plugin.request.args: navigate = plugin.request.args['navigate'][0] search_data[SEARCH_NAV_FMT.format(navigate)] = '' @@ -376,7 +377,7 @@ def search_result(query): soup = get_soup(SEARCH_URL) viewstate = get_viewstate(soup) update_listing = False - + search_data['__VIEWSTATE'] = viewstate soup = get_soup(SEARCH_URL, search_data) @@ -430,6 +431,11 @@ if __name__ == '__main__': plugin.run() except Exception as exc: if plugin.get_setting('send_error_reports', bool) or error_report_yes(exc): - rollbar.report_exc_info(extra_data={'url': plugin.request.url}) + import platform + data = {'version': plugin.addon.getAddonInfo('version'), + 'platform': platform.system(), + 'machine': platform.machine(), + 'url': plugin.request.url} + rollbar.report_exc_info(extra_data=data) xbmcgui.Dialog().notification(plugin.name, plugin.get_string(30134)) plugin.log.error(traceback.format_exc) diff --git a/plugin.video.spurs-tv/addon.xml b/plugin.video.spurs-tv/addon.xml index 4056014..886b576 100644 --- a/plugin.video.spurs-tv/addon.xml +++ b/plugin.video.spurs-tv/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/plugin.video.spurs-tv/changelog.txt b/plugin.video.spurs-tv/changelog.txt index 1ea38ac..a033aa0 100644 --- a/plugin.video.spurs-tv/changelog.txt +++ b/plugin.video.spurs-tv/changelog.txt @@ -1,3 +1,6 @@ +v2.11.0 (2016-08-31) + - Fixed stadium camera streams + v2.10.0 (2016-08-06) - Added all stadium build live streams with descriptions - Made error reporting optional diff --git a/plugin.video.spurs-tv/resources/lib/utils.py b/plugin.video.spurs-tv/resources/lib/utils.py index 9742a96..a24df58 100644 --- a/plugin.video.spurs-tv/resources/lib/utils.py +++ b/plugin.video.spurs-tv/resources/lib/utils.py @@ -1,3 +1,4 @@ +import _strptime import time from datetime import date -- cgit v1.2.3