misc / tRIP - beginnings/work in progress

This commit is contained in:
2025-08-07 11:47:57 -04:00
parent 8603b11438
commit 9e9748076b
8 changed files with 404 additions and 51 deletions

View File

@@ -111,8 +111,19 @@ class DataUtils:
"""
def __init__(self) -> None:
self.lrc_regex = regex.compile(
r"\[([0-9]{2}:[0-9]{2})\.[0-9]{1,3}\](\s(.*)){0,}"
self.lrc_regex = regex.compile( # capture mm:ss and optional .xxx, then the lyric text
r"""
\[ # literal “[”
( # 1st (and only) capture group:
[0-9]{2} # two-digit minutes
:[0-9]{2} # colon + two-digit seconds
(?:\.[0-9]{1,3})? # optional decimal part, e.g. .123
)
\] # literal “]”
\s* # optional whitespace
(.*) # capture the rest of the line as words
""",
regex.VERBOSE,
)
self.scrub_regex_1: Pattern = regex.compile(r"(\[.*?\])(\s){0,}(\:){0,1}")
self.scrub_regex_2: Pattern = regex.compile(
@@ -161,7 +172,7 @@ class DataUtils:
)
_timetag = reg_helper[0]
if not reg_helper[1].strip():
_words = ""
continue
else:
_words = reg_helper[1].strip()
lrc_out.append(