From 17a5d64cdca39bef090ba77c2a46b24e819179db Mon Sep 17 00:00:00 2001 From: JinRonin Date: Thu, 25 Jan 2018 13:58:56 +0100 Subject: [plugin.video.dazn] 1.0.7 --- plugin.video.dazn/README.md | 4 ++-- plugin.video.dazn/addon.py | 10 +++++---- plugin.video.dazn/addon.xml | 7 +++--- .../language/resource.language.de_de/strings.po | 12 +++++++---- .../language/resource.language.en_gb/strings.po | 10 ++++++--- .../language/resource.language.fr_ca/strings.po | 16 ++++++++------ .../language/resource.language.fr_fr/strings.po | 16 ++++++++------ plugin.video.dazn/resources/lib/client.py | 4 +--- plugin.video.dazn/resources/lib/common.py | 3 ++- plugin.video.dazn/resources/lib/context.py | 9 ++++++-- .../resources/lib/simple_requests/api.py | 25 ---------------------- 11 files changed, 56 insertions(+), 60 deletions(-) diff --git a/plugin.video.dazn/README.md b/plugin.video.dazn/README.md index 4b3030d..df31167 100644 --- a/plugin.video.dazn/README.md +++ b/plugin.video.dazn/README.md @@ -6,12 +6,12 @@ Any trademarks used belong to their owning companies & organisations. ## Dependencies * valid DAZN subscription (https://www.dazn.com) - * script.module.inputstreamhelper >= 0.2.3 (http://mirrors.kodi.tv/addons/krypton/script.module.inputstreamhelper/) + * script.module.inputstreamhelper (http://mirrors.kodi.tv/addons/krypton/script.module.inputstreamhelper/) This add-on requires Kodi 17.4 or higher with InputStream Adaptive installed. Kodi 18 is required for Android based devices. ## DRM protected streams -DAZN's content is DRM protected and requires the proprietary decryption module Widevine CDM for playback. You will be prompted to install this if you're attempting to play a stream without the binary installed. +DAZN's content is DRM protected and requires the proprietary decryption module Widevine CDM for playback. You will be prompted to install this if you're starting the addon without the binary installed. Most Android devices have built-in support for Widevine DRM and doesn't require any additional binaries. You can see if your Android device supports Widevine DRM using the [DRM Info](https://play.google.com/store/apps/details?id=com.androidfung.drminfo) app available in Play Store. diff --git a/plugin.video.dazn/addon.py b/plugin.video.dazn/addon.py index 8926032..9ec7682 100644 --- a/plugin.video.dazn/addon.py +++ b/plugin.video.dazn/addon.py @@ -40,13 +40,15 @@ def router(paramstring): plugin.open_is_settings() if __name__ == '__main__': - if plugin.get_setting('startup') == 'true': - device_id = plugin.uniq_id() + if plugin.startup: playable = plugin.start_is_helper() - if device_id and playable: - client.startUp(device_id) + client.DEVICE_ID = plugin.uniq_id() + if client.DEVICE_ID and playable: + client.startUp() if client.TOKEN: plugin.set_setting('startup', 'false') + else: + client.TOKEN = '' if client.TOKEN and client.DEVICE_ID: router(sys.argv[2][1:]) diff --git a/plugin.video.dazn/addon.xml b/plugin.video.dazn/addon.xml index f54d7e2..6dd0e80 100644 --- a/plugin.video.dazn/addon.xml +++ b/plugin.video.dazn/addon.xml @@ -1,9 +1,8 @@ - + - - + video @@ -11,7 +10,7 @@ -- code update +- fix possible error at startup (missing self) - removed pydes as dependency (user credentials will not be saved) - widevine and unique id check only once at addon startup - added screenshots diff --git a/plugin.video.dazn/resources/language/resource.language.de_de/strings.po b/plugin.video.dazn/resources/language/resource.language.de_de/strings.po index 545383e..db607a4 100644 --- a/plugin.video.dazn/resources/language/resource.language.de_de/strings.po +++ b/plugin.video.dazn/resources/language/resource.language.de_de/strings.po @@ -125,17 +125,21 @@ msgid "Schedule" msgstr "Vorschau" msgctxt "#30213" -msgid "Watch highlights" -msgstr "Highlights ansehen" +msgid "Play Highlights" +msgstr "Highlights wiedergeben" msgctxt "#30214" -msgid "Change to sport" +msgid "Change to Sport" msgstr "Zum Sport wechseln" msgctxt "#30215" -msgid "Change to competition" +msgid "Change to Competition" msgstr "Zum Wettbewerb wechseln" +msgctxt "#30216" +msgid "Play Condensed" +msgstr "Zusammenfassung wiedergeben" + msgctxt "#30221" msgid "Today" msgstr "Heute" diff --git a/plugin.video.dazn/resources/language/resource.language.en_gb/strings.po b/plugin.video.dazn/resources/language/resource.language.en_gb/strings.po index 73be772..82bc146 100644 --- a/plugin.video.dazn/resources/language/resource.language.en_gb/strings.po +++ b/plugin.video.dazn/resources/language/resource.language.en_gb/strings.po @@ -125,15 +125,19 @@ msgid "Schedule" msgstr "" msgctxt "#30213" -msgid "Watch highlights" +msgid "Play Highlights" msgstr "" msgctxt "#30214" -msgid "Change to sport" +msgid "Change to Sport" msgstr "" msgctxt "#30215" -msgid "Change to competition" +msgid "Change to Competition" +msgstr "" + +msgctxt "#30216" +msgid "Play Condensed" msgstr "" msgctxt "#30221" diff --git a/plugin.video.dazn/resources/language/resource.language.fr_ca/strings.po b/plugin.video.dazn/resources/language/resource.language.fr_ca/strings.po index 3c05ea4..6b2bf01 100644 --- a/plugin.video.dazn/resources/language/resource.language.fr_ca/strings.po +++ b/plugin.video.dazn/resources/language/resource.language.fr_ca/strings.po @@ -125,16 +125,20 @@ msgid "Schedule" msgstr "Horaire" msgctxt "#30213" -msgid "Watch highlights" -msgstr "Faits saillants" +msgid "Play Highlights" +msgstr "Lire Saillants" msgctxt "#30214" -msgid "Change to sport" -msgstr "Aller à la sport" +msgid "Change to Sport" +msgstr "Aller à la Sport" msgctxt "#30215" -msgid "Change to competition" -msgstr "Aller à la concurrence" +msgid "Change to Competition" +msgstr "Aller à la Concurrence" + +msgctxt "#30216" +msgid "Play Condensed" +msgstr "Lire Condensed" msgctxt "#30221" msgid "Today" diff --git a/plugin.video.dazn/resources/language/resource.language.fr_fr/strings.po b/plugin.video.dazn/resources/language/resource.language.fr_fr/strings.po index d5e4fde..b91d4a7 100644 --- a/plugin.video.dazn/resources/language/resource.language.fr_fr/strings.po +++ b/plugin.video.dazn/resources/language/resource.language.fr_fr/strings.po @@ -125,16 +125,20 @@ msgid "Schedule" msgstr "Horaire" msgctxt "#30213" -msgid "Watch highlights" -msgstr "Faits saillants" +msgid "Play Highlights" +msgstr "Lire Saillants" msgctxt "#30214" -msgid "Change to sport" -msgstr "Aller à la sport" +msgid "Change to Sport" +msgstr "Aller à la Sport" msgctxt "#30215" -msgid "Change to competition" -msgstr "Aller à la concurrence" +msgid "Change to Competition" +msgstr "Aller à la Concurrence" + +msgctxt "#30216" +msgid "Play Condensed" +msgstr "Lire Condensed" msgctxt "#30221" msgid "Today" diff --git a/plugin.video.dazn/resources/lib/client.py b/plugin.video.dazn/resources/lib/client.py index b09521e..f13e0ed 100644 --- a/plugin.video.dazn/resources/lib/client.py +++ b/plugin.video.dazn/resources/lib/client.py @@ -132,10 +132,8 @@ class Client: else: self.setToken(data['AuthToken'], data.get('Result', 'RefreshAccessTokenError')) - def startUp(self, device_id=''): + def startUp(self): kodi_language = self.plugin.get_language() - if device_id != '': - self.DEVICE_ID = device_id self.POST_DATA = { 'LandingPageKey': 'generic', 'Languages': '{0}, {1}'.format(kodi_language, self.LANGUAGE), diff --git a/plugin.video.dazn/resources/lib/common.py b/plugin.video.dazn/resources/lib/common.py index d171d9a..5c3efe0 100644 --- a/plugin.video.dazn/resources/lib/common.py +++ b/plugin.video.dazn/resources/lib/common.py @@ -29,6 +29,7 @@ class Common: self.content = addon.getSetting('content') self.view_id = addon.getSetting('view_id') self.force_view = addon.getSetting('force_view') == 'true' + self.startup = addon.getSetting('startup') == 'true' def utfenc(self, text): result = text @@ -114,7 +115,7 @@ class Common: if ":" in mac_addr: device_id = str(uuid.UUID(hashlib.md5(str(mac_addr.decode("utf-8"))).hexdigest())) else: - log("[{0}] error: failed to get device id ({1})".format(self.addon_id, str(mac_addr))) + self.log("[{0}] error: failed to get device id ({1})".format(self.addon_id, str(mac_addr))) self.dialog_ok(30051) self.set_setting('device_id', device_id) return device_id diff --git a/plugin.video.dazn/resources/lib/context.py b/plugin.video.dazn/resources/lib/context.py index d84cbb1..a4df55d 100644 --- a/plugin.video.dazn/resources/lib/context.py +++ b/plugin.video.dazn/resources/lib/context.py @@ -24,15 +24,20 @@ class Context: self.cm.append((self.plugin.get_string(30231), 'ActivateWindow(Videos, {0})'.format(self.plugin.build_url(d)))) return self.cm - def related(self, cm_items): + def related(self, cm_items): for i in cm_items: + type_ = i['type'] + if type_ == 'Highlights': + type_ = self.plugin.get_string(30213) + elif type_ == 'Condensed': + type_ = self.plugin.get_string(30216) d = { 'mode': 'play_context', 'title': self.plugin.utfenc(i['title']), 'id': i.get('id', ''), 'params': i.get('params','') } - self.cm.append((self.plugin.get_string(30213), 'XBMC.RunPlugin({0})'.format(self.plugin.build_url(d)))) + self.cm.append((type_, 'XBMC.RunPlugin({0})'.format(self.plugin.build_url(d)))) return self.cm def goto(self, item): diff --git a/plugin.video.dazn/resources/lib/simple_requests/api.py b/plugin.video.dazn/resources/lib/simple_requests/api.py index 35f6148..10e6ec6 100644 --- a/plugin.video.dazn/resources/lib/simple_requests/api.py +++ b/plugin.video.dazn/resources/lib/simple_requests/api.py @@ -42,8 +42,6 @@ class Response(): def json(self): return real_json.loads(self.text) - pass - def _request(method, url, params=None, @@ -62,7 +60,6 @@ def _request(method, url, json=None): if not headers: headers = {} - pass url = urllib.quote(url, safe="%/:=&?~#+!$,;'@()*[]") @@ -77,13 +74,11 @@ def _request(method, url, ssl_context.check_hostname = False ssl_context.verify_mode = ssl.CERT_NONE handlers.append(urllib2.HTTPSHandler(context=ssl_context)) - pass # handlers.append(urllib2.HTTPCookieProcessor()) # handlers.append(ErrorHandler) if not allow_redirects: handlers.append(NoRedirectHandler) - pass opener = urllib2.build_opener(*handlers) query = '' @@ -92,20 +87,14 @@ def _request(method, url, value = params[key] if isinstance(value, str): value = value.decode('utf-8') - pass params[key] = value.encode('utf-8') - pass query = urllib.urlencode(params) - pass if query: url += '?%s' % query - pass request = urllib2.Request(url) if headers: for key in headers: request.add_header(key, str(unicode(headers[key]).encode('utf-8'))) - pass - pass if data or json: if headers.get('Content-Type', '').startswith('application/x-www-form-urlencoded') and data: # transform a string into a map of values @@ -115,37 +104,26 @@ def _request(method, url, for item in _data: name, value = item.split('=') data[name] = value - pass - pass # encode each value for key in data: data[key] = data[key].encode('utf-8') - pass # urlencode request.data = urllib.urlencode(data) - pass elif headers.get('Content-Type', '').startswith('application/json') and data: request.data = real_json.dumps(data).encode('utf-8') - pass elif json: request.data = real_json.dumps(json).encode('utf-8') - pass else: if not isinstance(data, basestring): data = str(data) - pass if isinstance(data, str): data = data.encode('utf-8') - pass request.data = data - pass - pass elif method.upper() in ['POST', 'PUT']: request.data = "null" - pass request.get_method = lambda: method result = Response() response = None @@ -155,8 +133,6 @@ def _request(method, url, # HTTPError implements addinfourl, so we can use the exception to construct a response if isinstance(e, urllib2.addinfourl): response = e - pass - pass # process response result.headers.update(response.headers) @@ -165,7 +141,6 @@ def _request(method, url, buf = StringIO(response.read()) f = gzip.GzipFile(fileobj=buf) result.text = f.read() - pass else: result.text = response.read() -- cgit v1.2.3