From 793da444ade53a6b973a34e1f6899f12564b9e26 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 30 Apr 2024 16:44:35 +0100 Subject: [PATCH] fix subtitle import --- management/commands/import_subtitles.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/management/commands/import_subtitles.py b/management/commands/import_subtitles.py index c812325..6dcfe4a 100644 --- a/management/commands/import_subtitles.py +++ b/management/commands/import_subtitles.py @@ -31,7 +31,7 @@ class Command(BaseCommand): with open(filename) as fd: data = fd.read() - data = data.strip().split('\n## ')[1:] + data = ('\n' + data.strip()).split('\n## ')[1:] invalid = [] valid = [] @@ -46,6 +46,9 @@ class Command(BaseCommand): lines = block.split('\n\n') if len(lines) != subtitles_en.count(): print('%s: number of subtitles does not match, en: %s vs %s: %s' % (title, subtitles_en.count(), lang, len(lines))) + if options["test"]: + print(json.dumps(lines, indent=2, ensure_ascii=False)) + print(json.dumps([s.value for s in subtitles_en.order_by('start')], indent=2, ensure_ascii=False)) continue if options["test"]: