Fix cElementTree TypeError: cannot serialize

This commit is contained in:
croneter 2018-10-14 11:48:44 +02:00
parent c5e1d7a7df
commit e45a133f51

View file

@ -22,21 +22,21 @@ class VideoNodes(object):
if roottype == 0: if roottype == 0:
# Index # Index
root = etree.Element('node', attrib={'order': "%s" % order}) root = etree.Element('node', {'order': "%s" % order})
elif roottype == 1: elif roottype == 1:
# Filter # Filter
root = etree.Element('node', root = etree.Element('node',
attrib={'order': "%s" % order, 'type': "filter"}) {'order': "%s" % order, 'type': "filter"})
etree.SubElement(root, 'match').text = "all" etree.SubElement(root, 'match').text = "all"
# Add tag rule # Add tag rule
rule = etree.SubElement(root, rule = etree.SubElement(root,
'rule', 'rule',
attrib={'field': "tag", 'operator': "is"}) {'field': "tag", 'operator': "is"})
etree.SubElement(rule, 'value').text = tagname etree.SubElement(rule, 'value').text = tagname
else: else:
# Folder # Folder
root = etree.Element('node', root = etree.Element('node',
attrib={'order': "%s" % order, 'type': "folder"}) {'order': "%s" % order, 'type': "folder"})
etree.SubElement(root, 'label').text = label etree.SubElement(root, 'label').text = label
etree.SubElement(root, 'icon').text = "special://home/addons/plugin.video.plexkodiconnect/icon.png" etree.SubElement(root, 'icon').text = "special://home/addons/plugin.video.plexkodiconnect/icon.png"
@ -391,7 +391,7 @@ class VideoNodes(object):
etree.SubElement(rule, 'value').text = "0" etree.SubElement(rule, 'value').text = "0"
rule2 = etree.SubElement(root, rule2 = etree.SubElement(root,
'rule', 'rule',
attrib={'field': "rating", 'operator': "greaterthan"}) {'field': "rating", 'operator': "greaterthan"})
etree.SubElement(rule2, 'value').text = "7" etree.SubElement(rule2, 'value').text = "7"
elif nodetype == "recentepisodes": elif nodetype == "recentepisodes":
# Kodi Isengard, Jarvis # Kodi Isengard, Jarvis
@ -408,7 +408,7 @@ class VideoNodes(object):
etree.SubElement(root, 'limit').text = limit etree.SubElement(root, 'limit').text = limit
rule = etree.SubElement(root, rule = etree.SubElement(root,
'rule', 'rule',
attrib={'field': "inprogress", 'operator':"true"}) {'field': "inprogress", 'operator':"true"})
try: try:
utils.indent(root) utils.indent(root)
except: except: