update render

This commit is contained in:
j 2026-01-06 19:00:43 +01:00
commit d8d3636bc7

View file

@ -123,19 +123,15 @@ def compose(clips, target=150, base=1024, voice_over=None, options=None):
clip = None
while target - length > 0 and clips:
# coin flip which site is visible (50% chance)
if length:
remaining = target - length
remaining = remaining * 1.05 # allow for max of 10% over time
clips_ = [c for c in clips if c['duration'] <= remaining]
if clips_:
clips = clips_
'''
if clip:
if chance(seq, 0.5):
next_seqid = clip['seqid'] + 1
clip = get_clip_by_seqid(clips, next_seqid)
else:
clip = None
'''
clip = None
if not clip:
clip = random_choice(seq, clips, True)
if not clips:
@ -152,74 +148,30 @@ def compose(clips, target=150, base=1024, voice_over=None, options=None):
print('%06.3f %06.3f' % (length, clip['duration']), os.path.basename(clip['original']))
length += int(clip['duration'] * fps) / fps
if "foreground" not in clip and "animation" in clip:
fg = clip['animation']
transparancy = 1
else:
fg = clip['foreground']
if 'animation' in clip and chance(seq, 0.15):
fg = clip['animation']
transparancy = 1
else:
if 'foreground2' in clip:
if 'foreground3' in clip:
n = seq()
if n <= 3: # 0,1,2,3
clip['foreground']
elif n <= 6: # 4,5,6
clip['foreground2']
else: # 7,8,9
clip['foreground3']
elif chance(seq, 0.5):
fg = clip['foreground2']
transparancy = seq() / 9
transparancy = 1
if 'foley' in clip:
foley = clip['foley']
else:
foley = fg
# 50/50 original or ai
src = clip['original']
audio = clip['original']
# select ai...
if 'ai' in clip:
if chance(seq, 0.5):
src = random_choice(seq, clip['ai'].values(), False)
scene['front']['V2'].append({
'duration': clip['duration'],
'src': fg,
'src': src,
"filter": {
'transparency': transparancy,
}
})
transparency = seq() / 9
# 50% of time no transparancy of foregroudnd layer
# 50% some transparancy, 25%, 50%, 75% levels of transparancy
transparancy = 1
# coin flip which site is visible (50% chance)
#if chance(seq, 0.5):
if chance(seq, 0.8):
transparency_front = transparency
else:
transparency_front = 0
transparency_original = seq() / 9
transparency_original = 1
if "background" in clip:
scene['front']['V1'].append({
'duration': clip['duration'],
'src': clip['background'],
"filter": {
'transparency': transparency_front
}
})
else:
scene['front']['V1'].append({
'duration': clip['duration'],
'src': clip['animation'],
"filter": {
'transparency': 0,
}
})
# TBD: Foley
cf_volume = '-2.5'
volume = '0'
scene['audio-center']['A1'].append({
'duration': clip['duration'],
'src': audio,
'filter': {'volume': cf_volume},
})
scene['audio-front']['A2'].append({
'duration': clip['duration'],
'src': foley,
'src': audio,
'filter': {'volume': cf_volume},
})
scene['audio-rear']['A2'].append({
@ -820,7 +772,8 @@ def generate_clips(options):
for i in item.models.Item.objects.filter(sort__type='original'):
original_target = ""
qs = item.models.Item.objects.filter(data__title=i.data['title']).exclude(id=i.id)
if qs.count() >= 1:
#if qs.count() >= 1:
if True:
clip = {}
durations = []
for e in item.models.Item.objects.filter(data__title=i.data['title']):
@ -839,7 +792,12 @@ def generate_clips(options):
os.symlink(source, target)
if type_ == "original":
original_target = target
clip[type_] = target
if type_.startswith('ai:'):
if 'ai' not in clip:
clip['ai'] = {}
clip['ai'][type_[3:]] = target
else:
clip[type_] = target
durations.append(e.files.filter(selected=True)[0].duration)
clip["duration"] = min(durations)
if not clip["duration"]:
@ -848,6 +806,7 @@ def generate_clips(options):
cd = format_duration(clip["duration"], 24)
clip["duration"] = cd
clip['tags'] = i.data.get('tags', [])
clip['id'] = i.public_id
name = os.path.basename(original_target)
seqid = re.sub(r"Hotel Aporia_(\d+)", "S\\1_", name)
seqid = re.sub(r"Night March_(\d+)", "S\\1_", seqid)