mirror of
https://github.com/iluvcapra/wavinfo.git
synced 2026-01-01 09:20:40 +00:00
Formatting, refactoring, __repr__
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#import xml.etree.ElementTree as ET
|
||||
# import xml.etree.ElementTree as ET
|
||||
from lxml import etree as ET
|
||||
import io
|
||||
from collections import namedtuple
|
||||
@@ -6,6 +6,7 @@ from collections import namedtuple
|
||||
|
||||
IXMLTrack = namedtuple('IXMLTrack', ['channel_index', 'interleave_index', 'name', 'function'])
|
||||
|
||||
|
||||
class WavIXMLFormat:
|
||||
"""
|
||||
iXML recorder metadata.
|
||||
@@ -16,9 +17,9 @@ class WavIXMLFormat:
|
||||
:param xml: A bytes-like object containing the iXML payload.
|
||||
"""
|
||||
self.source = xml
|
||||
xmlBytes = io.BytesIO(xml)
|
||||
xml_bytes = io.BytesIO(xml)
|
||||
parser = ET.XMLParser(recover=True)
|
||||
self.parsed = ET.parse(xmlBytes, parser=parser)
|
||||
self.parsed = ET.parse(xml_bytes, parser=parser)
|
||||
|
||||
def _get_text_value(self, xpath):
|
||||
e = self.parsed.find("./" + xpath)
|
||||
@@ -87,5 +88,3 @@ class WavIXMLFormat:
|
||||
The name of this file's file family.
|
||||
"""
|
||||
return self._get_text_value("FILE_SET/FAMILY_NAME")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user