hrkfdn / ncspot

Cross-platform ncurses Spotify client written in Rust, inspired by ncmpc and the likes.
BSD 2-Clause "Simplified" License
4.82k stars 207 forks source link

Add time-synced lyrics tab #1076

Open sophronesis opened 1 year ago

sophronesis commented 1 year ago

Describe the solution you'd like:

View lyrics like in official app. Bonus points if time-synced, but no so necessary. I can make this myself using author+song_name from dbus, but would be highly appreciated to see this as native feature.

hrkfdn commented 1 year ago

I like the idea, however I'm not sure but I don't think the Spotify web API exposes the lyrics, which would be a requirement, especially if we want to display it time-synced.

Naapperas commented 1 year ago

I also came looking for this feature: since it was not yet being done I started working on it, if that's OK with you. I am however a Rust newbie so any tips are welcome.

Regarding your comment @hrkfdn, I arrived at ncspot from ncmcpp, which has built-in lyrics fetching. I just searched their repository and they are using cURL: I believe this could be an early solution, at least while Spotify does not expose lyric data through their API (if they ever will). What do you think? It does not allow us to keep the lyrics time-synced tho. I also just checked and Spotify uses Musixmatch, could that be something we explore?

sophronesis commented 1 year ago

I don't think I found an universal fix (not anyone appreciate python scripts), but my current solution is just to use lyrics-in-terminal. Best thing is that it is music-player-agnostic solution (it fetches author and track from mpris/dbus). And as @Naapperas mentioned, ncmpcpp have fetching from five different sources, so this is not a technical issue. Hope someone will find this helpful.

Naapperas commented 1 year ago

I have found a wall while working on this: is there any way for a view to know that the current song has ended and a new song has started? I've been looking and the only thing I found was the end of the main function which has an event loop, but I'm sure there must be a better way that I'm just not seeing. Any tips?

Also, I did not find anything regarding this in the Cursive docs: is there any event regarding when a view has been rendered for the first time? Kinda like an on_enter call.

sophronesis commented 1 year ago

Diverse and time synced lyrics are already available in this spotify client, just need to convert it from JS to Rust

Naapperas commented 1 year ago

Found this one, this time written in Go. Need to investigate.

Cabbasca commented 1 year ago

https://github.com/akashrchandran/spotify-lyrics-api

ThomasFrans commented 8 months ago

Public lyrics APIs for reference: https://github.com/public-apis/public-apis