diff --git a/default.py b/default.py
index 1bd09c43..eeb99c00 100644
--- a/default.py
+++ b/default.py
@@ -62,7 +62,8 @@ class Main:
'nextup': entrypoint.getNextUpEpisodes,
'inprogressepisodes': entrypoint.getInProgressEpisodes,
'recentepisodes': entrypoint.getRecentEpisodes,
- 'refreshplaylist': entrypoint.refreshPlaylist
+ 'refreshplaylist': entrypoint.refreshPlaylist,
+ 'deviceid': entrypoint.resetDeviceId
}
if "extrafanart" in sys.argv[0]:
diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml
index d20dbf0e..776e06a1 100644
--- a/resources/language/English/strings.xml
+++ b/resources/language/English/strings.xml
@@ -297,6 +297,7 @@
Duration of the video library pop up (in seconds)
Duration of the music library pop up (in seconds)
Server messages
+ Generate a new device Id
Welcome
@@ -331,5 +332,7 @@
Comparing tv shows from:
Comparing episodes from:
Comparing:
+ Failed to generate a new device Id. See your logs for more information.
+ A new device Id has been generated. Kodi will now restart.
diff --git a/resources/lib/clientinfo.py b/resources/lib/clientinfo.py
index 36e7fbea..8b3fe655 100644
--- a/resources/lib/clientinfo.py
+++ b/resources/lib/clientinfo.py
@@ -69,7 +69,7 @@ class ClientInfo():
else:
return "Unknown"
- def getDeviceId(self):
+ def getDeviceId(self, reset=False):
clientId = utils.window('emby_deviceId')
if clientId:
@@ -81,6 +81,10 @@ class ClientInfo():
else:
GUID_file = xbmc.translatePath(os.path.join(addon_path.encode("utf-8"), "machine_guid")).decode('utf-8')
+ if reset and xbmcvfs.exists(GUID_file):
+ # Reset the file
+ xbmcvfs.delete(GUID_file)
+
GUID = xbmcvfs.File(GUID_file)
clientId = GUID.read()
if not clientId:
diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py
index c30a2384..652d089f 100644
--- a/resources/lib/entrypoint.py
+++ b/resources/lib/entrypoint.py
@@ -94,6 +94,30 @@ def doMainListing():
xbmcplugin.endOfDirectory(int(sys.argv[1]))
+
+##### Generate a new deviceId
+def resetDeviceId():
+
+ dialog = xbmcgui.Dialog()
+ language = utils.language
+
+ deviceId_old = utils.window('emby_deviceId')
+ try:
+ utils.window('emby_deviceId', clear=True)
+ deviceId = clientinfo.ClientInfo().getDeviceId(reset=True)
+ except Exception as e:
+ utils.logMsg("EMBY", "Failed to generate a new device Id: %s" % e, 1)
+ dialog.ok(
+ heading="Emby for Kodi",
+ line1=language(33032))
+ else:
+ utils.logMsg("EMBY", "Successfully removed old deviceId: %s New deviceId: %s"
+ % (deviceId_old, deviceId), 1)
+ dialog.ok(
+ heading="Emby for Kodi",
+ line1=language(33033))
+ xbmc.executebuiltin('RestartApp')
+
##### ADD ADDITIONAL USERS #####
def addUser():
diff --git a/resources/settings.xml b/resources/settings.xml
index 7f7482f5..d5d815dc 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -76,5 +76,6 @@
+