summaryrefslogtreecommitdiff
path: root/plugin.video.spurs-tv/resources
diff options
context:
space:
mode:
authorLS80 <github@lee-smith.me.uk>2017-01-09 07:30:10 +0000
committerLS80 <github@lee-smith.me.uk>2017-01-09 07:32:33 +0000
commitc92a14c7455630ec841e070052baf97647f9d930 (patch)
tree271e48c5f325f2ec3bef9bb8ccb02ab24824d4f9 /plugin.video.spurs-tv/resources
parentf5e966f91c77dde6516858a6e2f03899b7578f77 (diff)
[plugin.video.spurs-tv] 2.13.0
Diffstat (limited to 'plugin.video.spurs-tv/resources')
-rw-r--r--plugin.video.spurs-tv/resources/language/English/strings.po14
-rw-r--r--plugin.video.spurs-tv/resources/lib/new_stadium.py41
2 files changed, 51 insertions, 4 deletions
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'])