This commit is contained in:
j 2026-02-02 10:03:09 +01:00
commit 94632c550d

View file

@ -458,7 +458,7 @@ def get_fragments(clips, voice_over, prefix):
print("FIXME", i) print("FIXME", i)
continue continue
type_ = i.data['type'][0].lower() type_ = i.data['type'][0].lower()
target = os.path.join(prefix, 'video', type_, i.data['title'] + ext) target = os.path.join(prefix, 'video', type_, "%s-%s%s" % (i.data['title'], i.public_id, ext))
sources.append(target) sources.append(target)
fragment['clips'] = [] fragment['clips'] = []
for clip in clips: for clip in clips:
@ -964,6 +964,9 @@ def generate_clips(options):
not_yet = itemlist.models.List.objects.filter(name='Not yet').first() not_yet = itemlist.models.List.objects.filter(name='Not yet').first()
if not_yet: if not_yet:
skip += [i.public_id for i in not_yet.get_items(not_yet.user).all()] skip += [i.public_id for i in not_yet.get_items(not_yet.user).all()]
if skip:
skip = list(set(skip))
print("skipping %s clips" % len(skip))
for i in item.models.Item.objects.filter(sort__type='source'): for i in item.models.Item.objects.filter(sort__type='source'):
if i.public_id in skip: if i.public_id in skip:
continue continue
@ -997,7 +1000,7 @@ def generate_clips(options):
ai_type = '%s-%s' % (type_[3:], n) ai_type = '%s-%s' % (type_[3:], n)
n += 1 n += 1
type_ = 'ai:' + ai_type type_ = 'ai:' + ai_type
target = os.path.join(prefix, 'video', type_, i.data['title'] + ext) target = os.path.join(prefix, 'video', type_, "%s-%s%s" % (i.data['title'], i.public_id, ext))
if ai_type: if ai_type:
clip['ai'][ai_type] = target clip['ai'][ai_type] = target
if type_ == "source": if type_ == "source":
@ -1066,7 +1069,7 @@ def generate_clips(options):
source = vo.files.filter(selected=True)[0] source = vo.files.filter(selected=True)[0]
src = source.data.path src = source.data.path
ext = src.split('.')[-1] ext = src.split('.')[-1]
target = os.path.join(prefix, 'voice_over', fragment, '%s-%s.%s' % (type, variant, ext)) target = os.path.join(prefix, 'voice_over', fragment, '%s-%s-%s.%s' % (type, variant, vo.public_id, ext))
os.makedirs(os.path.dirname(target), exist_ok=True) os.makedirs(os.path.dirname(target), exist_ok=True)
if os.path.islink(target): if os.path.islink(target):
os.unlink(target) os.unlink(target)
@ -1096,7 +1099,7 @@ def generate_clips(options):
if ai: if ai:
ai_source = ai.files.filter(selected=True)[0] ai_source = ai.files.filter(selected=True)[0]
ai_src = ai_source.data.path ai_src = ai_source.data.path
ai_target = os.path.join(prefix, 'voice_video', fragment, '%s-%s.%s' % (type, variant, 'mp4')) ai_target = os.path.join(prefix, 'voice_video', fragment, '%s-%s-%s.%s' % (type, variant, ai.public_id, 'mp4'))
os.makedirs(os.path.dirname(ai_target), exist_ok=True) os.makedirs(os.path.dirname(ai_target), exist_ok=True)
if os.path.islink(ai_target): if os.path.islink(ai_target):
os.unlink(ai_target) os.unlink(ai_target)
@ -1219,6 +1222,8 @@ def fragment_statistics():
not_yet = itemlist.models.List.objects.filter(name='Not yet').first() not_yet = itemlist.models.List.objects.filter(name='Not yet').first()
if not_yet: if not_yet:
skip += [i.public_id for i in not_yet.get_items(not_yet.user).all()] skip += [i.public_id for i in not_yet.get_items(not_yet.user).all()]
if skip:
skip = list(set(skip))
for l in itemlist.models.List.objects.filter(status='featured').order_by('name'): for l in itemlist.models.List.objects.filter(status='featured').order_by('name'):
if l.name.split(' ')[0].isdigit(): if l.name.split(' ')[0].isdigit():