From c37a9efdf3badea2ff0a0439495823d2938676d1 Mon Sep 17 00:00:00 2001
From: angelblue05 <tamara.angel05@gmail.com>
Date: Fri, 29 Jan 2016 18:13:13 -0600
Subject: [PATCH] Fix deviceId not generating

Change the logic around xbmcvfs.File() since it doesn't causes an error
but instead returns an empty string.
---
 resources/lib/clientinfo.py | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/resources/lib/clientinfo.py b/resources/lib/clientinfo.py
index 44ed98f2..36e7fbea 100644
--- a/resources/lib/clientinfo.py
+++ b/resources/lib/clientinfo.py
@@ -81,20 +81,15 @@ class ClientInfo():
         else:
             GUID_file = xbmc.translatePath(os.path.join(addon_path.encode("utf-8"), "machine_guid")).decode('utf-8')
 
-        try:
-            GUID = xbmcvfs.File(GUID_file)
-        
-        except Exception as e: # machine_guid does not exists.
-            self.logMsg("Generating a new deviceid: %s" % e, 1)
+        GUID = xbmcvfs.File(GUID_file)
+        clientId = GUID.read()
+        if not clientId:
+            self.logMsg("Generating a new deviceid...", 1)
             clientId = str("%012X" % uuid4())
             GUID = xbmcvfs.File(GUID_file, 'w')
             GUID.write(clientId)
 
-        else: # machine_guid already exists. Get guid.
-            clientId = GUID.read()
-        
-        finally:
-            GUID.close()
+        GUID.close()
 
         self.logMsg("DeviceId loaded: %s" % clientId, 1)
         utils.window('emby_deviceId', value=clientId)