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