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']๏ƒ
copy() SyncedLyrics[source]๏ƒ

returns a copy of the synced lyrics

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] | list[SyncedLyricLine][source]๏ƒ

Parse a line for lyrics or lrc metadata

save_to_file(path: Path | str, overwrite: bool = False, write_metadata: bool = True, additional_metadata: BaseLRCMetadata | None = None)[source]๏ƒ

save the synced lyrics to a file

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

lrctoolbox.synced_lyrics.parse_timestamps(timestamps: str) Iterator[int][source]๏ƒ

Parse the timestamps from the string