fix(lyrics): restore adaptive lyrics layout

This commit is contained in:
h465855hgg
2026-07-18 18:54:55 +08:00
parent 2c42b32101
commit 6bcbf1beda
2 changed files with 8 additions and 4 deletions
+3
View File
@@ -81,6 +81,8 @@ def finalize(lines, total_duration=0):
item.get("romanization", item.get("romanized", item.get("romaji", ""))),
item.get("chars", item.get("charTimes", [])),
)
if item.get("duration_inferred") is True:
normalized["duration_inferred"] = True
if normalized["text"] or normalized["translation"] or normalized["romanization"]:
cleaned.append(normalized)
cleaned.sort(key=lambda item: (item["time"] < 0, item["time"] if item["time"] >= 0 else 0))
@@ -93,6 +95,7 @@ def finalize(lines, total_duration=0):
)
if next_time:
item["duration"] = max(0, next_time - item["time"])
item["duration_inferred"] = True
return cleaned