as much ai as possible

This commit is contained in:
j 2026-01-17 11:39:35 +00:00
commit f712a46c4a

View file

@ -122,6 +122,22 @@ def compose(clips, target=150, base=1024, voice_over=None, options=None):
if subs: if subs:
scene["subtitles"] = subs scene["subtitles"] = subs
selected_clips_length = 0
selected_clips = []
non_ai_clips = []
for clip in clips:
if 'ai' in clip:
selected_clips.append(clip)
selected_clips_length += clip['duration']
else:
non_ai_clips.append(clip)
while selected_clips_length < target and non_ai_clips:
clip = random_choice(seq, non_ai_clips, pop=True)
selected_clips.append(clip)
selected_clips_length += clip['duration']
clips = selected_clips
clip = None clip = None
while target - length > 0 and clips: while target - length > 0 and clips:
''' '''
@ -789,6 +805,8 @@ def generate_clips(options):
clip = {} clip = {}
durations = [] durations = []
for e in item.models.Item.objects.filter(data__title=i.data['title']): for e in item.models.Item.objects.filter(data__title=i.data['title']):
if 'skip' in e.data.get('tags', []):
continue
if 'type' not in e.data: if 'type' not in e.data:
print("ignoring invalid video %s (no type)" % e) print("ignoring invalid video %s (no type)" % e)
continue continue