fix off by one and make option to load melt outside of class
This commit is contained in:
parent
7fe4b02552
commit
73a9481ef1
1 changed files with 8 additions and 5 deletions
|
@ -12,6 +12,12 @@ def get_propery(element, name):
|
||||||
return element.xpath('property[@name="%s"]' % name)[0].text
|
return element.xpath('property[@name="%s"]' % name)[0].text
|
||||||
|
|
||||||
|
|
||||||
|
def melt_xml(file):
|
||||||
|
if file in _CACHE:
|
||||||
|
out = _CACHE[file]
|
||||||
|
else:
|
||||||
|
out = _CACHE[file] = subprocess.check_output(['melt', file, '-consumer', 'xml']).decode()
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
class KDEnliveProject:
|
class KDEnliveProject:
|
||||||
|
@ -423,10 +429,7 @@ class KDEnliveProject:
|
||||||
return prefix + self.get_counter(prefix)
|
return prefix + self.get_counter(prefix)
|
||||||
|
|
||||||
def get_chain(self, file, kdenlive_id=None):
|
def get_chain(self, file, kdenlive_id=None):
|
||||||
if file in _CACHE:
|
out = melt_xml(file)
|
||||||
out = _CACHE[file]
|
|
||||||
else:
|
|
||||||
out = _CACHE[file] = subprocess.check_output(['melt', file, '-consumer', 'xml']).decode()
|
|
||||||
chain = lxml.etree.fromstring(out).xpath('producer')[0]
|
chain = lxml.etree.fromstring(out).xpath('producer')[0]
|
||||||
chain.tag = 'chain'
|
chain.tag = 'chain'
|
||||||
chain.attrib['id'] = self.get_id('chain')
|
chain.attrib['id'] = self.get_id('chain')
|
||||||
|
@ -614,7 +617,7 @@ class KDEnliveProject:
|
||||||
self.get_element("entry", attrib={
|
self.get_element("entry", attrib={
|
||||||
"producer": chain.attrib["id"],
|
"producer": chain.attrib["id"],
|
||||||
"in": chain.attrib["in"],
|
"in": chain.attrib["in"],
|
||||||
"out": str(frames),
|
"out": str(frames - 1)
|
||||||
}, children=[
|
}, children=[
|
||||||
["kdenlive:id", id],
|
["kdenlive:id", id],
|
||||||
] + filters_),
|
] + filters_),
|
||||||
|
|
Loading…
Reference in a new issue