alltomp3 icon indicating copy to clipboard operation
alltomp3 copied to clipboard

Inconsistent findLyrics calls

Open tgambet opened this issue 6 years ago • 0 comments

When calling findLyrics several times in a row, results may differ since it gives the lyrics found in the fastest responding website as per this code :

https://github.com/AllToMP3/alltomp3/blob/7129f174ac8d9d9726b252eabe447260d5e12216/index.js#L192-L201

This might be the best for speed, but not for consistency as one will get different lyrics on different calls. The code above could be replaced with something like:

return reqWikia
    .catch(() => reqParolesNet)
    .catch(() => reqLyricsMania1)
    .catch(() => reqLyricsMania2)
    .catch(() => reqLyricsMania3)
    .catch(() => reqSweetLyrics)

Requests would still be made in parallel but that would give a preference order to the websites that are requested (in this example first reqWikia, then reqParolesNet, etc...).

tgambet avatar Dec 15 '18 14:12 tgambet