diff --git a/docs/classes/SyncLyrics.html b/docs/classes/SyncLyrics.html index 290f174..1706cd3 100644 --- a/docs/classes/SyncLyrics.html +++ b/docs/classes/SyncLyrics.html @@ -1,4 +1,4 @@ -
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
+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
+Private
_fetchFetches the song's lyrics based on the search results
The Musixmatch's token data
The Musixmatch track's track_id
@@ -61,91 +61,91 @@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
_fetchFetches the line synced lyrics from Netease
+Private
_fetchPrivate
_fetchFetches the plain lyrics of the song from Musixmatch, only if the search result specifies the song has plain lyrics
+Private
_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
+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
+Private
_getFetches the lyrics from the specified sources
The type of lyrics to fetch
The lyrics fetched the avaible sources
-Private
_parseRemoves useless metadata returned by Netease
+Private
_parsePrivate
_searchSearchs the Musixmatch catalog with the data provided in the metadata
+Private
_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
_searchSearchs the Netease catalog with the data provided in the metadata
+Private
_searchIf found, the Netease track's ID
-Private
debugLogs the text with a purple "DEBUG: " prefix
+Private
debugPrivate
errorLogs the text with a red "ERROR: " prefix
+Private
errorPrivate
fetchFetches the plain and line synced lyrics from the lrclib.net's catalogue
+Private
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
+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
+Private
fetchFetches the line synced lyrics from the Netease's catalogue
The type of lyrics to fetch
Line synced lyrics from Netease when avaible
-Fetches from the cache or the sources, the song based on the track's metadata or ID
+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
+Private
getGets the Musixmatch's usertoken if not returned by the getMusixmatchToken() method
Optional
cookies: stringMusixmatch's HTTP request cookies
Private
infoParses LRC formatted lyrics into an array of text and time
+The lyrics as an array of time and text
-Updates or resets the cache
+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
+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)
+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
+Updates or resets the log level
Updated SyncLyrics instance
-Updates or removes the saveMusixmatchToken function
+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
+Updates or resets the sources
Updated SyncLyrics instance
-Private
warnParses special characters (Usually returned by Netease) into common characters
+Parses special characters (Usually returned by Netease) into common characters
The string to parse
Parsed string with common characters
-SyncLyrics allows you to get the plain, line synced and word synced lyrics of any song avaible on Musixmatch, LrcLib.net or Netease.
+SyncLyrics allows you to get the plain, line synced and word synced lyrics of any song avaible on Musixmatch, LrcLib.net or Netease.
Installation: npm i @stef-0012/synclyrics
.
const { SyncLyrics } = require("@stef-0012/synclyrics");
let mxmToken; // This is just for the custom save/get functions example
const LyricsManager = new SyncLyrics({
/* Each of those options is optional */
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;
},
})
LyricsManager.getLyrics({
/* Each of those options is optional but atleast one is required excluded length */
track: "the old me", // Song name
artist: "Henry Moodie", // Song artist
album: "good old days", // Song album
length: 175000, // Song duration, in ms
}).then(data => {
console.log(data)
}) // Array of objects with time as seconds and text of each line
// or
const trackId = LyricsManager.getTrackId({
/* Each of those options is optional but atleast one is required excluded length */
track: "the old me", // Song name
artist: "Henry Moodie", // Song artist
album: "good old days", // Song album
length: 175000, // Song duration, in ms
})
LyricsManager.getLyrics({
trackId: trackId
}).then(data => {
console.log(data)
})
@@ -9,4 +9,4 @@
[
{
time: 0.14,
text: 'Fifth of November, when I walked you home'
},
{
time: 8.06,
text: `That's when I nearly said it, but then said, "Forget it," and froze`
},
{
time: 15.55,
text: "Do you remember? You probably don't"
},
{
time: 23.44,
text: "'Cause the sparks in the sky took a hold of your eyes while we spoke"
},
// ..... (rest of the lyrics)
]
-Any method that can store data and has .set(), .get() and .has() functions
-Any method that can store data and has .set(), .get() and .has() functions
+Function used to get the song's data to the cache
-Function to check if the cache has the song's data
-Function used to set the song's data to the cache
-Function to check if the cache has the song's data
+Function used to set the song's data to the cache
+Private
Lyrics source
+Private
Private
Optional
cacheAny method that can store data and has .set(), .get() and .has() functions
-Optional
getFunction used to fetch the Musixmatch token (required to fetch the lyrics data from Musixmatch)
-Optional
instrumentalThe character to use for instrumental lyrics (more than 3 seconds of music without any voice)
-Optional
logThe level of the logging
-Optional
saveFunction used to save the Musixmatch token (required to fetch the lyrics data from Musixmatch)
-Optional
sourcesArray of sources to use, in the order they have to be fetched
-Optional
getFunction used to fetch the Musixmatch token (required to fetch the lyrics data from Musixmatch)
+Optional
instrumentalThe character to use for instrumental lyrics (more than 3 seconds of music without any voice)
+Optional
logThe level of the logging
+Optional
saveFunction used to save the Musixmatch token (required to fetch the lyrics data from Musixmatch)
+Optional
sourcesArray of sources to use, in the order they have to be fetched
+Line synced lyrics in the LRC format
-Function to parse the returned lyrics into FormattedLyric
-Lyrics source
-Function to parse the returned lyrics into FormattedLyric
+Lyrics source
+Private
Private
Line synced lyrics if avaible
-Plain lyrics if avaible
-Always null as lrclib.net does not support word synced lyrics
-Plain lyrics if avaible
+Always null as lrclib.net does not support word synced lyrics
+Song's album
-Song's artist(s)
-Whetever the song data was retrieved from the cache rather than the APIs
-Object with track's avaible lyrics
-Song's name
-Fetched track's ID
-Song's artist(s)
+Whetever the song data was retrieved from the cache rather than the APIs
+Object with track's avaible lyrics
+Song's name
+Fetched track's ID
+Song's metadata
-Song's metadata
+Optional
albumSong's album
-Optional
artistSong's artist(s)
-Optional
lengthSong's duration (in ms)
-Optional
lyricsAn array of lyric types to fetch
-Optional
trackSong's name
-Optional
trackSong's ID (returned by getTrackId)
-Optional
artistSong's artist(s)
+Optional
lengthSong's duration (in ms)
+Optional
lyricsAn array of lyric types to fetch
+Optional
trackSong's name
+Optional
trackSong's ID (returned by getTrackId)
+Private
Private
Optional
plainPlain lyrics if avaible
+Musixmatch
+Optional
wordLine synced lyrics if avaible
+Private
Private
Track's plain lyrics
+Track's word synced lyrics
+Private
Private
Musixmatch's commontrack_id
-Whetever the Musixmatch's catalogue has the song's line synced lyrics
-Whetever the Musixmatch's catalogue has the song's plain lyrics
-Whetever the Musixmatch's catalogue has the song's word synced lyrics
-Musixmatch's track_id
-Whetever the Musixmatch's catalogue has the song's line synced lyrics
+Whetever the Musixmatch's catalogue has the song's plain lyrics
+Whetever the Musixmatch's catalogue has the song's word synced lyrics
+Musixmatch's track_id
+Private
Private
Always null as Netease does not support word synced lyrics
+Netease
+Always null as Netease does not support word synced lyrics
+Lyrics source
+Private
Musixmatch token data
-Private
Musixmatch token data
+Cookies used for the Musixmatch's API request
-When the Musixmatch's usertoken expires
-Musixmatch's usertoken
-When the Musixmatch's usertoken expires
+Musixmatch's usertoken
+The lyric complete text
+When the lyric's line starts
+The lyric synced by characters
+Lyrics source
+When the character timeframe starts
+Avaible sources:
+Avaible sources:
-Const
Const
Const
Const
Const
Const
Example
-