Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Librespot not providing artist metadata #1315

Open
elParaguayo opened this issue Jan 1, 2025 · 9 comments
Open

Librespot not providing artist metadata #1315

elParaguayo opened this issue Jan 1, 2025 · 9 comments

Comments

@elParaguayo
Copy link

Firstly, I love this project and am so grateful for the work you do.

Describe the bug
When playing a librespot stream and using the web interface, the artist is always "Unknown Artist".

Is this information not available from the Spotify stream?

Steps to Reproduce

  1. Start server
  2. Play spotify stream
  3. Open web player and observer metadata

Environment details

  • OS: Tested on Arch Linux and NixOS
  • Snapcast version: 0.29.0
  • Installed from a package, self compiled, Installed from AUR on Arch, nixpkgs on NixOS

Attach logfile if applicable
Generate logs with snapclient --logfilter debug or snapserver --logging.filter debug if possible and paste them in the following codeblock

2025-01-01 15-12-17.984 [Info] (librespot_playback::player) <Fractal> (317454 ms) loaded
2025-01-01 15-12-17.984 [Info] (LibrespotStream) metadata: <Fractal>
2025-01-01 15-12-17.985 [Debug] (PcmStream) setProperties, stream: "Test Librespot", properties: {"canControl":false,"canGoNext":false,"canGoPrevious":false,"canPause":false,"canPlay":false,"canSeek":false,"metadata":{"artData":{"data":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBoZWlnaHQ9IjE2OHB4IiB3aWR0aD0iMTY4cHgiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDE2OCAxNjgiPgogPHBhdGggZmlsbD0iIzFFRDc2MCIgZD0ibTgzLjk5NiAwLjI3N2MtNDYuMjQ5IDAtODMuNzQzIDM3LjQ5My04My43NDMgODMuNzQyIDAgNDYuMjUxIDM3LjQ5NCA4My43NDEgODMuNzQzIDgzLjc0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2110cc925447c70f573.svg","duration":317.4540100097656,"title":"Fractal"}}
2025-01-01 15-12-17.986 [Debug] (Server) Properties changed, stream: "Test Librespot", properties: {
2025-01-01 15-12-17.986 [Debug] (Server)    "canControl": false,
2025-01-01 15-12-17.986 [Debug] (Server)    "canGoNext": false,
2025-01-01 15-12-17.986 [Debug] (Server)    "canGoPrevious": false,
2025-01-01 15-12-17.986 [Debug] (Server)    "canPause": false,
2025-01-01 15-12-17.986 [Debug] (Server)    "canPlay": false,
2025-01-01 15-12-17.986 [Debug] (Server)    "canSeek": false,
2025-01-01 15-12-17.986 [Debug] (Server)    "metadata": {
2025-01-01 15-12-17.986 [Debug] (Server)       "artData": {
2025-01-01 15-12-17.986 [Debug] (Server)          "data": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBoZWlnaHQ9IjE2OHB4IiB3aWR0aD0iMTY4cHgiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDE2OCAxNjgiPgogPHBhdGggZmlsbD0iIzFFRDc2MCIgZD0ibTgzLjk5NiAwLjI3N2MtNDYuMjQ5IDAtODMuNzQzIDM3LjQ5My04My43NDMgODMuNzQyIDAgNDYuMjUxIDM3LjQ5NCA4My43NDEgODMuNzQzIDgzLjc0MSA0Ni4yNTQgMCA4My43NDQtMzcuNDkgODMuNzQ0LTgzLjc0MSAwLTQ2LjI0Ni0zNy40OS04My43MzgtODMuNzQ1LTgzLjczOGwwLjAwMS0wLjAwNHptMzguNDA0IDEyMC43OGMtMS41IDIuNDYtNC43MiAzLjI0LTcuMTggMS43My0xOS42NjItMTIuMDEtNDQuNDE0LTE0LjczLTczLjU2NC04LjA3LTIuODA5IDAuNjQtNS42MDktMS4xMi02LjI0OS0zLjkzLTAuNjQzLTIuODEgMS4xMS01LjYxIDMuOTI2LTYuMjUgMzEuOS03LjI5MSA1OS4yNjMtNC4xNSA4MS4zMzcgOS4zNCAyLjQ2IDEuNTEgMy4yNCA0LjcyIDEuNzMgNy4xOHptMTAuMjUtMjIuODA1Yy0xLjg5IDMuMDc1LTUuOTEgNC4wNDUtOC45OCAyLjE1NS0yMi41MS0xMy44MzktNTYuODIzLTE3Ljg0Ni04My40NDgtOS43NjQtMy40NTMgMS4wNDMtNy4xLTAuOTAzLTguMTQ4LTQuMzUtMS4wNC0zLjQ1MyAwLjkwNy03LjA5MyA0LjM1NC04LjE0MyAzMC40MTMtOS4yMjggNjguMjIyLTQuNzU4IDk0LjA3MiAxMS4xMjcgMy4wNyAxLjg5IDQuMDQgNS45MSAyLjE1IDguOTc2di0wLjAwMXptMC44OC0yMy43NDRjLTI2Ljk5LTE2LjAzMS03MS41Mi0xNy41MDUtOTcuMjg5LTkuNjg0LTQuMTM4IDEuMjU1LTguNTE0LTEuMDgxLTkuNzY4LTUuMjE5LTEuMjU0LTQuMTQgMS4wOC04LjUxMyA1LjIyMS05Ljc3MSAyOS41ODEtOC45OCA3OC43NTYtNy4yNDUgMTA5LjgzIDExLjIwMiAzLjczIDIuMjA5IDQuOTUgNy4wMTYgMi43NCAxMC43MzMtMi4yIDMuNzIyLTcuMDIgNC45NDktMTAuNzMgMi43Mzl6Ii8+Cjwvc3ZnPgo=",
2025-01-01 15-12-17.986 [Debug] (Server)          "extension": "svg"
2025-01-01 15-12-17.986 [Debug] (Server)       },
2025-01-01 15-12-17.986 [Debug] (Server)       "artUrl": "http://laptop:1780/__image_cache?name=da673b3dcfcee2110cc925447c70f573.svg",
2025-01-01 15-12-17.986 [Debug] (Server)       "duration": 317.4540100097656,
2025-01-01 15-12-17.986 [Debug] (Server)       "title": "Fractal"
2025-01-01 15-12-17.986 [Debug] (Server)    }
2025-01-01 15-12-17.986 [Debug] (Server) }
@elParaguayo
Copy link
Author

Closing this. Looks like the plugin is only for librespot-java (which also seems to be unmaintained now).

@chriscn
Copy link
Contributor

chriscn commented Jan 19, 2025

Was looking for someone whom was suffering the same issue as me for this. It would be nice to be able to get the information itno snapcast. Is it a librespot problem at the moment then?

@elParaguayo
Copy link
Author

elParaguayo commented Jan 19, 2025

Looks like the solution would be to write a stream plugin for librespot that gets metadata by using the Spotify API. I'm looking into doing this as I've written a custom stream plugin already but I've not worked with oauth stuff in python much before so that's slowing me down.

It might be easier if I use a library like spotipy to help...

@elParaguayo
Copy link
Author

One problem I can see with this is, if you're using librespot without specifying a username (so anyone on the network can connect/play), the API won't work as you'd need a token for every user.

@elParaguayo
Copy link
Author

The librespot output includes the spotify track ID so we can use that to get track info. The problem is that a stream plugin doesn't have access to this as it's handled by snapserver and is never passed to the plugin.

You could deal with this by having the stream be alsa/pipe/etc and have the stream plugin start a librespot instance so it's able to capture the output and query track info.

This is probably my preferred approach.

@elParaguayo
Copy link
Author

@chriscn FYI I have written a script that will play a librespot stream and provide the additional metadata for now playing tracks. I'm just doing some tidying up of the code and will then post to github after that.

@chriscn
Copy link
Contributor

chriscn commented Jan 27, 2025

@elParaguayo perfect, I think I've seen the repo - if you'd like to talk it through at any point let me know. Would be good to get some docs written for in here (although I'm happy to help with that.

@elParaguayo
Copy link
Author

Want to get a basic working version (configuration was hard coded for testing purposes) but would definitely appreciate some testing etc after that.

@elParaguayo
Copy link
Author

elParaguayo commented Jan 28, 2025

@chriscn It's in a state where you can probably test it. Have added some basic documentation. If you have any comments, please leave them on the issues page there: https://github.com/elParaguayo/snapspot/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants