blob: 4d046a9dd535e2bbe3ee2683cc726c31f9699cd5 (
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__)
__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_client_id (NEW): " + client_id)
else:
log.debug("emby_client_id: " + 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'
|