lrctoolbox.synced_lyrics module

A module that provides classes to work with synced lyrics.

class lrctoolbox.synced_lyrics.SyncedLyrics[source]

Bases: LRCMetadata

A class that represents synced lyrics.

SUPPORTED_FILE_TYPES: ClassVar[list[str]] = ['.lrc', '.txt']
property has_timestamps_all_equal: bool

checks if the timestamp is all same

property has_timestamps_in_ascending_order: bool

checks if the timestamp is in ascending order

property is_missing_any_timestamp: bool

Check if any timestamp is None

property is_synced: bool

checks if the lyrics is valid and synced Checks Performed:

  • lyrics is not empty

  • timestamp is in ascending order

  • timestamp is not all same

classmethod load(maybe_lyrics: Any)[source]

Load synced lyrics from a object

classmethod load_from_file(path: Path | str)[source]

convenience method to load from a file

path: Path to the lrc file

calls load_from_lines internally after reading the file

classmethod load_from_lines(lines: list[str]) SyncedLyrics[source]

Load synced lyrics from a list of strings.

property lyrics: list[str]

lyrics as a list of strings with timestamp if present

classmethod parse_str(line: str) SyncedLyricLine | dict[str, str][source]

Parse a line for lyrics or lrc metadata

property synced_lines: list[SyncedLyricLine]

returns the lines as a list of SyncedLyricLine objects

update_metadata(metadata: dict[str, str]) SyncedLyrics[source]

updates the metadata of the synced lyrics