import re
from mutagen.oggvorbis import OggVorbis

def parse_lrc(lyrics_text):
    """Parse [mm:ss.xx] style lyric lines into a list of (time_seconds, text)."""
    pattern = re.compile(r"\[(\d+):(\d+\.\d+)\](.*)")
    parsed = []
    for line in lyrics_text.splitlines():
        match = pattern.match(line)
        if match:
            minutes, seconds, text = match.groups()
            time_sec = int(minutes) * 60 + float(seconds)
            parsed.append((time_sec, text.strip()))
    return parsed

audio = OggVorbis("../spotify/Golden.ogg")
raw_lyrics = audio["lyrics"][0]  # your file stores it as a list with one string
timed_lyrics = parse_lrc(raw_lyrics)

for t, line in timed_lyrics:  # print first 10 lines
    print(f"{t:6.2f}s  {line}")
