diff --git a/addon.xml b/addon.xml index 8cb8694..baa15b1 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/resources/lib/movistar.py b/resources/lib/movistar.py index 2e00225..8c1ed77 100644 --- a/resources/lib/movistar.py +++ b/resources/lib/movistar.py @@ -1035,6 +1035,25 @@ class Movistar(object): t['stream_type'] = 'u7d' t['session_request'] = '{"contentID":' + str(t['id']) + ', "streamType":"CUTV"}' if 'ShowId' in video: t['show_id'] = video['ShowId'] + elif 'Pases' in d and len(d['Pases']) > 0: + video = d['Pases'][0] + t['subscribed'] = self.is_subscribed_vod(video.get('tvProducts', [])) + if 'ShowId' in video: t['show_id'] = video['ShowId'] + if 'Canal' in video and 'CasId' in video['Canal']: + t['cas_id'] = video['Canal']['CasId'] + stype = None + if 'VODRU7D' in ed['Ficha']: + stype = 'catch-up' + t['stream_type'] = 'u7d' + t['session_request'] = '{"contentID":' + str(t['id']) + ', "streamType":"CUTV"}' + if 'UrlVideo' in video: + t['url'] = video['UrlVideo'] + else: + if stype: + for l in video['links']: + if l['rel'] == stype: + t['url'] = l['href'] + break if 'DatosAccesoAnonimo' in d: da = d['DatosAccesoAnonimo'] t['video_format'] = da.get('FormatoVideo') @@ -1549,6 +1568,12 @@ class Movistar(object): os.makedirs(self.config_dir + name) return name + def download_manifest(self, manifest_url): + headers = self.net.headers.copy() + headers['x-tcdn-token'] = self.get_cdntoken() + content = self.net.load_url(manifest_url, headers) + return content + @staticmethod def load_file_if_exists(filename): content = None diff --git a/resources/lib/plugin.py b/resources/lib/plugin.py index aa4707c..99fd21a 100644 --- a/resources/lib/plugin.py +++ b/resources/lib/plugin.py @@ -147,20 +147,27 @@ def play(params): '8huDxwWFd7OHMs3avGpr7RP7DUnTikXrh6X0') play_item = xbmcgui.ListItem(path= url) - play_item.setProperty('inputstream.adaptive.manifest_type', 'mpd') - #play_item.setProperty('inputstream.adaptive.manifest_type', 'hls') + license_type = 'com.widevine.alpha' + license_key = '' + if format(addon.getSetting('drm_type')) == 'Playready': - play_item.setProperty('inputstream.adaptive.license_type', 'com.microsoft.playready') - else: - play_item.setProperty('inputstream.adaptive.license_type', 'com.widevine.alpha') + license_type = 'com.microsoft.playready' if addon.getSettingBool('use_proxy_for_license') and proxy: request_id = str(int(time.time()*1000)) - license_url = '{}/license?token={}&stype={}&session_request={}&request_id={}||R{{SSM}}|'.format(proxy, quote_plus(token), stype, quote_plus(params['session_request']), request_id) - LOG('license_url: {}'.format(license_url)) - play_item.setProperty('inputstream.adaptive.license_key', license_url) + license_key = '{}/license?token={}&stype={}&session_request={}&request_id={}'.format(proxy, quote_plus(token), stype, quote_plus(params['session_request']), request_id) + LOG('license_key: {}'.format(license_key)) else: - play_item.setProperty('inputstream.adaptive.license_key', '{}|{}&nv-authorizations={}|R{{SSM}}|'.format(license_url, headers, token)) + license_key = license_url + headers += '&nv-authorizations={}'.format(token) + + if kodi_version > 20: + play_item.setProperty('inputstream.adaptive.drm_legacy', '{}|{}|{}'.format(license_type, license_key, headers)) + else: + play_item.setProperty('inputstream.adaptive.license_type', license_type) + play_item.setProperty('inputstream.adaptive.license_key', '{}|{}|R{{SSM}}|'.format(license_key, headers)) + play_item.setProperty('inputstream.adaptive.manifest_type', 'mpd') + #play_item.setProperty('inputstream.adaptive.manifest_type', 'hls') play_item.setProperty('inputstream.adaptive.stream_headers', manifest_headers) play_item.setProperty('inputstream.adaptive.manifest_headers', manifest_headers) @@ -206,7 +213,9 @@ def play(params): for sub in sublist: filename = os.path.join(subfolder, sub['lang']) LOG('Converting {}'.format(sub['filename'])) - response = m.net.session.get(sub['url'], allow_redirects=True) + subheaders = m.net.headers.copy() + subheaders['x-tcdn-token'] = cdn_token + response = m.net.session.get(sub['url'], allow_redirects=True, headers=subheaders) content = response.content with io.open(filename + '.ttml', 'w', encoding='utf-8', newline='') as handle: handle.write(content.decode('utf-8'))