Added generateLRCLine()
This commit is contained in:
15
utils.py
15
utils.py
@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user