Fix library sync crash due to UnicodeDecodeError

- Fixes #302
This commit is contained in:
tomkat83 2017-05-29 15:39:11 +02:00
parent e917761ae3
commit 8860edd592
3 changed files with 11 additions and 11 deletions

View file

@ -65,7 +65,6 @@ def set_excludefromscan_music_folders():
path = api.validatePlayurl(location.attrib['path'],
typus=v.PLEX_TYPE_ARTIST,
omitCheck=True)
path = tryEncode(path)
paths.append(__turn_to_regex(path))
# Get existing advancedsettings
root, tree = advancedsettings_xml(['audio', 'excludefromscan'],
@ -98,7 +97,7 @@ def set_excludefromscan_music_folders():
if write_xml is True:
indent(tree.getroot())
tree.write('%sadvancedsettings.xml' % v.KODI_PROFILE)
tree.write('%sadvancedsettings.xml' % v.KODI_PROFILE, encoding="UTF-8")
return changed

View file

@ -557,8 +557,8 @@ def __setXMLTag(element, tag, value, attrib=None):
If "subelement" does not exist, create it using attrib and value.
element : etree element
tag : string/unicode for subelement
value : string/unicode
tag : unicode for subelement
value : unicode
attrib : dict; will use etree attrib method
Returns the subelement
@ -657,7 +657,7 @@ def advancedsettings_xml(node_list, new_value=None, attrib=None,
# Indent and make readable
indent(root)
# Safe the changed xml
tree.write(path)
tree.write(path, encoding="UTF-8")
return element, tree
@ -705,7 +705,7 @@ def sourcesXML():
try:
indent(root)
except: pass
etree.ElementTree(root).write(xmlpath)
etree.ElementTree(root).write(xmlpath, encoding="UTF-8")
def passwordsXML():
@ -749,7 +749,8 @@ def passwordsXML():
paths.remove(path)
log.info("Successfully removed credentials for: %s"
% credentials)
etree.ElementTree(root).write(xmlpath)
etree.ElementTree(root).write(xmlpath,
encoding="UTF-8")
break
else:
log.error("Failed to find saved server: %s in passwords.xml"
@ -817,7 +818,7 @@ def passwordsXML():
indent(root)
except:
pass
etree.ElementTree(root).write(xmlpath)
etree.ElementTree(root).write(xmlpath, encoding="UTF-8")
# dialog.notification(
# heading="PlexKodiConnect",

View file

@ -120,7 +120,7 @@ class VideoNodes(object):
indent(root)
except:
pass
etree.ElementTree(root).write(nodeXML)
etree.ElementTree(root).write(nodeXML, encoding="UTF-8")
nodetypes = {
'1': "all",
@ -375,7 +375,7 @@ class VideoNodes(object):
indent(root)
except:
pass
etree.ElementTree(root).write(nodeXML)
etree.ElementTree(root).write(nodeXML, encoding="UTF-8")
def singleNode(self, indexnumber, tagname, mediatype, itemtype):
tagname = tryEncode(tagname)
@ -431,7 +431,7 @@ class VideoNodes(object):
indent(root)
except:
pass
etree.ElementTree(root).write(nodeXML)
etree.ElementTree(root).write(nodeXML, encoding="UTF-8")
def clearProperties(self):