raitonoberu / sptlrx

Synchronized lyrics in your terminal
MIT License
353 stars 14 forks source link

Migrate to lrclib.net #48

Open raitonoberu opened 1 month ago

raitonoberu commented 1 month ago

Here we'll track the progress of moving the source of free lyrics from Spotify to lrclib. Since lrclib's own search engine is not good enough to find the desired track, what we will do is:

What's nice about this is that Vercel caches our responses, so we won't make the same request to lrclib twice. I tested this scenario briefly and it works awesome, it even has lyrics to songs that Spotify doesn't have. Also, AFAIK, we don't even need to specify Spotify cookies when hosting lyricsapi because unregistered users can do search requests too.

sanderr commented 1 month ago

Since lrclib's own search engine is not good enough to find the desired track

From reading the rest of the description, as well as my own experience with the API (I've been using it for a few months now with great success), I have the impression that this statement only holds if you don't have complete metadata. Hence you use lyricsapi to go from partial to complete metadata.

Might I suggest skipping this step iff complete metadata is already available? e.g. if the music player / MPRIS reports all of track name, artist name, album name and duration, assume that these are correct and query lrclib directly. If any of those fields is missing, try lyricsapi to fill in missing details. I believe this should make the results more robust in case of complete metadata (see e.g. #36), while still making a best-effort if any metadata is missing.

What do you think?

DoctorDinosaur commented 1 month ago

https://github.com/brentvollebregt/spotify-lyrics-viewer uses lrclib, might be able to adapt its track finding