'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 xbmc
|
||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
from xml.dom.minidom import parse
|
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
settings = {}
|
settings = {}
|
||||||
try:
|
|
||||||
path = xbmc.translatePath(
|
guisettingsXML = utils.guisettingsXML()
|
||||||
'special://userdata/guisettings.xml').decode('utf-8')
|
|
||||||
guidoc = parse(path)
|
|
||||||
except:
|
|
||||||
print "PlexKodiConnect - Unable to read XBMC's guisettings.xml"
|
|
||||||
|
|
||||||
def getGUI(name):
|
def getGUI(name):
|
||||||
global guidoc
|
|
||||||
if guidoc is None:
|
|
||||||
return False
|
|
||||||
try:
|
try:
|
||||||
return guidoc.getElementsByTagName(name)[0].firstChild.nodeValue
|
return list(guisettingsXML.iter(name))[0].text
|
||||||
except:
|
except:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
|
@ -650,6 +650,23 @@ def musiclibXML():
|
||||||
etree.ElementTree(root).write(xmlpath)
|
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():
|
def advancedSettingsXML():
|
||||||
"""
|
"""
|
||||||
Deactivates Kodi popup for scanning of music library
|
Deactivates Kodi popup for scanning of music library
|
||||||
|
|
Loading…
Reference in a new issue