From ce51e8c2c41f7efb5d470876acc19db0eab1c665 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 21 Nov 2025 11:00:06 +0100 Subject: [PATCH] optionally render srt subtitles --- render.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/render.py b/render.py index 8bda21e..110e18a 100644 --- a/render.py +++ b/render.py @@ -374,15 +374,15 @@ def get_offset_duration(prefix): def write_subtitles(data, folder, options): data = fix_overlaps(data) path = folder / "front.srt" - ''' - srt = ox.srt.encode(data) - write_if_new(str(path), srt, 'b') - ''' - if os.path.exists(path): - os.unlink(path) - path = folder / "front.ass" - ass = ass_encode(data, options) - write_if_new(str(path), ass, '') + if options.get("subtitle_format") == "srt": + srt = ox.srt.encode(data) + write_if_new(str(path), srt, 'b') + else: + if os.path.exists(path): + os.unlink(path) + path = folder / "front.ass" + ass = ass_encode(data, options) + write_if_new(str(path), ass, '') def render(root, scene, prefix='', options=None):