From 20b2061f4f51789a886027381d55275dfbe666bc Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Thu, 10 May 2018 18:21:08 -0500 Subject: [PATCH] Change deviceId --- default.py | 2 +- resources/lib/clientinfo.py | 12 +++++++++--- resources/lib/entrypoint.py | 2 ++ resources/settings.xml | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/default.py b/default.py index e8eac56a..2645750c 100644 --- a/default.py +++ b/default.py @@ -99,7 +99,7 @@ class Main(object): 'inprogressepisodes': entrypoint.getInProgressEpisodes, 'recentepisodes': entrypoint.getRecentEpisodes, 'refreshplaylist': entrypoint.refreshPlaylist, - 'deviceid': entrypoint.resetDeviceId, + #'deviceid': entrypoint.resetDeviceId, 'delete': entrypoint.deleteItem, 'connect': entrypoint.emby_connect, 'backup': entrypoint.emby_backup, diff --git a/resources/lib/clientinfo.py b/resources/lib/clientinfo.py index f2024eb5..126bda39 100644 --- a/resources/lib/clientinfo.py +++ b/resources/lib/clientinfo.py @@ -3,8 +3,9 @@ ################################################################################################# import logging +import hashlib import os -from uuid import uuid4 +import platform import xbmc import xbmcaddon @@ -71,12 +72,13 @@ class ClientInfo(object): return "Unknown" @classmethod - def get_device_id(cls, reset=False): + def get_device_id(cls): client_id = window('emby_deviceId') if client_id: return client_id + """ emby_guid = xbmc.translatePath("special://temp/emby_guid").decode('utf-8') if reset and xbmcvfs.exists(emby_guid): @@ -91,8 +93,12 @@ class ClientInfo(object): guid.write(client_id) 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) return client_id diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 80137ccd..3e5a1f74 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -349,6 +349,7 @@ def emby_backup(): heading="{emby}", line1="%s: %s" % (lang(33091), backup)) +""" ##### Generate a new deviceId def resetDeviceId(): @@ -369,6 +370,7 @@ def resetDeviceId(): heading=lang(29999), line1=lang(33033)) xbmc.executebuiltin('RestartApp') +""" ##### Delete Item def deleteItem(): diff --git a/resources/settings.xml b/resources/settings.xml index 0ed30b50..2e40c39d 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -87,7 +87,7 @@ - +