From f99b3d99da186429572a8fe44ea8f1a237500f95 Mon Sep 17 00:00:00 2001 From: Paco8 <5084042+Paco8@users.noreply.github.com> Date: Thu, 23 Mar 2023 15:17:43 +0100 Subject: [PATCH] Version 0.7.0 --- addon.xml | 2 +- resources/lib/movistar.py | 33 +++++++++++++++++++-------------- resources/settings.xml | 4 ++-- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/addon.xml b/addon.xml index 625409d..922028d 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/resources/lib/movistar.py b/resources/lib/movistar.py index 5406004..4e7cc2d 100644 --- a/resources/lib/movistar.py +++ b/resources/lib/movistar.py @@ -155,9 +155,11 @@ class Movistar(object): self.entitlements['activePurchases'] = data['activePurchases'] self.entitlements['partners'] = data['partners'] self.entitlements['activePackages'] = data['activePackages'] - self.entitlements['vodSubscription'] = data['vodSubscription'].split(',') + self.entitlements['vodSubscription'] = data['vodSubscription'].split(',') if data['linearSubscription'] else [] self.entitlements['linearSubscription'] = data['linearSubscription'].split(',') if data['linearSubscription'] else [] self.entitlements['suscripcion'] = data['suscripcion'] + self.entitlements['tvRights'] = data['tvRights'] + self.entitlements['distilledTvRights'] = data['distilledTvRights'] #print_json(self.entitlements) self.logged = True @@ -517,13 +519,17 @@ class Movistar(object): for e in self.entitlements['activePurchases']: if e['name'] in products: return True + for e in self.entitlements['tvRights']: + if e in products: + return True return False def is_subscribed_vod(self, products): - for p in products: - if p['Nombre'] in self.entitlements['vodSubscription']: - return True - return False + #for p in products: + # if p['Nombre'] in self.entitlements['vodSubscription']: + # return True + #return False + return self.is_subscribed_channel(products) def get_channels(self, add_epg_info = False): if add_epg_info: @@ -556,7 +562,7 @@ class Movistar(object): t['url'] = c['PuntoReproduccion'] t['art']['icon'] = t['art']['thumb'] = t['art']['poster'] = c['Logo'] t['session_request'] = '{"contentID":"'+ t['id'] +'", "streamType":"CHN"}' - t['subscribed'] = self.is_subscribed_channel(c['Productos']) + t['subscribed'] = self.is_subscribed_channel(c.get('tvProducts', [])) t['info']['playcount'] = 1 # Set as watched # epg if add_epg_info: @@ -613,8 +619,7 @@ class Movistar(object): ACCOUNTNUMBER=self.account['id'], profile=self.account['platform'], texto=search_term, - linearSubscription=','.join(self.entitlements['linearSubscription']), - vodSubscription=','.join(self.entitlements['vodSubscription']), + distilledTvRights=','.join(self.entitlements['distilledTvRights']), mdrm='true', demarcation=self.account['demarcation']) return url @@ -633,7 +638,7 @@ class Movistar(object): ed = data['DatosEditoriales'] t['id'] = ed['Id'] t['info']['title'] = ed['Titulo'] - t['art']['poster'] = ed['Imagen'].replace('ywcatalogov', 'dispficha') + t['art']['poster'] = ed.get('Imagen', '').replace('ywcatalogov', 'dispficha') t['art']['thumb'] = t['art']['poster'] t['info']['genre'] = ed['GeneroComAntena'] if ed.get('TipoComercial') == 'Impulsivo': return None # Alquiler @@ -646,7 +651,7 @@ class Movistar(object): t['session_request'] = '' if len(data['VodItems']) > 0: video = data['VodItems'][0] - t['subscribed'] = self.is_subscribed_vod(video['Productos']) + t['subscribed'] = self.is_subscribed_vod(video.get('tvProducts', [])) if not 'UrlVideo' in video: return None t['url'] = video['UrlVideo'] if video['AssetType'] == 'VOD': @@ -671,11 +676,11 @@ class Movistar(object): if ed['TipoContenido'] == 'Serie': t['type'] = 'series' t['info']['mediatype'] = 'tvshow' - t['subscribed'] = self.is_subscribed_vod(data['Productos']) + t['subscribed'] = self.is_subscribed_vod(data.get('tvProducts', [])) if ed['TipoContenido'] == 'Temporada': t['type'] = 'season' t['info']['mediatype'] = 'season' - t['subscribed'] = self.is_subscribed_vod(data['Productos']) + t['subscribed'] = self.is_subscribed_vod(data.get('tvProducts', [])) return t @@ -777,7 +782,7 @@ class Movistar(object): t['info']['plot'] = data['Descripcion'] t['info']['season'] = c t['art']['poster'] = t['art']['thumb'] = data['Imagen'] - t['subscribed'] = self.is_subscribed_vod(data['Productos']) + t['subscribed'] = self.is_subscribed_vod(data.get('tvProducts', [])) c += 1 res.append(t) @@ -812,7 +817,7 @@ class Movistar(object): t['session_request'] = '' if len(d['VodItems']) > 0: video = d['VodItems'][0] - t['subscribed'] = self.is_subscribed_vod(video['Productos']) + t['subscribed'] = self.is_subscribed_vod(video.get('tvProducts', [])) t['url'] = video['UrlVideo'] if video['AssetType'] == 'VOD': t['session_request'] = '{"contentID":' + str(t['id']) + ',"drmMediaID":"' + video['CasId'] +'", "streamType":"AST"}' diff --git a/resources/settings.xml b/resources/settings.xml index a25ffe7..8a38c7e 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -6,8 +6,8 @@ - - + +