lrctoolbox package

Submodules

Module contents

lrctoolbox - A Python library for working with LRC files.

class lrctoolbox.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