use titletext, title already used

This commit is contained in:
j 2024-05-22 10:53:21 +02:00
parent 959d1f5408
commit d271e9ba32

11
edit.py
View file

@ -105,7 +105,7 @@ def get_pandora_media_path(oshash):
def cache_clips(api, videos, use_source=False, use_pandora=False):
for clip in videos:
if clip.get("title"):
if clip.get("titletext"):
continue
out = '%s/%s.mp4' % (render, clip['oshash'])
if 'path' in clip:
@ -144,18 +144,21 @@ def make_title(title):
image.save(title_png)
cmd = [
'ffmpeg', '-r', '25',
'-hide_banner',
'-nostats', '-loglevel', 'error', '-y',
'-i', title_png, '-t', '5',
'-pix_fmt', 'yuv420p',
title_mp4
]
subprocess.call(cmd)
clip = {
"title": title,
"titletext": title,
"in": 0,
"out": 5,
"duration": 5,
"volume": 1.0,
"path": title_mp4
"path": title_mp4,
"oshash": ox.oshash(title_mp4),
}
return clip
@ -240,7 +243,7 @@ if __name__ == '__main__':
if opts.title:
clips.insert(0, make_title(opts.title))
for clip in clips:
if clip.get("title"):
if clip.get("titletext"):
videos.append(clip)
position += clip['duration']
position = math.ceil(position / (1/25)) * 1/25