🎢 Lyrics¢

Module: lyrics.py

Provides functionality for retrieving song lyrics using the LRClib API.

class LyricsΒΆ

A class for interacting with the LRClib API to fetch and manage song lyrics.

check_instrumental(metadata: TrackMetadata) boolΒΆ

Determines if a track is instrumental.

Parameters:

metadata (TrackMetadata) – The metadata of the track.

Returns:

True if the track is instrumental (i.e., no lyrics found), False otherwise.

Return type:

bool

get_lyrics(metadata: TrackMetadata) strΒΆ

Retrieves lyrics from LRClib.net for a specified track and artist.

Parameters:

metadata (TrackMetadata) – The metadata of the track.

Returns:

The lyrics of the track in plain text if available; otherwise, a placeholder message for instrumental tracks.

Return type:

str

Raises:

NoLyricsAvailable – If no lyrics are found for the specified track and artist.

select_lines(lyrics: str, selection: str) strΒΆ

Extracts a specific range of lines from the given song lyrics.

Parameters:
  • lyrics (str) – The full lyrics of the song as a single string.

  • selection (str) – The range of lines to extract, specified in the format β€œstart-end” (e.g., β€œ2-5”).

Returns:

A string containing exactly 4 extracted lines, separated by newline characters.

Return type:

str

Raises: