Fix PKC not being able to connect to plex.tv after installation
This commit is contained in:
parent
8acf2f36ca
commit
c6aa4d3021
1 changed files with 20 additions and 15 deletions
|
@ -51,15 +51,7 @@ def getXArgsDeviceInfo(options=None, include_token=True):
|
||||||
return xargs
|
return xargs
|
||||||
|
|
||||||
|
|
||||||
def getDeviceId(reset=False):
|
def generate_device_id():
|
||||||
"""
|
|
||||||
Returns a unique Plex client id "X-Plex-Client-Identifier" from Kodi
|
|
||||||
settings file.
|
|
||||||
Also loads Kodi window property 'plex_client_Id'
|
|
||||||
|
|
||||||
If id does not exist, create one and save in Kodi settings file.
|
|
||||||
"""
|
|
||||||
if reset:
|
|
||||||
LOG.info("Generating a new deviceid.")
|
LOG.info("Generating a new deviceid.")
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
client_id = str(uuid4())
|
client_id = str(uuid4())
|
||||||
|
@ -74,14 +66,27 @@ def getDeviceId(reset=False):
|
||||||
utils.messageDialog(utils.lang(29999), 'Please restart Kodi now!')
|
utils.messageDialog(utils.lang(29999), 'Please restart Kodi now!')
|
||||||
return client_id
|
return client_id
|
||||||
|
|
||||||
|
|
||||||
|
def getDeviceId(reset=False):
|
||||||
|
"""
|
||||||
|
Returns a unique Plex client id "X-Plex-Client-Identifier" from Kodi
|
||||||
|
settings file.
|
||||||
|
Also loads Kodi window property 'plex_client_Id'
|
||||||
|
|
||||||
|
If id does not exist, create one and save in Kodi settings file.
|
||||||
|
"""
|
||||||
|
if reset:
|
||||||
|
return generate_device_id()
|
||||||
|
|
||||||
client_id = v.PKC_MACHINE_IDENTIFIER
|
client_id = v.PKC_MACHINE_IDENTIFIER
|
||||||
if client_id:
|
if client_id:
|
||||||
return client_id
|
return client_id
|
||||||
|
|
||||||
client_id = utils.settings('plex_client_Id')
|
client_id = utils.settings('plex_client_Id')
|
||||||
# Because Kodi appears to cache file settings!!
|
if client_id != "":
|
||||||
if client_id != "" and reset is False:
|
|
||||||
v.PKC_MACHINE_IDENTIFIER = client_id
|
v.PKC_MACHINE_IDENTIFIER = client_id
|
||||||
utils.window('plex_client_Id', value=client_id)
|
utils.window('plex_client_Id', value=client_id)
|
||||||
LOG.info("Unique device Id plex_client_Id loaded: %s", client_id)
|
LOG.info("Unique device Id plex_client_Id loaded: %s", client_id)
|
||||||
return client_id
|
return client_id
|
||||||
|
else:
|
||||||
|
return generate_device_id()
|
||||||
|
|
Loading…
Reference in a new issue