PlexKodiConnect/resources/lib/plexbmchelper/settings.py

43 lines
1.2 KiB
Python
Raw Normal View History

2016-01-15 22:12:52 +11:00
import uuid
import xbmc
import xbmcaddon
from xml.dom.minidom import parse
2016-01-23 03:34:26 +11:00
import utils
2016-01-15 22:12:52 +11:00
settings = {}
try:
guidoc = parse(xbmc.translatePath('special://userdata/guisettings.xml'))
except:
print "Unable to read XBMC's guisettings.xml"
2016-01-15 22:12:52 +11:00
def getGUI(name):
global guidoc
if guidoc is None:
return False
try:
return guidoc.getElementsByTagName(name)[0].firstChild.nodeValue
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')
settings['client_name'] = plexbmc.getSetting('deviceName')
2016-01-15 22:12:52 +11:00
# XBMC web server settings
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')