From 1d8450cd1ad1861e2d5a6ecfef6e499de2d3251b Mon Sep 17 00:00:00 2001 From: Sting <loic.allegre@ensiie.fr> Date: Mon, 24 Jul 2023 23:33:43 +0200 Subject: [PATCH] Fixed a bug caused by whitespace syls in source lyrics --- autosyl/assUtils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autosyl/assUtils.py b/autosyl/assUtils.py index cefbfa1..57dc044 100644 --- a/autosyl/assUtils.py +++ b/autosyl/assUtils.py @@ -33,9 +33,13 @@ def getSyls(ass_file): for line in LINES_KARA.findall(CONTENT): syl_line = [] lastTime = dateToTime(line[0]) + syl_line_index = 0 for couple in RGX_TAGS.findall(line[7]): - if(couple[1] != '' and not couple[1].isspace()): + if couple[1] != '' and not couple[1].isspace(): syl_line.append([lastTime, couple[1], int(couple[0])]) + syl_line_index += 1 + if couple[1].isspace() and len(couple[1]) > 0 and syl_line_index > 0: + syl_line[syl_line_index - 1][1] += " " lastTime += int(couple[0]) syl_line.append([lastTime, '', 0]) SYLS.append(syl_line) -- GitLab