create a empty sources.xml to work with if one does not exist

This commit is contained in:
shaun 2015-03-15 15:18:34 +11:00
parent f5f1589aa6
commit 1971eb8655

View file

@ -86,9 +86,15 @@ def addKodiSource(name, path, type):
else: else:
error = True error = True
if error: # add it to sources.xml
# if adding to the database failed, manually add it to sources.xml
sourcesFile = xbmc.translatePath( "special://profile/sources.xml" ) sourcesFile = xbmc.translatePath( "special://profile/sources.xml" )
# add an emply sources file to work with
if xbmcvfs.exists(sourcesFile) == False:
sources = Element("sources")
video = SubElement(sources, "video")
ET.ElementTree(sources).write(sourcesFile)
if xbmcvfs.exists(sourcesFile): if xbmcvfs.exists(sourcesFile):
tree = ET.ElementTree(file=sourcesFile) tree = ET.ElementTree(file=sourcesFile)
root = tree.getroot() root = tree.getroot()
@ -105,11 +111,7 @@ def addKodiSource(name, path, type):
SubElement(source, "path").text = path SubElement(source, "path").text = path
tree.write(sourcesFile) tree.write(sourcesFile)
#return bool that reboot is needed and manual add of path to kodi #return bool that reboot is needed and manual add of path to kodi
return True #return True
else:
#return false that no reboot is needed
return False
def checkAuthentication(): def checkAuthentication():