multiple versions of same type
This commit is contained in:
parent
a817b1def6
commit
06e099e797
1 changed files with 12 additions and 6 deletions
18
render.py
18
render.py
|
|
@ -873,20 +873,26 @@ def generate_clips(options):
|
||||||
source = e.files.filter(selected=True)[0].data.path
|
source = e.files.filter(selected=True)[0].data.path
|
||||||
ext = os.path.splitext(source)[1]
|
ext = os.path.splitext(source)[1]
|
||||||
type_ = e.data['type'][0].lower()
|
type_ = e.data['type'][0].lower()
|
||||||
target = os.path.join(prefix, 'video', type_, i.data['title'] + ext)
|
|
||||||
os.makedirs(os.path.dirname(target), exist_ok=True)
|
|
||||||
if os.path.islink(target):
|
|
||||||
os.unlink(target)
|
|
||||||
os.symlink(source, target)
|
|
||||||
if type_ == "source":
|
if type_ == "source":
|
||||||
source_target = target
|
source_target = target
|
||||||
clip['loudnorm'] = get_loudnorm(e.files.filter(selected=True)[0])
|
clip['loudnorm'] = get_loudnorm(e.files.filter(selected=True)[0])
|
||||||
if type_.startswith('ai:'):
|
if type_.startswith('ai:'):
|
||||||
if 'ai' not in clip:
|
if 'ai' not in clip:
|
||||||
clip['ai'] = {}
|
clip['ai'] = {}
|
||||||
clip['ai'][type_[3:]] = target
|
ai_type = type_[3:]
|
||||||
|
n = 1
|
||||||
|
while ai_type in clip['ai']:
|
||||||
|
ai_type = '%s-%s' % (type_[3:], n)
|
||||||
|
n += 1
|
||||||
|
clip['ai'][ai_type] = target
|
||||||
|
type_ = ai_type
|
||||||
else:
|
else:
|
||||||
clip[type_] = target
|
clip[type_] = target
|
||||||
|
target = os.path.join(prefix, 'video', type_, i.data['title'] + ext)
|
||||||
|
os.makedirs(os.path.dirname(target), exist_ok=True)
|
||||||
|
if os.path.islink(target):
|
||||||
|
os.unlink(target)
|
||||||
|
os.symlink(source, target)
|
||||||
durations.append(e.files.filter(selected=True)[0].duration)
|
durations.append(e.files.filter(selected=True)[0].duration)
|
||||||
if not durations:
|
if not durations:
|
||||||
print(i.public_id, 'no duration!', clip)
|
print(i.public_id, 'no duration!', clip)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue