summaryrefslogtreecommitdiff
path: root/plugin.video.spurs-tv
diff options
context:
space:
mode:
authorLS80 <github@lee-smith.me.uk>2016-08-06 12:27:18 +0100
committerLS80 <github@lee-smith.me.uk>2016-08-09 07:42:25 +0100
commitbd65a708365c22f07cefe77dab60158e7d30ff27 (patch)
tree4355ea389433484bd9f70e8ac3c3a35a5766b3df /plugin.video.spurs-tv
parent503928799dd20978d236e412156c51ec8bb3abb1 (diff)
[plugin.video.spurs-tv] 2.10.0
Diffstat (limited to 'plugin.video.spurs-tv')
-rw-r--r--plugin.video.spurs-tv/addon.py56
-rw-r--r--plugin.video.spurs-tv/addon.xml6
-rw-r--r--plugin.video.spurs-tv/changelog.txt63
-rw-r--r--plugin.video.spurs-tv/resources/language/English/strings.po119
-rw-r--r--plugin.video.spurs-tv/resources/language/English/strings.xml19
-rw-r--r--plugin.video.spurs-tv/resources/settings.xml1
6 files changed, 202 insertions, 62 deletions
diff --git a/plugin.video.spurs-tv/addon.py b/plugin.video.spurs-tv/addon.py
index 44aedfa..a995a51 100644
--- a/plugin.video.spurs-tv/addon.py
+++ b/plugin.video.spurs-tv/addon.py
@@ -24,8 +24,10 @@ from urlparse import urlparse, urlunparse, urljoin
from datetime import timedelta
from functools import partial
import xml.etree.ElementTree as ET
+import traceback
+import json
-from xbmcswift2 import Plugin, xbmc
+from xbmcswift2 import Plugin, xbmc, xbmcgui
from bs4 import BeautifulSoup
import requests
import livestreamer
@@ -61,6 +63,9 @@ PAGINATION_FMT = "Pagination1${}"
SEARCH_NAV_FMT = FIELD_NAME_ROOT_FMT.format(0) + PAGINATION_FMT
+PLAYER_VARS_RE = re.compile("kWidget.embed\((.*?)\)", re.MULTILINE|re.DOTALL)
+STADIUM_THUMB = HOST + ("/uploadedImages/Shared_Assets/Images/News_images/SEASON_16-17/"
+ "July_2016/NDP_update/west_elevation_instory.jpg")
plugin = Plugin()
@@ -72,6 +77,10 @@ def log(msg):
if debug:
plugin.log.info(msg)
+def error_report_yes(exc):
+ return xbmcgui.Dialog().yesno(plugin.get_string(30130), plugin.get_string(30131),
+ "[COLOR=red]{}[/COLOR]".format(exc), plugin.get_string(30133))
+
def get_soup(url, data=None):
if not url.endswith('/'):
url += '/'
@@ -87,9 +96,12 @@ def get_viewstate(soup):
return soup.find('input', id='__VIEWSTATE')['value']
def get_media_url(entry_id):
- hls_url = 'hlsvariant://' + HLS_URL_FMT.format(entry_id)
+ hls_url = HLS_URL_FMT.format(entry_id)
+ livestreamer_url = 'hlsvariant://' + hls_url
+ log("Retrieving streams from {}".format(hls_url))
resolution = plugin.get_setting('resolution')
- streams = livestreamer.streams(hls_url, sorting_excludes=[">{}".format(resolution)])
+ streams = livestreamer.streams(livestreamer_url, sorting_excludes=[">{}".format(resolution)])
+ log("Available streams: {}".format(' '.join(streams)))
media_url = streams['best'].url
log("Playing URL {}".format(media_url))
@@ -190,13 +202,30 @@ def get_search_result_videos(soup, query):
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']
+ yield title, entry_id
+
+def get_stadium_index():
+ for title, entry_id in get_stadium_cams():
+ yield {'label': title,
+ 'path': plugin.url_for('play_video', entry_id=entry_id),
+ 'is_playable': True}
+
+ 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)}
- yield {'label': "Stadium TV",
- 'path': plugin.url_for('show_playlist', playlist_id='0_n8hezta2')}
+ yield {'label': plugin.get_string(30017),
+ 'path': plugin.url_for('show_stadium_index'),
+ 'thumbnail': STADIUM_THUMB}
url = urljoin(HOST, path)
soup = get_soup(url)
@@ -208,9 +237,7 @@ def get_categories(path):
href = a['href'].strip('/')
playable = False
- if href.endswith("spurs-tv"):
- plugin_path = plugin.url_for('show_categories', path=href)
- elif title == "Ledley King Testimonial":
+ if title == "Ledley King Testimonial":
plugin_path = plugin.url_for('show_playlist', playlist_id='0_2nmzot3u')
elif title == "The Vault":
plugin_path = plugin.url_for('show_playlist', playlist_id='0_32nxk7s7')
@@ -299,6 +326,10 @@ def show_categories(path):
@plugin.cached_route('/path/<path>/subcategories')
def show_subcategories(path):
return list(get_subcategories(path))
+
+@plugin.cached_route('/stadium')
+def show_stadium_index():
+ return list(get_stadium_index())
@plugin.route('/videos/path/<path>')
def show_video_list(path):
@@ -395,9 +426,10 @@ def youtube_search_result(query):
if __name__ == '__main__':
rollbar.init('45541e2cb1e24f95b9c6311c2e931a11')
-
try:
plugin.run()
- except Exception:
- rollbar.report_exc_info()
- raise
+ 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})
+ 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 ac4cd98..4056014 100644
--- a/plugin.video.spurs-tv/addon.xml
+++ b/plugin.video.spurs-tv/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.spurs-tv" name="Spurs TV" version="2.8.0" provider-name="Leopold">
+<addon id="plugin.video.spurs-tv" name="Spurs TV" version="2.10.0" provider-name="Leopold">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
<import addon="script.module.xbmcswift2" version="2.4.0" optional="false"/>
@@ -15,8 +15,8 @@
<extension point="xbmc.addon.metadata">
<platform>all</platform>
<language>en</language>
- <summary>Watch videos from Spurs TV</summary>
- <description>This video plugin provides access to the latest Tottenham Hotspur highlights, exclusive interviews, live audio commentary, and more.</description>
+ <summary lang="en_gb">Watch videos from Spurs TV</summary>
+ <description lang="en_gb">This video plugin provides access to Tottenham Hotspur match highlights, exclusive interviews, live audio commentary of all first team matches, and more.</description>
<website>http://www.tottenhamhotspur.com/spurs-tv/</website>
<forum>http://forum.kodi.tv/showthread.php?tid=235234</forum>
<source>https://github.com/LS80/plugin.video.spurs-tv.git</source>
diff --git a/plugin.video.spurs-tv/changelog.txt b/plugin.video.spurs-tv/changelog.txt
index eb15e42..1ea38ac 100644
--- a/plugin.video.spurs-tv/changelog.txt
+++ b/plugin.video.spurs-tv/changelog.txt
@@ -1,87 +1,94 @@
-2.8.0
+v2.10.0 (2016-08-06)
+ - Added all stadium build live streams with descriptions
+ - Made error reporting optional
+
+v2.9.0 (2016-07-31)
+ - Added stadium build live streams
+ - Fixed Tour 2016 category
+
+v2.8.0 (2016-03-19)
- Fixed YouTube playlists
- Updated fanart
-2.7.0
+v2.7.0 (2016-02-28)
- Kodi Krypton is now a requirement
- Use Rollbar for automatically reporting errors
- Fixed incorrect characters for some menu items introduced in version 2.6.0
-2.6.0
+v2.6.0 (2016-02-19)
- Use ElementTree to parse the playlist xml
-2.5.0
+v2.5.0 (2016-02-18)
- Use the built-in parser instead of html5lib
-2.4.0
+v2.4.0 (2016-01-25)
- Fixed the categories 'The Vault' and 'A Question of Spurs'
-2.3.2
+v2.3.2 (2016-01-23)
- Fixed an error on the main index page caused by changes to Live Audio Commentary
-2.3.1
+v2.3.1 (2015-08-27)
- Fixed an error when playing videos on Android/iOS/Mac OS X
-2.3.0
+v2.3.0 (2015-08-13)
- Added a Stadium TV category
-2.2.0
+v2.2.0 (2015-08-13)
- Fixed problems caused by changes to the official site video hosting
- Removed the option to choose the stream protocol
-2.1.0
+v2.1.0 (2015-05-28)
- Enabled the Tour 2015 category
-2.0.1
+v2.0.1 (2015-04-04)
- Fixed Live Audio Commentary
-2.0.0
+v2.0.0 (2015-03-30)
- Reorganised the menu
- Added settings to control the stream protocol and video resolution
- Added a shortcut to change the YouTube plugin settings
-1.5.0
+v1.5.0 (2015-03-05)
- Fixed the Capital One Cup category
-1.4.0
+v1.4.0 (2015-02-05)
- Fixed playback problems
- Added a debug setting
-1.3.3
+v1.3.3 (2014-12-18)
- Fixed another script error with Official Site video lists
-1.3.2
+v1.3.2 (2014-12-18)
- Fixed a script error with Official Site video lists
-1.3.1
+v1.3.1
- Fixed compatibility with Android
-1.3.0
+v1.3.0
- Localized hard-coded strings
-1.2.1
+v1.2.1
- Fixed a script error with some Official Site search results
-1.2.0
+v1.2.0
- The YouTube plugin now only installs when required
-1.1.0
+v1.1.0
- Added caching for some views which will rarely change
-1.0.0
+v1.0.0
- Added support for the Spurs TV YouTube channel
-0.3.0
+v0.3.0
- Added Live Audio Commentary support
-0.2.1
+v0.2.1
- Fixed a broken dependency
-0.2.0
+v0.2.0
- Added Tour 2014 video categories
- Added Highlights subcategories
- - Added Ledley King Testimonial videos
+ - Added Ledley King Testimonial videos
-0.1.0
+v0.1.0
- Initial release
-
diff --git a/plugin.video.spurs-tv/resources/language/English/strings.po b/plugin.video.spurs-tv/resources/language/English/strings.po
new file mode 100644
index 0000000..a4abefc
--- /dev/null
+++ b/plugin.video.spurs-tv/resources/language/English/strings.po
@@ -0,0 +1,119 @@
+# Kodi Media Center language file
+# Addon Name: Spurs TV
+# Addon id: plugin.video.spurs-tv
+# Addon Provider: Leopold
+msgid ""
+msgstr ""
+"Project-Id-Version: XBMC 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"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: en\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+
+#. Index page list item to show YouTube channel videos
+msgctxt "#30001"
+msgid "YouTube Channel"
+msgstr ""
+
+#. Index page list item to show latest Spurs TV videos
+msgctxt "#30010"
+msgid "Latest"
+msgstr ""
+
+#. Index page list item to search for videos on Spurs TV
+msgctxt "#30011"
+msgid "Search"
+msgstr ""
+
+#. List item to go to the next page of videos
+msgctxt "#30012"
+msgid "Next Page"
+msgstr ""
+
+#. List item to go to the previous page of videos
+msgctxt "#30013"
+msgid "Previous Page"
+msgstr ""
+
+#. List item to show all videos within a subcategory
+msgctxt "#30014"
+msgid "All"
+msgstr ""
+
+#. List item to show the most popular YouTube videos
+msgctxt "#30015"
+msgid "Popular"
+msgstr ""
+
+#. List item to show YouTube channel playlists
+msgctxt "#30016"
+msgid "Playlists"
+msgstr ""
+
+#. List item to show content related to the new stadium build
+msgctxt "#30017"
+msgid "New Stadium"
+msgstr ""
+
+#. List item to show videos from a particular category such as "Stadium TV"
+msgctxt "#30019"
+msgid "Video Library"
+msgstr ""
+
+#. Settings category for advanced options
+msgctxt "#30100"
+msgid "Advanced"
+msgstr ""
+
+#. Setting to enable more detailed logging to the Kodi log
+msgctxt "#30101"
+msgid "Enable debug logging"
+msgstr ""
+
+#. Setting to enable automatic sending of addon error reports
+msgctxt "#30102"
+msgid "Automatically send error reports"
+msgstr ""
+
+#. Main settings category
+msgctxt "#30110"
+msgid "Official Site"
+msgstr ""
+
+#. Setting to restrict the video resolution
+msgctxt "#30111"
+msgid "Maximum video resolution"
+msgstr ""
+
+#. Settings category for YouTube videos
+msgctxt "#30120"
+msgid "YouTube"
+msgstr ""
+
+#. Settings action to open YouTube addon settings
+msgctxt "#30121"
+msgid "Settings"
+msgstr ""
+
+#. Heading for the error reporting yes/no dialog
+msgctxt "#30130"
+msgid "Error Report"
+msgstr ""
+
+#. Line 1 of the error reporting yes/no dialog
+msgctxt "#30131"
+msgid "An error occurred:"
+msgstr ""
+
+#. Line 3 of the error reporting yes/no dialog
+msgctxt "#30133"
+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/language/English/strings.xml b/plugin.video.spurs-tv/resources/language/English/strings.xml
deleted file mode 100644
index f18052d..0000000
--- a/plugin.video.spurs-tv/resources/language/English/strings.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<strings>
- <string id="30000">Official Site</string>
- <string id="30001">YouTube Channel</string>
- <string id="30010">Latest</string>
- <string id="30011">Search</string>
- <string id="30012">Next Page</string>
- <string id="30013">Previous Page</string>
- <string id="30014">All</string>
- <string id="30015">Popular</string>
- <string id="30016">Playlists</string>
-
- <string id="30100">Advanced</string>
- <string id="30101">Debug</string>
- <string id="30110">Official Site</string>
- <string id="30111">Maximum video resolution</string>
- <string id="30120">YouTube</string>
- <string id="30121">Settings</string>
-</strings>
diff --git a/plugin.video.spurs-tv/resources/settings.xml b/plugin.video.spurs-tv/resources/settings.xml
index ad12a6d..cc01fe4 100644
--- a/plugin.video.spurs-tv/resources/settings.xml
+++ b/plugin.video.spurs-tv/resources/settings.xml
@@ -8,5 +8,6 @@
</category>
<category label="30100">
<setting label="30101" type="bool" id="debug" default="false"/>
+ <setting label="30102" type="bool" id="send_error_reports" default="false"/>
</category>
</settings>