Added generateLRCLine()

This commit is contained in:
2025-12-17 12:15:55 +00:00
parent 40e726e6a4
commit 31c69b4ed0

View File

@ -51,6 +51,21 @@ def parseLrcLine(lrcLine: str) -> [float, str]:
return t, lrcLine return t, lrcLine
def generateLRCLine(time: float, text: str='') -> str:
"""
Turns a time (in seconds) and an optional lyrics into a valid LRC line.
If passed (62.1, 'Hello world'), this function will return '[01:02.10] Hello world'
Args:
time (float): The lyrics time in seconds.
text (str, optional): The text for the lyric.
Returns:
str: The LRC line.
"""
return f'[{int(time//60):02d}:{time%60:05.2f}] {text}'
def getInfo(getType: str) -> dict: def getInfo(getType: str) -> dict:
""" """
Runs the `GetInfo` command and automatically parses the JSON. Runs the `GetInfo` command and automatically parses the JSON.