Add warning for clean on update

This commit is contained in:
angelblue05 2017-07-28 02:11:41 -05:00
commit 23b5b93bdd
4 changed files with 39 additions and 0 deletions

View file

@ -644,6 +644,10 @@ class LibrarySync(threading.Thread):
startupComplete = False
log.warn("---===### Starting LibrarySync ###===---")
if utils.verify_advancedsettings():
# Advancedsettings was modified, Kodi needs to restart
log.warn("###===--- LibrarySync Aborted ---===###")
return
while not self.monitor.abortRequested():

View file

@ -347,3 +347,36 @@ def passwordsXML():
icon="special://home/addons/plugin.video.emby/icon.png",
time=1000,
sound=False)
def verify_advancedsettings():
# Track the existance of <cleanonupdate>true</cleanonupdate>
# incompatible with plugin paths
log.info("verifying advanced settings")
if settings('useDirectPaths') != "0": return
path = xbmc.translatePath("special://userdata/").decode('utf-8')
xmlpath = "%sadvancedsettings.xml" % path
try:
xmlparse = etree.parse(xmlpath)
except: # Document is blank or missing
return
else:
root = xmlparse.getroot()
video = root.find('videolibrary')
if video is not None:
cleanonupdate = video.find('cleanonupdate')
if cleanonupdate is not None and cleanonupdate.text == "true":
log.warn("cleanonupdate disabled")
video.remove(cleanonupdate)
try:
indent(root)
except: pass
etree.ElementTree(root).write(xmlpath)
xbmcgui.Dialog().ok(heading=language(29999), line1=language(33096))
xbmc.executebuiltin('RestartApp')
return True
return