From c92a14c7455630ec841e070052baf97647f9d930 Mon Sep 17 00:00:00 2001 From: LS80 Date: Mon, 9 Jan 2017 07:30:10 +0000 Subject: [plugin.video.spurs-tv] 2.13.0 --- .../resources/language/English/strings.po | 14 +++++--- plugin.video.spurs-tv/resources/lib/new_stadium.py | 41 ++++++++++++++++++++++ 2 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 plugin.video.spurs-tv/resources/lib/new_stadium.py (limited to 'plugin.video.spurs-tv/resources') diff --git a/plugin.video.spurs-tv/resources/language/English/strings.po b/plugin.video.spurs-tv/resources/language/English/strings.po index a4abefc..3a4f157 100644 --- a/plugin.video.spurs-tv/resources/language/English/strings.po +++ b/plugin.video.spurs-tv/resources/language/English/strings.po @@ -4,10 +4,10 @@ # Addon Provider: Leopold msgid "" msgstr "" -"Project-Id-Version: XBMC Addons\n" +"Project-Id-Version: Kodi Addons\n" "POT-Creation-Date: 2016-08-01 05:35+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Language-Team: teamxbmc\n" +"Language-Team: English (http://www.transifex.com/projects/p/xbmc-addons/language/en/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -61,7 +61,14 @@ msgstr "" #. List item to show videos from a particular category such as "Stadium TV" msgctxt "#30019" -msgid "Video Library" +msgid "Video Gallery" +msgstr "" + +#. Message dialog for off line audio commentary +msgctxt "#30050" +msgid "" +"There is no live audio commentary available at this time. " +"Please try again 5 minutes before kick-off." msgstr "" #. Settings category for advanced options @@ -116,4 +123,3 @@ msgid "Send error report?" #. Notification message that an error report was sent msgctxt "#30134" msgid "Error report sent" - diff --git a/plugin.video.spurs-tv/resources/lib/new_stadium.py b/plugin.video.spurs-tv/resources/lib/new_stadium.py new file mode 100644 index 0000000..32b4ded --- /dev/null +++ b/plugin.video.spurs-tv/resources/lib/new_stadium.py @@ -0,0 +1,41 @@ +''' + This module contains functions for scraping video links from + http://new-stadium.tottenhamhotspur.com +''' + +from urlparse import urljoin +import json +import re +from collections import namedtuple + +from bs4 import BeautifulSoup as BS +import requests + +URL_ROOT = "http://new-stadium.tottenhamhotspur.com/" + +RE_EMBED = re.compile(r'kWidget\.embed\((.*)\)') + +Video = namedtuple('Video', ['title', 'entry_id']) + + +def get_soup(path): + '''Return a BeautifulSoup tree for the provided new stadium path''' + response = requests.get(urljoin(URL_ROOT, path)) + return BS(response.text, 'html.parser') + + +def get_cams(): + '''Generator for live stadium cameras''' + soup = get_soup("interact") + div = soup.find('div', {'data-player-id': 'player2'}) + for tab in json.loads(div['data-tabs']): + yield Video(title=tab['title'], entry_id=tab['entryId']) + + +def get_video_gallery(): + '''Generator for the new stadium video gallery videos''' + soup = get_soup("video-gallery") + for video in soup('div', 'video-new'): + video_vars = json.loads(RE_EMBED.search(video.find(text=RE_EMBED)).group(1)) + yield Video(title=video.find_next_sibling('p').get_text().strip(), + entry_id=video_vars['entry_id']) -- cgit v1.2.3