multiple versions of same type

This commit is contained in:
j 2026-01-24 23:25:53 +01:00
commit 06e099e797

View file

@ -873,20 +873,26 @@ def generate_clips(options):
source = e.files.filter(selected=True)[0].data.path
ext = os.path.splitext(source)[1]
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":
source_target = target
clip['loudnorm'] = get_loudnorm(e.files.filter(selected=True)[0])
if type_.startswith('ai:'):
if 'ai' not in clip:
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:
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)
if not durations:
print(i.public_id, 'no duration!', clip)