Revert "Revert deviceId changes"

This reverts commit ba7e369835.
This commit is contained in:
angelblue05 2016-01-29 17:53:52 -06:00
parent ba7e369835
commit d3dfef4991

View file

@ -76,15 +76,18 @@ class ClientInfo():
return clientId return clientId
addon_path = self.addon.getAddonInfo('path').decode('utf-8') addon_path = self.addon.getAddonInfo('path').decode('utf-8')
if os.path.supports_unicode_filenames:
GUID_file = xbmc.translatePath(os.path.join(addon_path, "machine_guid")).decode('utf-8') GUID_file = xbmc.translatePath(os.path.join(addon_path, "machine_guid")).decode('utf-8')
else:
GUID_file = xbmc.translatePath(os.path.join(addon_path.encode("utf-8"), "machine_guid")).decode('utf-8')
try: try:
GUID = open(GUID_file) GUID = xbmcvfs.File(GUID_file)
except Exception as e: # machine_guid does not exists. except Exception as e: # machine_guid does not exists.
self.logMsg("Generating a new deviceid: %s" % e, 1) self.logMsg("Generating a new deviceid: %s" % e, 1)
clientId = str("%012X" % uuid4()) clientId = str("%012X" % uuid4())
GUID = open(GUID_file, 'w') GUID = xbmcvfs.File(GUID_file, 'w')
GUID.write(clientId) GUID.write(clientId)
else: # machine_guid already exists. Get guid. else: # machine_guid already exists. Get guid.