Removed premature decoding of iXML bytes

This commit is contained in:
Jamie Hardt
2019-01-02 00:17:20 -08:00
parent 9f943aeb61
commit 3e897d030c
2 changed files with 6 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import io
class WavIXMLFormat: class WavIXMLFormat:
""" """
@@ -6,17 +7,18 @@ class WavIXMLFormat:
""" """
def __init__(self, xml): def __init__(self, xml):
self.source = xml self.source = xml
self.parsed = ET.fromstring(xml) xmlBytes = io.BytesIO(xml)
self.parsed = ET.parse(xmlBytes)
def _get_text_value(self, xpath): def _get_text_value(self, xpath):
e = self.parsed.find("./" + xpath) e = self.parsed.find("./" + xpath)
if e is not None: if e is not None:
return e.text return e.text
@property @property
def project(self): def project(self):
return self._get_text_value("PROJECT") return self._get_text_value("PROJECT")
@property @property
def scene(self): def scene(self):
return self._get_text_value("SCENE") return self._get_text_value("SCENE")

View File

@@ -118,7 +118,7 @@ class WavInfoReader():
if ixml_data is None: if ixml_data is None:
return None return None
ixml_string = ixml_data.decode('utf-8') ixml_string = ixml_data
return WavIXMLFormat(ixml_string) return WavIXMLFormat(ixml_string)