Fix source nonetype error

Just incase, wrap in a try/except because it's not important.
This commit is contained in:
angelblue05 2018-09-21 04:04:51 -05:00
parent d07d1fcc89
commit 6e601b9061

View file

@ -51,10 +51,8 @@ def sources():
etree.SubElement(source, 'path', attrib={'pathversion': "1"}).text = "smb://" etree.SubElement(source, 'path', attrib={'pathversion': "1"}).text = "smb://"
etree.SubElement(source, 'allowsharing').text = "true" etree.SubElement(source, 'allowsharing').text = "true"
files = xml.find('files') try:
files = xml.find('files') or etree.SubElement(xml, 'files')
if files is None:
files = etree.SubElement(xml, 'files')
for source in xml.findall('.//path'): for source in xml.findall('.//path'):
if source.text == 'http://kodi.emby.media': if source.text == 'http://kodi.emby.media':
@ -64,6 +62,8 @@ def sources():
etree.SubElement(source, 'name').text = "kodi.emby.media" etree.SubElement(source, 'name').text = "kodi.emby.media"
etree.SubElement(source, 'path', attrib={'pathversion': "1"}).text = "http://kodi.emby.media" etree.SubElement(source, 'path', attrib={'pathversion': "1"}).text = "http://kodi.emby.media"
etree.SubElement(source, 'allowsharing').text = "true" etree.SubElement(source, 'allowsharing').text = "true"
except Exception as error:
LOG.exception(error)
indent(xml) indent(xml)
write_xml(etree.tostring(xml, 'UTF-8'), file) write_xml(etree.tostring(xml, 'UTF-8'), file)