diff --git a/README.md b/README.md index 706f8b5..6fdff13 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ -Kodi Telekom Sport Addon -======================== +Kodi Magenta Sport Addon (ehem. Telekom Sport) +============================================== Über ---- -Mit diesem Addon kann man die Sportstreams von [Telekom Sport][1] ansehen. +Mit diesem Addon kann man die Sportstreams von [Magenta Sport][1] (ehem. +Telekom Sport) ansehen. Installation ------------ @@ -16,7 +17,8 @@ installieren. About ----- -This addon let's you watch the sports streams from [Telekom Sport][1]. +This addon let's you watch the sports streams from [Magenta Sport][1] +(formerly Telekom Sport). Installation ------------ @@ -24,5 +26,5 @@ Installation Download the addon zipfile from the [releases page][2] and install it in Kodi -> Addons. -[1]: https://www.telekomsport.de +[1]: https://www.magentasport.de [2]: https://github.com/hubsif/kodi-telekomsport/releases diff --git a/addon.xml b/addon.xml index b2f8a3d..3c5d867 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -9,16 +9,22 @@ all GNU GENERAL PUBLIC LICENSE. Version 2, June 1991 - Telekom Sport - Telekom Sports - Erlebe die große Welt des Sports. Fußball, Eishockey, Basketball und mehr live und auf Abruf. Alle Wettbewerbe in bester HD-Qualität. - Experience the big world of sports. Soccer, Ice Hockey, Basketball and more live and on demand. All competitions in best HD quality. - לחוות את העולם הגדול של הספורט. כדורגל, הוקי קרח, כדורסל ועוד לצפות לפי דרישה. כל התחרויות באיכות HD הטובה ביותר. + Magenta Sport + Magenta Sport + Bei MagentaSport mit Sky Sport Kompakt sehen Sie die Original Sky Konferenzen der Fußball-Bundesliga und der UEFA Champions League sowie alle Spiele der DKB Handball-Bundesliga. Dazu alle Spiele der 3. Liga, der Deutschen Eishockey Liga, der easyCredit Basketball Bundesliga und vieles mehr. + At MagentaSport with Sky Sport Kompakt you can watch the original Sky Conferences of the German Bundesliga and the UEFA Champions League as well as all matches of the DKB Handball Bundesliga. Also all games of the 3rd league, the German Ice Hockey League, the easyCredit Basketball Bundesliga and much more. - icon.png - fanart.jpg + resources/icon.png + resources/fanart.jpg + v2.0.0 (2019-01-16) + - update and rename to Magentasport + - use online sports category images + - fix crash issue with live stream shortcut in Leia + - remove single event category shortcut, fixes playback issue + - show error dialog on authentication failure + - some minor code cleanup v1.2.2 (2018-08-27) - fix playback issue with Kodi Leia (thanks to egolus) - use inputstream for Kodi Leia (thanks to MRLB) diff --git a/default.py b/default.py index 3f63d49..167551f 100644 --- a/default.py +++ b/default.py @@ -27,23 +27,24 @@ from datetime import datetime from random import randint -_addon_id = 'plugin.video.telekomsport' +_addon_id = 'plugin.video.magentasport' _addon = xbmcaddon.Addon(id=_addon_id) _addon_name = _addon.getAddonInfo('name') _addon_handler = int(sys.argv[1]) _addon_url = sys.argv[0] _addon_path = xbmc.translatePath(_addon.getAddonInfo("path") ) __language__ = _addon.getLocalizedString -_icons_path = _addon_path + "/resources/icons/" -_fanart_path = _addon_path + "/resources/fanart/" +#_icons_path = _addon_path + "/resources/icons/" +#_fanart_path = _addon_path + "/resources/fanart/" -xbmcplugin.setContent(_addon_handler, 'movies') +xbmcplugin.setContent(_addon_handler, 'episodes') -base_url = "https://www.telekomsport.de/api/v1" +base_url = "https://www.magentasport.de/api/v2" +base_image_url = "https://www.magentasport.de" oauth_url = "https://accounts.login.idm.telekom.com/oauth2/tokens" -jwt_url = "https://www.telekomsport.de/service/auth/app/login/jwt" -heartbeat_url = "https://www.telekomsport.de/service/heartbeat" -stream_url = "https://www.telekomsport.de/service/player/streamAccess" +jwt_url = "https://www.magentasport.de/service/auth/app/login/jwt" +heartbeat_url = "https://www.magentasport.de/service/heartbeat" +stream_url = "https://www.magentasport.de/service/player/streamAccess" main_page = "/navigation" ########### @@ -119,41 +120,12 @@ def getMain(): li.setArt({'fanart': jsonLive['data']['metadata']['web']['image']}) xbmcplugin.addDirectoryItem(handle=_addon_handler, url=url, listitem=li, isFolder=True) - # get sports categories - def addMainDirectoryItem(content, title): + for content in jsonResult['data']['league_filter']: url = build_url({'mode': content['target_type'], content['target_type']: content['target']}) - icon = "bla" - if 'BBL' in content['title']: - icon = 'bbl' - elif 'EuroLeague' in content['title']: - icon = 'euroleague' - elif 'EuroBasket' in content['title']: - icon = 'eurobasket' - elif 'Deutsche Eishockey Liga' in content['title']: - icon = 'del' - elif '3. Liga' in content['title']: - icon = '3.liga' - elif 'Frauen-Bundesliga' in content['title']: - icon = 'frauen-bundesliga' - elif 'Bayern.tv' in content['title']: - icon = 'fcbtv' - elif u'Fußball-Bundesliga' in content['title']: - icon = 'bundesliga' - elif 'UEFA Champions League' in content['title']: - icon = 'uefa' - elif 'Handball-Bundesliga' in content['title']: - icon = 'hbl' - li = xbmcgui.ListItem(title) - li.setArt({'poster': _icons_path + icon + '.png', 'fanart': _fanart_path + icon + '.jpg'}) + li = xbmcgui.ListItem(content['title']) + li.setArt({'icon': base_image_url + content['logo'], 'fanart': base_image_url + content['logo']}) xbmcplugin.addDirectoryItem(handle=_addon_handler, url=url, listitem=li, isFolder=True) - for content in jsonResult['data']['filter']: - if content['children']: - for child in content['children']: - addMainDirectoryItem(child, content['title'] + ' - ' + child['title']) - else: - addMainDirectoryItem(content, content['title']) - xbmcplugin.endOfDirectory(_addon_handler) @@ -203,7 +175,6 @@ def geteventLane(): xbmcplugin.addDirectoryItem(handle=_addon_handler, url="", listitem=li) eventday = scheduled_start.date() - url = build_url({'mode': 'event', 'event': event['target']}) title = __language__(30003) if event['metadata']['title']: title = event['metadata']['title'] @@ -213,15 +184,17 @@ def geteventLane(): elif event['metadata']['description_bold']: title = event['metadata']['description_bold'] eventinfo = event['metadata']['description_bold'] + ' - ' + event['metadata']['description_regular'] - li = xbmcgui.ListItem('[B]' + title + '[/B] (' + eventinfo + ')', iconImage='https://www.telekomsport.de' + event['metadata']['images']['editorial']) + li = xbmcgui.ListItem('[B]' + title + '[/B] (' + eventinfo + ')', iconImage=base_image_url + event['metadata']['images']['editorial']) li.setInfo('video', {'plot': prettydate(scheduled_start)}) - li.setProperty('fanart_image', 'https://www.telekomsport.de' + event['metadata']['images']['editorial']) + li.setProperty('fanart_image', base_image_url + event['metadata']['images']['editorial']) if event['metadata']['state'] == 'live': li.setProperty('IsPlayable', 'true') li.setInfo('video', {}) + url = build_url({'mode': 'event', 'event': event['target'], 'live': True}) xbmcplugin.addDirectoryItem(handle=_addon_handler, url=url, listitem=li) elif not ('onlylive' in args and args['onlylive']): + url = build_url({'mode': 'event', 'event': event['target']}) xbmcplugin.addDirectoryItem(handle=_addon_handler, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(_addon_handler) @@ -237,34 +210,25 @@ def getevent(): else: xbmcgui.Dialog().ok(_addon_name, __language__(30002)) xbmcplugin.endOfDirectory(_addon_handler, succeeded=False) + elif 'live' in args and args['live']: + if jsonResult['data']['content'][0]['group_elements'][0]['type'] == 'player': + eventVideo = jsonResult['data']['content'][0]['group_elements'][0]['data'][0] + global args + args = {'videoid': eventVideo['videoID'], 'isPay': 'True' if ('pay' in eventVideo and eventVideo['pay']) else 'False'} + getvideo() else: - hasEventVideos = 0 - for content in jsonResult['data']['content']: + for index, content in enumerate(jsonResult['data']['content']): for group_element in content['group_elements']: if group_element['type'] == 'eventVideos': for eventVideo in group_element['data']: - hasEventVideos += 1 - - if jsonResult['data']['content'][0]['group_elements'][0]['type'] == 'player' and (not hasEventVideos or (hasEventVideos == 1 and jsonResult['data']['content'][0]['group_elements'][0]['data'][0]['videoID'] == jsonResult['data']['content'][1]['group_elements'][0]['data'][0]['videoID'])): - isLivestream = 'islivestream' in jsonResult['data']['content'][0]['group_elements'][0]['data'][0] and jsonResult['data']['content'][0]['group_elements'][0]['data'][0]['islivestream'] - isPay = 'pay' in jsonResult['data']['content'][0]['group_elements'][0]['data'][0] and jsonResult['data']['content'][0]['group_elements'][0]['data'][0]['pay'] - url = build_url({'mode': 'video', 'videoid': jsonResult['data']['content'][0]['group_elements'][0]['data'][0]['videoID'], 'isLivestream': isLivestream, 'isPay': isPay}) - xbmc.Player().play(url) - xbmcplugin.endOfDirectory(_addon_handler, succeeded=False) - else: - for content in jsonResult['data']['content']: - for group_element in content['group_elements']: - if group_element['type'] == 'eventVideos': - for eventVideo in group_element['data']: - isLivestream = 'isLivestream' in eventVideo and eventVideo['isLivestream'] - isPay = 'pay' in eventVideo and eventVideo['pay'] - url = build_url({'mode': 'video', 'videoid': eventVideo['videoID'], 'isLivestream': isLivestream, 'isPay': isPay}) - li = xbmcgui.ListItem(eventVideo['title'], iconImage='https://www.telekomsport.de' + eventVideo['images']['editorial']) - li.setProperty('fanart_image', 'https://www.telekomsport.de' + eventVideo['images']['editorial']) - li.setProperty('IsPlayable', 'true') - li.setInfo('video', {}) - xbmcplugin.addDirectoryItem(handle=_addon_handler, url=url, listitem=li) - xbmcplugin.endOfDirectory(_addon_handler) + isPay = 'pay' in eventVideo and eventVideo['pay'] + url = build_url({'mode': 'video', 'videoid': eventVideo['videoID'], 'isPay': isPay}) + li = xbmcgui.ListItem(eventVideo['title'], iconImage=base_image_url + eventVideo['images']['editorial']) + li.setProperty('fanart_image', base_image_url + eventVideo['images']['editorial']) + li.setProperty('IsPlayable', 'true') + li.setInfo('video', {}) + xbmcplugin.addDirectoryItem(handle=_addon_handler, url=url, listitem=li) + xbmcplugin.endOfDirectory(_addon_handler) def getvideo(): videoid = args['videoid'] @@ -276,14 +240,27 @@ def getvideo(): _addon.openSettings() return else: - jwt = get_jwt(_addon.getSetting('username'), _addon.getSetting('password')) + try: + jwt = get_jwt(_addon.getSetting('username'), _addon.getSetting('password')) + except urllib2.HTTPError, e: + response = json.loads(e.read()) + msg = __language__(30005) + if 'error_description' in response: + msg += '\n\n' + msg += __language__(30011) + msg += '\n"' + response['error_description'] + '"' + xbmcgui.Dialog().ok(_addon_name, msg) + xbmcplugin.setResolvedUrl(_addon_handler, False, xbmcgui.ListItem()) + return if jwt: auth_response = auth_media(jwt, videoid) if auth_response != "success": xbmcgui.Dialog().ok(_addon_name, auth_response) + xbmcplugin.setResolvedUrl(_addon_handler, False, xbmcgui.ListItem()) return else: xbmcgui.Dialog().ok(_addon_name, __language__(30005)) + xbmcplugin.setResolvedUrl(_addon_handler, False, xbmcgui.ListItem()) return jwt = jwt or 'empty' diff --git a/fanart.jpg b/fanart.jpg deleted file mode 100644 index 95b10a1..0000000 Binary files a/fanart.jpg and /dev/null differ diff --git a/icon.png b/icon.png deleted file mode 100644 index d0962cb..0000000 Binary files a/icon.png and /dev/null differ diff --git a/resources/fanart.jpg b/resources/fanart.jpg new file mode 100644 index 0000000..d0a87c4 Binary files /dev/null and b/resources/fanart.jpg differ diff --git a/resources/fanart/3.liga.jpg b/resources/fanart/3.liga.jpg deleted file mode 100644 index 48de82a..0000000 Binary files a/resources/fanart/3.liga.jpg and /dev/null differ diff --git a/resources/fanart/bbl.jpg b/resources/fanart/bbl.jpg deleted file mode 100644 index 0ee50cd..0000000 Binary files a/resources/fanart/bbl.jpg and /dev/null differ diff --git a/resources/fanart/bundesliga.jpg b/resources/fanart/bundesliga.jpg deleted file mode 100644 index 9c7972c..0000000 Binary files a/resources/fanart/bundesliga.jpg and /dev/null differ diff --git a/resources/fanart/del.jpg b/resources/fanart/del.jpg deleted file mode 100644 index e8dab37..0000000 Binary files a/resources/fanart/del.jpg and /dev/null differ diff --git a/resources/fanart/eurobasket.jpg b/resources/fanart/eurobasket.jpg deleted file mode 100644 index 5811b0a..0000000 Binary files a/resources/fanart/eurobasket.jpg and /dev/null differ diff --git a/resources/fanart/euroleague.jpg b/resources/fanart/euroleague.jpg deleted file mode 100644 index 6471c87..0000000 Binary files a/resources/fanart/euroleague.jpg and /dev/null differ diff --git a/resources/fanart/fcbtv.jpg b/resources/fanart/fcbtv.jpg deleted file mode 100644 index 9f60f36..0000000 Binary files a/resources/fanart/fcbtv.jpg and /dev/null differ diff --git a/resources/fanart/frauen-bundesliga.jpg b/resources/fanart/frauen-bundesliga.jpg deleted file mode 100644 index 4b47e44..0000000 Binary files a/resources/fanart/frauen-bundesliga.jpg and /dev/null differ diff --git a/resources/fanart/hbl.jpg b/resources/fanart/hbl.jpg deleted file mode 100644 index 6ea04fb..0000000 Binary files a/resources/fanart/hbl.jpg and /dev/null differ diff --git a/resources/fanart/uefa.jpg b/resources/fanart/uefa.jpg deleted file mode 100644 index cd0bd74..0000000 Binary files a/resources/fanart/uefa.jpg and /dev/null differ diff --git a/resources/icon.png b/resources/icon.png new file mode 100644 index 0000000..199425a Binary files /dev/null and b/resources/icon.png differ diff --git a/resources/icons/3.liga.png b/resources/icons/3.liga.png deleted file mode 100644 index 474f641..0000000 Binary files a/resources/icons/3.liga.png and /dev/null differ diff --git a/resources/icons/bbl.png b/resources/icons/bbl.png deleted file mode 100644 index 40dc40a..0000000 Binary files a/resources/icons/bbl.png and /dev/null differ diff --git a/resources/icons/bundesliga.png b/resources/icons/bundesliga.png deleted file mode 100644 index a17507f..0000000 Binary files a/resources/icons/bundesliga.png and /dev/null differ diff --git a/resources/icons/del.png b/resources/icons/del.png deleted file mode 100644 index 938df99..0000000 Binary files a/resources/icons/del.png and /dev/null differ diff --git a/resources/icons/eurobasket.png b/resources/icons/eurobasket.png deleted file mode 100644 index acff464..0000000 Binary files a/resources/icons/eurobasket.png and /dev/null differ diff --git a/resources/icons/euroleague.png b/resources/icons/euroleague.png deleted file mode 100644 index 98d488b..0000000 Binary files a/resources/icons/euroleague.png and /dev/null differ diff --git a/resources/icons/fcbtv.png b/resources/icons/fcbtv.png deleted file mode 100644 index da5e87b..0000000 Binary files a/resources/icons/fcbtv.png and /dev/null differ diff --git a/resources/icons/film.png b/resources/icons/film.png deleted file mode 100644 index eaa069f..0000000 Binary files a/resources/icons/film.png and /dev/null differ diff --git a/resources/icons/frauen-bundesliga.png b/resources/icons/frauen-bundesliga.png deleted file mode 100644 index 3e07023..0000000 Binary files a/resources/icons/frauen-bundesliga.png and /dev/null differ diff --git a/resources/icons/hbl.png b/resources/icons/hbl.png deleted file mode 100644 index 33430ee..0000000 Binary files a/resources/icons/hbl.png and /dev/null differ diff --git a/resources/icons/uefa.png b/resources/icons/uefa.png deleted file mode 100644 index 96f5559..0000000 Binary files a/resources/icons/uefa.png and /dev/null differ diff --git a/resources/language/resource.language.de_de/strings.po b/resources/language/resource.language.de_de/strings.po index 4684c21..85b9bf5 100644 --- a/resources/language/resource.language.de_de/strings.po +++ b/resources/language/resource.language.de_de/strings.po @@ -48,3 +48,7 @@ msgstr "Benutzername" msgctxt "#30010" msgid "Password" msgstr "Passwort" + +msgctxt "#30011" +msgid "Error response from server:" +msgstr "Fehlermeldung vom Server:" diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index d5d30ff..fb714d8 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -48,3 +48,7 @@ msgstr "" msgctxt "#30010" msgid "Password" msgstr "" + +msgctxt "#30011" +msgid "Error response from server:" +msgstr "" diff --git a/resources/language/resource.language.he_il/strings.po b/resources/language/resource.language.he_il/strings.po deleted file mode 100644 index 6a52894..0000000 --- a/resources/language/resource.language.he_il/strings.po +++ /dev/null @@ -1,54 +0,0 @@ -# XBMC Media Center language file -msgid "" -msgstr "" -"Project-Id-Version: kodi-telekomsport\n" -"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" -"PO-Revision-Date: 2017-10-20 08:17+0300\n" -"Last-Translator: A. Dambledore\n" -"Language-Team: Eng2Heb\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: he_IL\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 2.0.4\n" - -msgctxt "#30001" -msgid "Stream starts at" -msgstr "ההזרמה מתחילה ב-" - -msgctxt "#30002" -msgid "Error loading video or no video available." -msgstr "שגיאה בעת טעינת וידאו או אין וידאו זמין." - -msgctxt "#30003" -msgid "Missing title" -msgstr "כותרת חסרה" - -msgctxt "#30004" -msgid "CURRENTLY RUNNING" -msgstr "פועל כעת" - -msgctxt "#30005" -msgid "To watch this video you need a subscription and login credentials. The current credentials produced an authentication error. Please check username and password in addon settings." -msgstr "צפה בסרטון וידאו זה אתה צריך מנוי אישורי כניסה. האישורים הנוכחית הפיקו שגיאת אימות. בדוק את שם המשתמש והסיסמה בהגדרות ההרחבה." - -msgctxt "#30006" -msgid "Error verifying subscription." -msgstr "שגיאה באימות המנוי." - -msgctxt "#30007" -msgid "Login data missing. Please define username and password first." -msgstr "נתוני ההתחברות חסרים. בבקשה להגדיר שם משתמש וסיסמה קודם." - -msgctxt "#30008" -msgid "General" -msgstr "כללי" - -msgctxt "#30009" -msgid "Username" -msgstr "שם משתמש" - -msgctxt "#30010" -msgid "Password" -msgstr "סיסמה"