Add verify advanced settings

To remove cleanonupdate if plugin paths are used
This commit is contained in:
angelblue05 2018-09-07 16:34:14 -05:00
parent b41721907c
commit 2c0f6a16a0
2 changed files with 24 additions and 24 deletions

View file

@ -41,7 +41,9 @@ class FullSync(object):
else: else:
self.mapping() self.mapping()
self.start() xmls.sources()
if not xmls.advanced_settings():
self.start()
def mapping(self): def mapping(self):
@ -111,7 +113,6 @@ class FullSync(object):
''' Main sync process. ''' Main sync process.
''' '''
xmls.sources()
start_time = datetime.datetime.now() start_time = datetime.datetime.now()
for library in list(self.sync['Libraries']): for library in list(self.sync['Libraries']):

View file

@ -9,7 +9,7 @@ import xml.etree.ElementTree as etree
import xbmc import xbmc
from . import _, indent, write_xml from . import _, indent, write_xml, dialog
################################################################################################# #################################################################################################
@ -80,37 +80,36 @@ def tvtunes_nfo(path, urls):
indent(xml) indent(xml)
write_xml(etree.tostring(xml, 'UTF-8'), path) write_xml(etree.tostring(xml, 'UTF-8'), path)
""" def advanced_settings():
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') ''' Track the existence of <cleanonupdate>true</cleanonupdate>
xmlpath = "%sadvancedsettings.xml" % path It is incompatible with plugin paths.
'''
if settings('useDirectPaths') != "0":
return
path = xbmc.translatePath("special://profile/").decode('utf-8')
file = os.path.join(path, 'advancedsettings.xml')
try: try:
xmlparse = etree.parse(xmlpath) xml = etree.parse(file).getroot()
except: # Document is blank or missing except Exception:
return return
else:
root = xmlparse.getroot()
video = root.find('videolibrary') video = root.find('videolibrary')
if video is not None: if video is not None:
cleanonupdate = video.find('cleanonupdate') cleanonupdate = video.find('cleanonupdate')
if cleanonupdate is not None and cleanonupdate.text == "true": if cleanonupdate is not None and cleanonupdate.text == "true":
log.warn("cleanonupdate disabled")
LOG.warn("cleanonupdate disabled")
video.remove(cleanonupdate) video.remove(cleanonupdate)
try: indent(xml)
indent(root) write_xml(etree.tostring(xml, 'UTF-8'), path)
except: pass
etree.ElementTree(root).write(xmlpath)
xbmcgui.Dialog().ok(heading=language(29999), line1=language(33097)) xbmcgui.Dialog().ok(heading=language(29999), line1=language(33097))
xbmc.executebuiltin('RestartApp') xbmc.executebuiltin('RestartApp')
return True return True
return
"""