Skip to content

Commit

Permalink
Version 0.7.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Paco8 committed Apr 21, 2023
1 parent bfda026 commit ee72eb6
Show file tree
Hide file tree
Showing 7 changed files with 226 additions and 57 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.movistarplus"
name="Movistar+"
version="0.7.6"
version="0.7.7"
provider-name="Paco8">
<requires>
<!--- <import addon="xbmc.python" version="2.25.0"/> -->
Expand Down
32 changes: 32 additions & 0 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ msgctxt "#30024"
msgid "Try to fix error 4027"
msgstr ""

msgctxt "#30025"
msgid "Send video progress to provider's server"
msgstr ""

# For SkyOTT only
msgctxt "#30031"
msgid "Streaming service"
Expand Down Expand Up @@ -204,6 +208,10 @@ msgctxt "#30121"
msgid "Kids"
msgstr ""

msgctxt "#30122"
msgid "Continue watching"
msgstr ""

msgctxt "#30150"
msgid "Close session"
msgstr ""
Expand Down Expand Up @@ -281,6 +289,22 @@ msgctxt "#30174"
msgid "Do you want to delete {}?"
msgstr ""

msgctxt "#30175"
msgid "Add to my list"
msgstr ""

msgctxt "#30176"
msgid "Remove from my list"
msgstr ""

msgctxt "#30177"
msgid "Title added to my list"
msgstr ""

msgctxt "#30178"
msgid "Title removed from my list"
msgstr ""

msgctxt "#30180"
msgid "Profiles"
msgstr ""
Expand Down Expand Up @@ -333,6 +357,14 @@ msgctxt "#30204"
msgid "Video not available"
msgstr ""

msgctxt "#30205"
msgid "No playback URL"
msgstr ""

msgctxt "#30206"
msgid "Proxy is not running"
msgstr ""

# For Orange and Movistar only
msgctxt "#30300"
msgid "IPTV Manager"
Expand Down
32 changes: 32 additions & 0 deletions resources/language/resource.language.es_es/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ msgctxt "#30024"
msgid "Try to fix error 4027"
msgstr "Intentar solucionar el error 4027"

msgctxt "#30025"
msgid "Send video progress to provider's server"
msgstr "Enviar progreso al servidor de la plataforma"

msgctxt "#30031"
msgid "Streaming service"
msgstr "Plataforma"
Expand Down Expand Up @@ -185,6 +189,10 @@ msgctxt "#30121"
msgid "Kids"
msgstr "Infantiles"

msgctxt "#30122"
msgid "Continue watching"
msgstr "Seguir viendo"

msgctxt "#30150"
msgid "Close session"
msgstr "Cerrar sesión"
Expand Down Expand Up @@ -257,6 +265,22 @@ msgctxt "#30174"
msgid "Do you want to delete {}?"
msgstr "¿Quieres borrar {}?"

msgctxt "#30175"
msgid "Add to my list"
msgstr "Añadir a mi lista"

msgctxt "#30176"
msgid "Remove from my list"
msgstr "Quitar de mi lista"

msgctxt "#30177"
msgid "Title added to my list"
msgstr "Título añadido a mi lista"

msgctxt "#30178"
msgid "Title removed from my list"
msgstr "Título quitado de mi lista"

msgctxt "#30180"
msgid "Profiles"
msgstr "Perfiles"
Expand Down Expand Up @@ -309,6 +333,14 @@ msgctxt "#30204"
msgid "Video not available"
msgstr "Vídeo no disponible"

msgctxt "#30205"
msgid "No playback URL"
msgstr "No hay URL del vídeo"

msgctxt "#30206"
msgid "Proxy is not running"
msgstr "El proxy no está funcionando"

msgctxt "#30300"
msgid "IPTV Manager"
msgstr "IPTV Manager"
Expand Down
66 changes: 58 additions & 8 deletions resources/lib/movistar.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ def unregister_device(self):
return self.delete_device(self.account['device_id'])

def new_device_id(self):
"""
headers = self.net.headers.copy()
headers['Content-Type'] = 'application/json'
headers['x-movistarplus-ui'] = '2.36.30'
Expand All @@ -343,11 +342,11 @@ def new_device_id(self):
response = self.net.session.post(url, headers=headers)
content = response.content.decode('utf-8')
return content.strip('"')
"""
import random
s = ''
for _ in range(0, 32): s += random.choice('abcdef0123456789')
return s

#import random
#s = ''
#for _ in range(0, 32): s += random.choice('abcdef0123456789')
#return s

def delete_device(self, device_id):
headers = self.net.headers.copy()
Expand Down Expand Up @@ -595,9 +594,38 @@ def download_list(self, url, use_hz = False):
if use_hz:
headers['Authorization'] = 'Bearer ' + self.account['access_token']
headers['X-Hzid'] = self.account['session_token']

return self.net.load_data(url, headers)

def add_to_wishlist(self, id, stype='vod'):
LOG('add_to_wishlist: {} {}'.format(id, stype))
url = self.endpoints['marcadofavoritos2'].format(family=stype)
headers = self.net.headers.copy()
headers['Accept'] = 'application/vnd.miviewtv.v1+json'
headers['Content-Type'] = 'application/json'
headers['X-Hzid'] = self.account['session_token']
post_data = {'objectID': id}
response = self.net.session.post(url, data=json.dumps(post_data), headers=headers)
content = response.content.decode('utf-8')
if response.status_code != 201:
data = json.loads(content)
if 'resultCode' in data:
return data['resultCode'], data['resultText']
return response.status_code, ''

