bbb: Add parse method for the pan zoom events file
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
parent
4e680a534e
commit
fb81e5dff4
19
bbb.py
19
bbb.py
|
@ -16,6 +16,8 @@ __all__ = [
|
|||
'SlideRef',
|
||||
'parse_deskshare_xml',
|
||||
'parse_shapes_svg',
|
||||
'PanZoomEvent',
|
||||
'parse_panzooms_xml',
|
||||
]
|
||||
|
||||
|
||||
|
@ -82,3 +84,20 @@ def parse_shapes_svg(filename):
|
|||
))
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
PanZoomEvent = namedtuple('PanZoomEvent', 'ts x y w h')
|
||||
|
||||
def parse_panzooms_xml(filename):
|
||||
rv = []
|
||||
xml_doc = lxml.etree.parse(filename)
|
||||
for element in xml_doc.xpath("//recording/event"):
|
||||
x, y, w, h = [float(x) for x in element.getchildren()[0].text.split()]
|
||||
rv.append(PanZoomEvent(
|
||||
float(element.get("timestamp")),
|
||||
x,
|
||||
y,
|
||||
w,
|
||||
h,
|
||||
))
|
||||
return rv
|
||||
|
|
Loading…
Reference in New Issue