mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Add option to generate a new device Id
This commit is contained in:
parent
a0acdd6a7a
commit
dfa5c7b313
5 changed files with 35 additions and 2 deletions
|
@ -62,7 +62,8 @@ class Main:
|
||||||
'nextup': entrypoint.getNextUpEpisodes,
|
'nextup': entrypoint.getNextUpEpisodes,
|
||||||
'inprogressepisodes': entrypoint.getInProgressEpisodes,
|
'inprogressepisodes': entrypoint.getInProgressEpisodes,
|
||||||
'recentepisodes': entrypoint.getRecentEpisodes,
|
'recentepisodes': entrypoint.getRecentEpisodes,
|
||||||
'refreshplaylist': entrypoint.refreshPlaylist
|
'refreshplaylist': entrypoint.refreshPlaylist,
|
||||||
|
'deviceid': entrypoint.resetDeviceId
|
||||||
}
|
}
|
||||||
|
|
||||||
if "extrafanart" in sys.argv[0]:
|
if "extrafanart" in sys.argv[0]:
|
||||||
|
|
|
@ -297,6 +297,7 @@
|
||||||
<string id="30532">Duration of the video library pop up (in seconds)</string>
|
<string id="30532">Duration of the video library pop up (in seconds)</string>
|
||||||
<string id="30533">Duration of the music library pop up (in seconds)</string>
|
<string id="30533">Duration of the music library pop up (in seconds)</string>
|
||||||
<string id="30534">Server messages</string>
|
<string id="30534">Server messages</string>
|
||||||
|
<string id="30535">Generate a new device Id</string>
|
||||||
|
|
||||||
<!-- service add-on -->
|
<!-- service add-on -->
|
||||||
<string id="33000">Welcome</string>
|
<string id="33000">Welcome</string>
|
||||||
|
@ -331,5 +332,7 @@
|
||||||
<string id="33029">Comparing tv shows from:</string>
|
<string id="33029">Comparing tv shows from:</string>
|
||||||
<string id="33030">Comparing episodes from:</string>
|
<string id="33030">Comparing episodes from:</string>
|
||||||
<string id="33031">Comparing:</string>
|
<string id="33031">Comparing:</string>
|
||||||
|
<string id="33032">Failed to generate a new device Id. See your logs for more information.</string>
|
||||||
|
<string id="33033">A new device Id has been generated. Kodi will now restart.</string>
|
||||||
|
|
||||||
</strings>
|
</strings>
|
||||||
|
|
|
@ -69,7 +69,7 @@ class ClientInfo():
|
||||||
else:
|
else:
|
||||||
return "Unknown"
|
return "Unknown"
|
||||||
|
|
||||||
def getDeviceId(self):
|
def getDeviceId(self, reset=False):
|
||||||
|
|
||||||
clientId = utils.window('emby_deviceId')
|
clientId = utils.window('emby_deviceId')
|
||||||
if clientId:
|
if clientId:
|
||||||
|
@ -81,6 +81,10 @@ 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')
|
||||||
|
|
||||||
|
if reset and xbmcvfs.exists(GUID_file):
|
||||||
|
# Reset the file
|
||||||
|
xbmcvfs.delete(GUID_file)
|
||||||
|
|
||||||
GUID = xbmcvfs.File(GUID_file)
|
GUID = xbmcvfs.File(GUID_file)
|
||||||
clientId = GUID.read()
|
clientId = GUID.read()
|
||||||
if not clientId:
|
if not clientId:
|
||||||
|
|
|
@ -94,6 +94,30 @@ def doMainListing():
|
||||||
|
|
||||||
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
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 #####
|
##### ADD ADDITIONAL USERS #####
|
||||||
def addUser():
|
def addUser():
|
||||||
|
|
||||||
|
|
|
@ -76,5 +76,6 @@
|
||||||
<setting id="logLevel" type="enum" label="30004" values="Disabled|Info|Debug" default="1" />
|
<setting id="logLevel" type="enum" label="30004" values="Disabled|Info|Debug" default="1" />
|
||||||
<setting id="startupDelay" type="number" label="30529" default="0" option="int" />
|
<setting id="startupDelay" type="number" label="30529" default="0" option="int" />
|
||||||
<setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=reset)" option="close" />
|
<setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=reset)" option="close" />
|
||||||
|
<setting label="30535" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=deviceid)" />
|
||||||
</category>
|
</category>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
Loading…
Reference in a new issue