PlexKodiConnect/resources/lib/plexbmchelper/settings.py

49 lines
1.3 KiB
Python
Raw Normal View History

2016-01-15 22:12:52 +11:00
import xbmc
import xbmcaddon
2016-01-23 03:34:26 +11:00
import utils
2016-01-15 22:12:52 +11:00
settings = {}
guisettingsXML = utils.guisettingsXML()
2016-01-15 22:12:52 +11:00
def getGUI(name):
try:
2016-03-30 05:17:07 +11:00
ans = list(guisettingsXML.iter(name))[0].text
if ans is None:
ans = ''
return ans
2016-01-15 22:12:52 +11:00
except:
return ""
addon = xbmcaddon.Addon()
plexbmc = xbmcaddon.Addon('plugin.video.plexkodiconnect')
2016-01-15 22:12:52 +11:00
2016-01-23 03:34:26 +11:00
settings['debug'] = utils.settings('companionDebugging')
settings['gdm_debug'] = utils.settings('companionGDMDebugging')
# Transform 'true' into True because of the way Kodi's file settings work
kodiSettingsList = ['debug', 'gdm_debug']
for entry in kodiSettingsList:
if settings[entry] == 'true':
settings[entry] = True
else:
settings[entry] = False
settings['client_name'] = plexbmc.getSetting('deviceName')
2016-01-15 22:12:52 +11:00
# XBMC web server settings
2016-03-25 04:52:02 +11:00
xbmc.sleep(5000)
2016-01-15 22:12:52 +11:00
settings['webserver_enabled'] = (getGUI('webserver') == "true")
settings['port'] = int(getGUI('webserverport'))
settings['user'] = getGUI('webserverusername')
settings['passwd'] = getGUI('webserverpassword')
settings['uuid'] = plexbmc.getSetting('plex_client_Id')
settings['version'] = plexbmc.getAddonInfo('version')
2016-01-15 22:12:52 +11:00
settings['plexbmc_version'] = plexbmc.getAddonInfo('version')
settings['myplex_user'] = plexbmc.getSetting('username')
2016-01-15 22:12:52 +11:00
settings['serverList'] = []
settings['myport'] = addon.getSetting('companionPort')