beatprints.js
Version:
A Node.js version of the original Python BeatPrints project (https://github.com/TrueMyst/BeatPrints/) by TrueMyst. Create eye-catching, Pinterest-style music posters effortlessly. BeatPrints integrates with Spotify and LRClib API to help you design custom
29 lines (28 loc) • 1.59 kB
TypeScript
import * as lrc from 'lrclib-api';
import type { TrackMetadata } from './spotify.js';
/**
* A class for interacting with the LRClib API to fetch and manage song lyrics.
*/
export declare class Lyrics {
private metadata;
api: lrc.Client;
constructor();
/**
* Determines if a track is instrumental.
* @param {TrackMetadata} metadata The metadata of the track.
* @returns {boolean} True if the track is instrumental (i.e., no lyrics found), false otherwise.
* @throws `NoLyricsAvailable` if no lyrics are found for the specified track and artist.
*/
checkInstrumental(metadata: TrackMetadata | Pick<TrackMetadata, 'name' | 'artist'>): Promise<boolean>;
getLyrics(metadata: TrackMetadata | Pick<TrackMetadata, 'name' | 'artist'>, index?: boolean): Promise<string>;
/**
* Select 4 lines from the given lyrics based on a specified range.
* @param {string} lyrics The full lyrics of the song as a single string.
* @param {string} selection The range of lines to extract, specified in the format "start-end" (e.g., '2-5')
* @returns {Promise<string>} A string containing exactly 4 extracted lines, separated by newline characters.
* @throws `InvalidFormatError` If the selection argument is not in the correct "start-end" format.
* @throws `InvalidSelectionError` If the specified range is out of bounds or otherwise invalid.
* @throws `LineLimitExceededError` If the selected range does not include exactly 4 non-empty lines.
*/
selectLines(lyrics: string, selection: string): Promise<string>;
}