Version 0.8.14
This commit is contained in:
1 parent
5aa3ce449b
commit
00713ab826
5 files changed
+34
-2
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="plugin.video.movistarplus"
|
||||
name="Movistar+"
|
||||
version="0.8.13"
|
||||
version="0.8.14"
|
||||
provider-name="Paco8">
|
||||
<requires>
|
||||
<!--- <import addon="xbmc.python" version="2.25.0"/> -->
|
||||
|
||||
@@ -429,6 +429,11 @@ msgctxt "#30207"
|
||||
msgid "No user token"
|
||||
msgstr ""
|
||||
|
||||
# For Movistar only
|
||||
msgctxt "#30208"
|
||||
msgid "Session expired"
|
||||
msgstr ""
|
||||
|
||||
# For Orange and Movistar only
|
||||
msgctxt "#30300"
|
||||
msgid "IPTV Manager"
|
||||
|
||||
@@ -405,6 +405,11 @@ msgctxt "#30207"
|
||||
msgid "No user token"
|
||||
msgstr "No hay token de usuario"
|
||||
|
||||
# For Movistar only
|
||||
msgctxt "#30208"
|
||||
msgid "Session expired"
|
||||
msgstr "La sesión ha caducado"
|
||||
|
||||
msgctxt "#30300"
|
||||
msgid "IPTV Manager"
|
||||
msgstr "IPTV Manager"
|
||||
|
||||
@@ -39,6 +39,7 @@ class Movistar(object):
|
||||
|
||||
def __init__(self, config_directory, reuse_devices=False):
|
||||
self.logged = False
|
||||
self.expired_access_token = False
|
||||
|
||||
# Network
|
||||
headers = {
|
||||
@@ -64,10 +65,24 @@ class Movistar(object):
|
||||
|
||||
# Access token
|
||||
self.load_key_file() # Default access_token
|
||||
if self.account['access_token']:
|
||||
exp = self.get_token_expire_date(self.account['access_token'])
|
||||
#LOG('auth.key: expiring date: {}'.format(exp))
|
||||
if exp < time.time():
|
||||
self.expired_access_token = True
|
||||
self.account['access_token'] = None
|
||||
|
||||
content = self.cache.load_file('access_token.conf')
|
||||
if content:
|
||||
exp = self.get_token_expire_date(content)
|
||||
#LOG('access_token.conf: expiring date: {}'.format(exp))
|
||||
if exp < time.time():
|
||||
self.expired_access_token = True
|
||||
else:
|
||||
self.account['access_token'] = content
|
||||
#LOG('access_token: {}'.format(self.account['access_token']))
|
||||
LOG('expired_access_token: {}'.format(self.expired_access_token))
|
||||
|
||||
if not self.account['access_token']: return
|
||||
|
||||
# Account
|
||||
@@ -393,7 +408,9 @@ class Movistar(object):
|
||||
headers['Authorization'] = 'Bearer ' + self.account['access_token']
|
||||
url = self.endpoints['renovacion_cdntoken2'].format(ACCOUNTNUMBER=self.account['id'])
|
||||
data = self.net.post_data(url, None, headers)
|
||||
if isinstance(data, dict):
|
||||
return data.get('access_token')
|
||||
return ''
|
||||
|
||||
def get_session_token(self):
|
||||
data = {"accountNumber": self.account['id'],
|
||||
@@ -1384,7 +1401,8 @@ class Movistar(object):
|
||||
|
||||
def get_token_expire_date(self, token):
|
||||
from .b64 import decode_base64
|
||||
res = None
|
||||
res = 0
|
||||
try:
|
||||
l = token.split('.')
|
||||
if len(l) > 1:
|
||||
padding = len(l[1]) % 4
|
||||
@@ -1392,4 +1410,6 @@ class Movistar(object):
|
||||
s = decode_base64(l[1])
|
||||
data = json.loads(s)
|
||||
res = data['exp']
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
@@ -732,6 +732,8 @@ def router(paramstring):
|
||||
add_menu_option(addon.getLocalizedString(30112), get_url(action='search'), icon='search.png') # Search
|
||||
add_menu_option(addon.getLocalizedString(30180), get_url(action='profiles'), icon='profiles.png') # Profiles
|
||||
add_menu_option(addon.getLocalizedString(30108), get_url(action='devices'), icon='devices.png') # Devices
|
||||
elif m.expired_access_token:
|
||||
show_notification(addon.getLocalizedString(30208))
|
||||
|
||||
add_menu_option(addon.getLocalizedString(30160), get_url(action='user'), icon='account.png') # Accounts
|
||||
close_folder(cacheToDisc=False)
|
||||
|
||||
Reference in new issue
Block a user