mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 17:56:11 +00:00
Fix deviceId not generating
Change the logic around xbmcvfs.File() since it doesn't causes an error but instead returns an empty string.
This commit is contained in:
parent
d3dfef4991
commit
c37a9efdf3
1 changed files with 5 additions and 10 deletions
|
@ -81,20 +81,15 @@ class ClientInfo():
|
||||||
else:
|
else:
|
||||||
GUID_file = xbmc.translatePath(os.path.join(addon_path.encode("utf-8"), "machine_guid")).decode('utf-8')
|
GUID_file = xbmc.translatePath(os.path.join(addon_path.encode("utf-8"), "machine_guid")).decode('utf-8')
|
||||||
|
|
||||||
try:
|
GUID = xbmcvfs.File(GUID_file)
|
||||||
GUID = xbmcvfs.File(GUID_file)
|
clientId = GUID.read()
|
||||||
|
if not clientId:
|
||||||
except Exception as e: # machine_guid does not exists.
|
self.logMsg("Generating a new deviceid...", 1)
|
||||||
self.logMsg("Generating a new deviceid: %s" % e, 1)
|
|
||||||
clientId = str("%012X" % uuid4())
|
clientId = str("%012X" % uuid4())
|
||||||
GUID = xbmcvfs.File(GUID_file, 'w')
|
GUID = xbmcvfs.File(GUID_file, 'w')
|
||||||
GUID.write(clientId)
|
GUID.write(clientId)
|
||||||
|
|
||||||
else: # machine_guid already exists. Get guid.
|
GUID.close()
|
||||||
clientId = GUID.read()
|
|
||||||
|
|
||||||
finally:
|
|
||||||
GUID.close()
|
|
||||||
|
|
||||||
self.logMsg("DeviceId loaded: %s" % clientId, 1)
|
self.logMsg("DeviceId loaded: %s" % clientId, 1)
|
||||||
utils.window('emby_deviceId', value=clientId)
|
utils.window('emby_deviceId', value=clientId)
|
||||||
|
|
Loading…
Reference in a new issue