Change deviceId

This commit is contained in:
angelblue05 2018-05-10 18:21:08 -05:00
parent 386e6bc14a
commit 20b2061f4f
4 changed files with 13 additions and 5 deletions

View file

@ -99,7 +99,7 @@ class Main(object):
'inprogressepisodes': entrypoint.getInProgressEpisodes, 'inprogressepisodes': entrypoint.getInProgressEpisodes,
'recentepisodes': entrypoint.getRecentEpisodes, 'recentepisodes': entrypoint.getRecentEpisodes,
'refreshplaylist': entrypoint.refreshPlaylist, 'refreshplaylist': entrypoint.refreshPlaylist,
'deviceid': entrypoint.resetDeviceId, #'deviceid': entrypoint.resetDeviceId,
'delete': entrypoint.deleteItem, 'delete': entrypoint.deleteItem,
'connect': entrypoint.emby_connect, 'connect': entrypoint.emby_connect,
'backup': entrypoint.emby_backup, 'backup': entrypoint.emby_backup,

View file

@ -3,8 +3,9 @@
################################################################################################# #################################################################################################
import logging import logging
import hashlib
import os import os
from uuid import uuid4 import platform
import xbmc import xbmc
import xbmcaddon import xbmcaddon
@ -71,12 +72,13 @@ class ClientInfo(object):
return "Unknown" return "Unknown"
@classmethod @classmethod
def get_device_id(cls, reset=False): def get_device_id(cls):
client_id = window('emby_deviceId') client_id = window('emby_deviceId')
if client_id: if client_id:
return client_id return client_id
"""
emby_guid = xbmc.translatePath("special://temp/emby_guid").decode('utf-8') emby_guid = xbmc.translatePath("special://temp/emby_guid").decode('utf-8')
if reset and xbmcvfs.exists(emby_guid): if reset and xbmcvfs.exists(emby_guid):
@ -91,8 +93,12 @@ class ClientInfo(object):
guid.write(client_id) guid.write(client_id)
guid.close() guid.close()
"""
log.info("DeviceId loaded: %s", client_id) guid = xbmc.getInfoLabel('Network.MacAddress') or ''.join(platform.uname())
client_id = hashlib.sha1(guid).hexdigest().upper()
xbmc.log("EMBY DeviceId: %s" % client_id, level=xbmc.LOGNOTICE)
window('emby_deviceId', value=client_id) window('emby_deviceId', value=client_id)
return client_id return client_id

View file

@ -349,6 +349,7 @@ def emby_backup():
heading="{emby}", heading="{emby}",
line1="%s: %s" % (lang(33091), backup)) line1="%s: %s" % (lang(33091), backup))
"""
##### Generate a new deviceId ##### Generate a new deviceId
def resetDeviceId(): def resetDeviceId():
@ -369,6 +370,7 @@ def resetDeviceId():
heading=lang(29999), heading=lang(29999),
line1=lang(33033)) line1=lang(33033))
xbmc.executebuiltin('RestartApp') xbmc.executebuiltin('RestartApp')
"""
##### Delete Item ##### Delete Item
def deleteItem(): def deleteItem():

View file

@ -87,7 +87,7 @@
<setting id="metricLogging" type="bool" label="30546" default="true" /> <setting id="metricLogging" type="bool" label="30546" default="true" />
<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)" /> <!--<setting label="30535" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=deviceid)" />-->
<setting label="33093" type="folder" id="backupPath" option="writeable" /> <setting label="33093" type="folder" id="backupPath" option="writeable" />
<setting label="33092" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=backup)" visible="!eq(-1,)" option="close" /> <setting label="33092" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=backup)" visible="!eq(-1,)" option="close" />
</category> </category>