def delete_from_wishlist(self, id, stype='vod'):
url = self.endpoints['borradofavoritos'].format(family=stype, contentId=id)
headers = self.net.headers.copy()
headers['Accept'] = 'application/vnd.miviewtv.v1+json'
headers['Content-Type'] = 'application/json'
headers['X-Hzid'] = self.account['session_token']
response = self.net.session.delete(url, headers=headers)
content = response.content.decode('utf-8')
if response.status_code != 204:
data = json.loads(content)
if 'resultCode' in data:
return data['resultCode'], data['resultText']
return response.status_code, ''

def get_wishlist_url(self):
url = self.endpoints['favoritos'].format(
deviceType='webplayer', DIGITALPLUSUSERIDC=self.account['encoded_user'], PROFILE=self.account['platform'],
Expand Down Expand Up @@ -642,6 +670,8 @@ def get_title(self, data):
t['art']['thumb'] = t['art']['poster']
t['info']['genre'] = ed['GeneroComAntena']
if ed.get('TipoComercial') == 'Impulsivo': return None # Alquiler
if 'Seguible' in ed: t['seguible'] = ed['Seguible']
if 'links' in data: t['links'] = data['links']
if ed['TipoContenido'] in ['Individual', 'Episodio']:
t['type'] = 'movie'
t['stream_type'] = 'vod'
Expand Down Expand Up @@ -681,7 +711,13 @@ def get_title(self, data):
t['type'] = 'season'
t['info']['mediatype'] = 'season'
t['subscribed'] = self.is_subscribed_vod(data.get('tvProducts', []))

if 'DatosAccesoAnonimo' in data:
da = data['DatosAccesoAnonimo']
if 'HoraInicio' in da and da['HoraInicio'] != None:
t['start'] = int(da['HoraInicio'])
t['start_str'] = timestamp2str(t['start'])
t['date_str'] = timestamp2str(t['start'], '%a %d %H:%M')
if t['url'] == '': t['info']['title'] += ' (' + t['date_str'] +')'
return t

def get_list(self, data):
Expand Down Expand Up @@ -766,6 +802,7 @@ def add_video_extra_info(self, t):

def get_seasons(self, id):
url = self.endpoints['ficha'].format(deviceType='webplayer', id=id, profile=self.account['platform'], mediatype='FOTOV', version='7.1', mode='GLOBAL', catalog='', channels='', state='', mdrm='true', demarcation=self.account['demarcation'], legacyBoxOffice='')
#print(url)
data = self.net.load_data(url)
#print_json(data)
res = []
Expand All @@ -783,6 +820,7 @@ def get_seasons(self, id):
t['info']['season'] = c
t['art']['poster'] = t['art']['thumb'] = data['Imagen']
t['subscribed'] = self.is_subscribed_vod(data.get('tvProducts', []))
if 'Seguible' in data: t['seguible'] = data['Seguible']
c += 1
res.append(t)

Expand Down Expand Up @@ -826,6 +864,14 @@ def get_episodes(self, id):
elif video['AssetType'] == 'U7D':
t['stream_type'] = 'u7d'
t['session_request'] = '{"contentID":' + str(t['id']) + ', "streamType":"CUTV"}'
if 'ShowId' in video: t['show_id'] = video['ShowId']
if 'DatosAccesoAnonimo' in d:
da = d['DatosAccesoAnonimo']
if 'HoraInicio' in da and da['HoraInicio'] != None:
t['start'] = int(da['HoraInicio'])
t['start_str'] = timestamp2str(t['start'])
t['date_str'] = timestamp2str(t['start'], '%a %d %H:%M')
if t['url'] == '': t['info']['title'] += ' (' + t['date_str'] +')'
if self.add_extra_info:
self.add_video_extra_info(t)
res.append(t)
Expand Down Expand Up @@ -977,6 +1023,10 @@ def save_key_file(self, d):
data = {'timestamp': int(time.time()*1000), 'response': d}
self.cache.save_file('auth.key', json.dumps(data, ensure_ascii=False))

def delete_session_files(self):
for f in ['access_token.conf', 'account.json', 'device_id.conf', 'devices.json', 'profile_id.conf', 'tokens.json']:
self.cache.remove_file(f)

def get_profile_image_url(self, img_id):
content = self.cache.load_file('avatars.json')
if content:
Expand Down
31 changes: 31 additions & 0 deletions resources/lib/player.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python
# encoding: utf-8
#
# SPDX-License-Identifier: LGPL-2.1-or-later

from __future__ import unicode_literals, absolute_import, division

import xbmc
from .log import LOG

class MyPlayer(xbmc.Player):

def __init__(self):
super(MyPlayer, self).__init__()
self.running = True

def onPlayBackEnded(self):
LOG('onPlayBackEnded')
self.finish()

def onPlayBackError(self):
LOG('onPlayBackError')
self.finish()

def onPlayBackStopped(self):
LOG('onPlayBackStopped')
self.finish()

def finish(self):
LOG('finish')
self.running = False
Loading

0 comments on commit ee72eb6

Please sign in to comment.