'NameError: global name 'guidoc' is not defined'
This commit is contained in:
parent
9dec68f6d9
commit
7bb765bedd
2 changed files with 21 additions and 12 deletions
|
@ -1,23 +1,15 @@
|
|||
import uuid
|
||||
import xbmc
|
||||
import xbmcaddon
|
||||
from xml.dom.minidom import parse
|
||||
import utils
|
||||
|
||||
settings = {}
|
||||
try:
|
||||
path = xbmc.translatePath(
|
||||
'special://userdata/guisettings.xml').decode('utf-8')
|
||||
guidoc = parse(path)
|
||||
except:
|
||||
print "PlexKodiConnect - Unable to read XBMC's guisettings.xml"
|
||||
|
||||
guisettingsXML = utils.guisettingsXML()
|
||||
|
||||
|
||||
def getGUI(name):
|
||||
global guidoc
|
||||
if guidoc is None:
|
||||
return False
|
||||
try:
|
||||
return guidoc.getElementsByTagName(name)[0].firstChild.nodeValue
|
||||
return list(guisettingsXML.iter(name))[0].text
|
||||
except:
|
||||
return ""
|
||||
|
||||
|
|
|
@ -650,6 +650,23 @@ def musiclibXML():
|
|||
etree.ElementTree(root).write(xmlpath)
|
||||
|
||||
|
||||
def guisettingsXML():
|
||||
"""
|
||||
Returns special://userdata/guisettings.xml as an etree xml root element
|
||||
"""
|
||||
path = xbmc.translatePath("special://profile/").decode('utf-8')
|
||||
xmlpath = "%sguisettings.xml" % path
|
||||
|
||||
try:
|
||||
xmlparse = etree.parse(xmlpath)
|
||||
except:
|
||||
# Document is blank or missing
|
||||
root = etree.Element('settings')
|
||||
else:
|
||||
root = xmlparse.getroot()
|
||||
return root
|
||||
|
||||
|
||||
def advancedSettingsXML():
|
||||
"""
|
||||
Deactivates Kodi popup for scanning of music library
|
||||
|
|
Loading…
Reference in a new issue