diff options
author | Shaun <shaun@bluebit.com.au> | 2017-07-16 00:09:51 +1000 |
---|---|---|
committer | enen92 <enen92@users.noreply.github.com> | 2017-07-15 15:09:51 +0100 |
commit | 49d6dd033fc083c4ee6f69947861c0d923144041 (patch) | |
tree | 541668912f24621431778016b2ad3ccb4ad08698 /plugin.video.embycon/resources/lib/clientinfo.py | |
parent | 09c5e3fe8977c5ffaf6599b3c6a35405a8a141ca (diff) |
[plugin.video.embycon] 1.3.17 (#1309)
[plugin.video.embycon] 1.3.17
Diffstat (limited to 'plugin.video.embycon/resources/lib/clientinfo.py')
-rw-r--r-- | plugin.video.embycon/resources/lib/clientinfo.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/plugin.video.embycon/resources/lib/clientinfo.py b/plugin.video.embycon/resources/lib/clientinfo.py new file mode 100644 index 0000000..273db01 --- /dev/null +++ b/plugin.video.embycon/resources/lib/clientinfo.py @@ -0,0 +1,46 @@ +# Gnu General Public License - see LICENSE.TXT + +from uuid import uuid4 as uuid4 +import xbmcaddon +import xbmc +import xbmcvfs + +from kodi_utils import HomeWindow +from simple_logging import SimpleLogging + +log = SimpleLogging(__name__) +__addon__ = xbmcaddon.Addon(id="plugin.video.embycon") + + +class ClientInformation(): + def getDeviceId(self): + + WINDOW = HomeWindow() + client_id = WINDOW.getProperty("client_id") + + if client_id: + return client_id + + emby_guid_path = xbmc.translatePath("special://temp/embycon_guid").decode('utf-8') + log.debug("emby_guid_path: " + emby_guid_path) + guid = xbmcvfs.File(emby_guid_path) + client_id = guid.read() + guid.close() + + if not client_id: + client_id = str("%012X" % uuid4()) + log.debug("Generating a new guid: " + client_id) + guid = xbmcvfs.File(emby_guid_path, 'w') + guid.write(client_id) + guid.close() + log.debug("emby_guid_path (NEW): " + client_id) + + WINDOW.setProperty("client_id", client_id) + return client_id + + def getVersion(self): + version = __addon__.getAddonInfo("version") + return version + + def getClient(self): + return 'Kodi EmbyCon' |