From 4e767b72682d8086340670109de3606303f6500d Mon Sep 17 00:00:00 2001 From: j Date: Thu, 27 Nov 2025 18:02:00 +0100 Subject: [PATCH] fix default options --- render.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/render.py b/render.py index aafa8fe..8df5cf6 100644 --- a/render.py +++ b/render.py @@ -377,6 +377,9 @@ def write_subtitles(data, folder, options): if options.get("subtitle_format") == "srt": srt = ox.srt.encode(data) write_if_new(str(path), srt, 'b') + path = folder / "front.ass" + if os.path.exists(path): + os.unlink(path) else: if os.path.exists(path): os.unlink(path) @@ -386,7 +389,8 @@ def write_subtitles(data, folder, options): def render(root, scene, prefix='', options=None): - if options is None: options = {} + if options is None: + options = {} fps = 24 files = [] scene_duration = int(get_scene_duration(scene) * fps) @@ -903,7 +907,7 @@ def load_defaults(options): path = os.path.join(options["prefix"], "options.json") if os.path.exists(path): with open(path) as fd: - defaults = json.loads(fd) + defaults = json.load(fd) for key in defaults: if key not in options: options[key] = defaults[key] @@ -939,8 +943,8 @@ def ass_encode(subs, options): langs = options["lang"].split(',') else: langs = list(subs[0]["values"]) - print('ass_encode', langs, options) - print(subs) + #print('ass_encode', langs, options) + #print(subs) header = '''[Script Info] ScriptType: v4.00+ @@ -1092,6 +1096,7 @@ def generate_clips(options): import item.models import itemlist.models + options = load_defaults(options) prefix = options['prefix'] lang, tlang = parse_lang(options["lang"]) if options['censored']: