mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
Fix source nonetype error
Just incase, wrap in a try/except because it's not important.
This commit is contained in:
parent
d07d1fcc89
commit
6e601b9061
1 changed files with 12 additions and 12 deletions
|
@ -51,19 +51,19 @@ 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:
|
for source in xml.findall('.//path'):
|
||||||
files = etree.SubElement(xml, 'files')
|
if source.text == 'http://kodi.emby.media':
|
||||||
|
break
|
||||||
for source in xml.findall('.//path'):
|
else:
|
||||||
if source.text == 'http://kodi.emby.media':
|
source = etree.SubElement(files, 'source')
|
||||||
break
|
etree.SubElement(source, 'name').text = "kodi.emby.media"
|
||||||
else:
|
etree.SubElement(source, 'path', attrib={'pathversion': "1"}).text = "http://kodi.emby.media"
|
||||||
source = etree.SubElement(files, 'source')
|
etree.SubElement(source, 'allowsharing').text = "true"
|
||||||
etree.SubElement(source, 'name').text = "kodi.emby.media"
|
except Exception as error:
|
||||||
etree.SubElement(source, 'path', attrib={'pathversion': "1"}).text = "http://kodi.emby.media"
|
LOG.exception(error)
|
||||||
etree.SubElement(source, 'allowsharing').text = "true"
|
|
||||||
|
|
||||||
indent(xml)
|
indent(xml)
|
||||||
write_xml(etree.tostring(xml, 'UTF-8'), file)
|
write_xml(etree.tostring(xml, 'UTF-8'), file)
|
||||||
|
|
Loading…
Reference in a new issue