blob: bf5ae996425d5a2c782314bbac18ae9f18289547 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# 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__)
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: {0}", 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: {0}", client_id)
guid = xbmcvfs.File(emby_guid_path, 'w')
guid.write(client_id)
guid.close()
log.debug("emby_client_id (NEW): {0}", client_id)
else:
log.debug("emby_client_id: {0}", client_id)
WINDOW.setProperty("client_id", client_id)
return client_id
def getVersion(self):
addon = xbmcaddon.Addon(id="plugin.video.embycon")
version = addon.getAddonInfo("version")
return version
def getClient(self):
return 'Kodi EmbyCon'
|