Optional
data: Datalet mxmToken;
const LyricsManager = new SyncLyrics({
cache: new Map(), // Anything that can store data and has a .set(K, V), .get(K) and .has(K) values
logLevel: 'none', // One of "none" | "info" | "warn" | "error" | "debug"
instrumentalLyricsIndicator: "", // Any string
sources: ["musixmatch", "lrclib", "netease"], // An array with atleast one of those sources
saveMusixmatchToken: (tokenData) => { // A custom function to save the Musixmatch token, otherwise it'll skip Musixmatch fetch
mxmToken = tokenData;
},
getMusixmatchToken: () => { // A custom function to save the Musixmatch token, otherwise it'll skip Musixmatch fetch
return mxmToken;
},
})
Private
_fetchingWhetever it is fetching a song currently
Private
_trackUsed for the logging within the different functions and to fetch the track's data from the cache if avaible
Any method that can store data and has .set(), .get() and .has() functions
Function used to fetch the Musixmatch token (required to fetch the lyrics data from Musixmatch)
The character to use for instrumental lyrics (more than 3 seconds of music without any voice)
The level of the logging
Private
lyricsThe fetched lyrics, used for the .parse() method in the LineSyncedLyricsData
Function used to save the Musixmatch token (required to fetch the lyrics data from Musixmatch)
Array of sources to use, in the order they have to be fetched
Private
_fetchFetches the line synced lyrics of the song from Musixmatch, only if the search result specifies the song has line synced lyrics
The Musixmatch's token data
The Musixmatch track's commontrack_id
The Track's Lyrics if avaible
Private
_fetchFetches the song's lyrics based on the search results
The Musixmatch's token data
The Musixmatch track's track_id
The Musixmatch track's commontrack_id
Whetever the search result specifies the song has plain lyrics
Whetever the search result specifies the song has line synced lyrics
Whetever the search result specifies the song has word synced lyrics
The type of lyrics to fetch
Plain, line synced and word synced lyrics when avaible
Private
_fetchPrivate
_fetchFetches the plain lyrics of the song from Musixmatch, only if the search result specifies the song has plain lyrics
The Musixmatch's token data
The Musixmatch track's commontrack_id
The Track's Lyrics if avaible
Private
_fetchFetches the line word lyrics of the song from Musixmatch, only if the search result specifies the song has word synced lyrics
The Musixmatch's token data
The Musixmatch track's track_id
The Track's Lyrics if avaible
Private
_getFetches the lyrics from the specified sources
The type of lyrics to fetch
The lyrics fetched the avaible sources
Private
_parsePrivate
_searchSearchs the Musixmatch catalog with the data provided in the metadata
The Musixmatch's token data
If found, the Musixmatch's commontrack_id, track_id and whetever the track has lyrics, line synced lyrics or word synced lyrics
Private
_searchIf found, the Netease track's ID
Private
debugPrivate
errorPrivate
fetchFetches the plain and line synced lyrics from the lrclib.net's catalogue
The type of lyrics to fetch
Plain and line synced lyrics from lrclib.net when avaible
Private
fetchFetches the plain, line synced and word synced lyrics from the Musixmatch's catalogue
The type of lyrics to fetch
Plain, line synced and word synced lyrics from Musixmatch when avaible
Private
fetchFetches the line synced lyrics from the Netease's catalogue
The type of lyrics to fetch
Line synced lyrics from Netease when avaible
Optional
skipCache: booleanWhetever skip cache check or not
The lyrics of the song when avaible
Private
getGets the Musixmatch's usertoken if not returned by the getMusixmatchToken() method
Optional
cookies: stringMusixmatch's HTTP request cookies
Private
infoThe lyrics as an array of time and text
Updates or resets the cache
Optional
newCache: Cache<undefined | null | string, undefined | null | CacheLyrics>The new cache
Updated SyncLyrics instance
Updates or removes the getMusixmatchToken function
Updated SyncLyrics instance
Updates or resets the instrumental lyrics indicator (character used when there are more than 3 seconds of music without lyrics)
Optional
newInstrumentalLyricsIndicator: stringThe new instrumentalLyricsIndicator
Updated SyncLyrics instance
Updates or resets the log level
Updated SyncLyrics instance
Updates or removes the saveMusixmatchToken function
Optional
saveMusixmatchToken: ((tokenData: TokenData) => void | Promise<void>)The new saveMusixmatchToken function
Updated SyncLyrics instance
Updates or resets the sources
Updated SyncLyrics instance
Private
warn
The lyrics manager configuration