mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
User added to return userdata
Return userdata from settings.xml. The methods found here should be used to build other methods. This will keep the data more centralized.
This commit is contained in:
parent
42220765dd
commit
f5f1589aa6
1 changed files with 59 additions and 7 deletions
|
@ -1,12 +1,36 @@
|
||||||
from uuid import uuid4 as uuid4
|
################################################################
|
||||||
|
# CLIENTINFORMATION: centralized client data
|
||||||
|
# -------------------------------
|
||||||
|
# addonId, addon version, clientId, platform
|
||||||
|
################################################################
|
||||||
|
# USER: centralized Userdata
|
||||||
|
# -------------------------------
|
||||||
|
# username, userId, token, server, Loglvl
|
||||||
|
################################################################
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
import os
|
import os
|
||||||
|
from uuid import uuid4 as uuid4
|
||||||
from Lock import Lock
|
from Lock import Lock
|
||||||
|
|
||||||
class ClientInformation():
|
class ClientInformation():
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
addonId = self.getAddonId()
|
||||||
|
self.addon = xbmcaddon.Addon(id=addonId)
|
||||||
|
|
||||||
|
def getAddonId(self):
|
||||||
|
# To use when declaring xbmcaddon.Addon(id=addonId)
|
||||||
|
addonId = "plugin.video.mb3sync"
|
||||||
|
return addonId
|
||||||
|
|
||||||
|
def getVersion(self):
|
||||||
|
|
||||||
|
version = self.addon.getAddonInfo('version')
|
||||||
|
return version
|
||||||
|
|
||||||
def getMachineId(self):
|
def getMachineId(self):
|
||||||
|
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
|
@ -16,7 +40,7 @@ class ClientInformation():
|
||||||
return clientId
|
return clientId
|
||||||
|
|
||||||
# we need to load and or generate a client machine id
|
# we need to load and or generate a client machine id
|
||||||
__addon__ = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
__addon__ = self.addon
|
||||||
__addondir__ = xbmc.translatePath( __addon__.getAddonInfo('path'))
|
__addondir__ = xbmc.translatePath( __addon__.getAddonInfo('path'))
|
||||||
machine_guid_lock_path = os.path.join(__addondir__, "machine_guid.lock")
|
machine_guid_lock_path = os.path.join(__addondir__, "machine_guid.lock")
|
||||||
machine_guid_path = os.path.join(__addondir__, "machine_guid")
|
machine_guid_path = os.path.join(__addondir__, "machine_guid")
|
||||||
|
@ -48,11 +72,6 @@ class ClientInformation():
|
||||||
|
|
||||||
return clientId
|
return clientId
|
||||||
|
|
||||||
def getVersion(self):
|
|
||||||
version = xbmcaddon.Addon(id="plugin.video.mb3sync").getAddonInfo("version")
|
|
||||||
return version
|
|
||||||
|
|
||||||
|
|
||||||
def getPlatform(self):
|
def getPlatform(self):
|
||||||
|
|
||||||
if xbmc.getCondVisibility('system.platform.osx'):
|
if xbmc.getCondVisibility('system.platform.osx'):
|
||||||
|
@ -69,3 +88,36 @@ class ClientInformation():
|
||||||
return "Linux/Android"
|
return "Linux/Android"
|
||||||
|
|
||||||
return "Unknown"
|
return "Unknown"
|
||||||
|
|
||||||
|
|
||||||
|
class User(ClientInformation):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
addonId = self.getAddonId()
|
||||||
|
self.addon = xbmcaddon.Addon(id=addonId)
|
||||||
|
|
||||||
|
def getUsername(self):
|
||||||
|
|
||||||
|
username = self.addon.getSetting('username')
|
||||||
|
return username
|
||||||
|
|
||||||
|
def getUserId(self):
|
||||||
|
|
||||||
|
userId = self.addon.getSetting('userId')
|
||||||
|
return userId
|
||||||
|
|
||||||
|
def getToken(self):
|
||||||
|
|
||||||
|
token = self.addon.getSetting('token')
|
||||||
|
return token
|
||||||
|
|
||||||
|
def getServer(self):
|
||||||
|
|
||||||
|
host = self.addon.getSetting('ipaddress')
|
||||||
|
port = self.addon.getSetting('port')
|
||||||
|
return host + ":" + port
|
||||||
|
|
||||||
|
def getLoglvl(self):
|
||||||
|
|
||||||
|
level = self.addon.getSetting('loglevel')
|
||||||
|
return level
|
||||||
|
|
Loading…
Reference in a new issue