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:
|
2016-01-23 01:37:20 +11:00
|
|
|
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()
|
2016-01-23 01:37:20 +11:00
|
|
|
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')
|
2016-01-23 01:37:20 +11:00
|
|
|
|
2016-01-25 02:12:28 +11:00
|
|
|
# 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
|
|
|
|
|
2016-01-23 01:37:20 +11:00
|
|
|
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')
|
|
|
|
|
2016-01-23 01:37:20 +11:00
|
|
|
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')
|
2016-01-23 01:37:20 +11:00
|
|
|
settings['myplex_user'] = plexbmc.getSetting('username')
|
2016-01-15 22:12:52 +11:00
|
|
|
settings['serverList'] = []
|
2016-01-23 01:37:20 +11:00
|
|
|
settings['myport'] = addon.getSetting('companionPort')
|