From 6e601b9061eddea1733cce248a0b9efcbca004fe Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Fri, 21 Sep 2018 04:04:51 -0500 Subject: [PATCH] Fix source nonetype error Just incase, wrap in a try/except because it's not important. --- resources/lib/helper/xmls.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/resources/lib/helper/xmls.py b/resources/lib/helper/xmls.py index d7e22605..1614ca47 100644 --- a/resources/lib/helper/xmls.py +++ b/resources/lib/helper/xmls.py @@ -51,19 +51,19 @@ def sources(): etree.SubElement(source, 'path', attrib={'pathversion': "1"}).text = "smb://" 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'): - if source.text == 'http://kodi.emby.media': - break - else: - source = etree.SubElement(files, 'source') - etree.SubElement(source, 'name').text = "kodi.emby.media" - etree.SubElement(source, 'path', attrib={'pathversion': "1"}).text = "http://kodi.emby.media" - etree.SubElement(source, 'allowsharing').text = "true" + for source in xml.findall('.//path'): + if source.text == 'http://kodi.emby.media': + break + else: + source = etree.SubElement(files, 'source') + etree.SubElement(source, 'name').text = "kodi.emby.media" + etree.SubElement(source, 'path', attrib={'pathversion': "1"}).text = "http://kodi.emby.media" + etree.SubElement(source, 'allowsharing').text = "true" + except Exception as error: + LOG.exception(error) indent(xml) write_xml(etree.tostring(xml, 'UTF-8'), file)