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
Output Metadata #154
Comments
From gitter :
So my issue with named pipes is :
A simple file on the other hand wouldn't have these issues. Consumers can read it at any time, and use inotify to get updates it. The downside is inotify is less portable (I believe macOS/BSDs have similar mechanisms), and more complicate to use. Clients which don't want that complexity can just read the file periodically. |
Hi, I've managed to get the metadata to display for a RPi system I'm working on with a VFD display(in a kludgy sort of way). I used @balbuze suggestion for logging the output of librespot and pulling the info out of that. In order to get the full metadata I modified the logging output of player.rs to output the track id in Hex which I could then convert to base62 with a php script which can then use it to look up the metadata from Spotify (my rust programming skills are virtually non-existent so this was the best way for me!). I really like the idea to just use a file (perhaps called now_playing or something similar). It would only be necessary to put the Spotify trackid (preferably the base62 URI style version) and a timecode for when it started playing in the file, then any system could pick this up and use it to get the metadata from the API and to work out timings. It could also act as a flag to other systems that a Spotify track is currently playing. I think that if it was done as part of the player.rs then it should also be available in anything that uses librespot such as spotifyd. I'm not really familiar with named pipes, would it be difficult to do both or have an option to choose either at startup? |
Any updates to metadata in a snippet out there? |
I switched console to file for my systemd service:
and can now grab the player Track Title - anyone got a better solution? INFO:librespot::player: Loading track "I'm the One" |
I made some test and use a bash script that contains #!/bin/bash |
Okay thanks for sharing snippet. Hope there will be more metadata in future. |
Just FYI, @balbuze & @tatoosh - as you seem to resort to parsing the log output for now. Here's a quick and dirty way of getting the (main) artist onto stderr.
|
@seanrand thx |
I've looked into something like this as well and have found a different approach to provide more information in a similar manner. If anybody is intrested in this change, take a look at ov3rk1ll@eedaf1c. |
@ov3rk1ll Have you seen the news at https://developer.spotify.com/news-stories/2017/01/27/removing-unauthenticated-calls-to-the-web-api/ that Spotify will soon require most calls to their endpoints to be authenticated? This will include /tracks and will make stuff like this more painful. |
@kingosticks I've not seen that but it's good to know. Depending on where this ID will be used it might not be too hard to authenticate a user but it'll make using my approach harder. I don't know enough about the architecture of librespot yet to tell it would be possible to somehow share the existing authentication to pull this information. |
If you are still thinking about this, then an option is to expose the metadata like Shairport does: https://github.com/mikebrady/shairport-sync#metadata With the metadata exposed you could also let the listener take care of volume adjustments, which might reduce volume change lag and improve quality. |
Hi all, Chiming in to add my support for metadata for use with |
@ov3rk1ll I found your solution elegant. Reading the spotify doc https://developer.spotify.com/migration-guide-for-unauthenticated-web-api-calls/ it seems we are in this case : "If your app is hosted (i.e. the code is not exposed to the client) and doesn’t need to perform requests on behalf of a user, then client credentials is a good fit." or maybe I misunderstand. I'm compiling your a version of librespot including your code. I the author of the plugin for volumio and I really want to include metadata un the webUI... https://volumio.org/ |
Oh I see Oauth is required to get this infos... more complicated... |
You can get the necessary token through librespot. No need to ask the user for credentials. Then use that token against the web API. Which now supports basic Connect features, too. E.g. It can tell you what track was currently playing on which device etc. |
Oh, I was wrong. It's not part of the librespot executable. But I implemented it in my Spotty helper for the Squeezebox (https://github.com/michaelherger/spotty/blob/master/src/main.rs) |
Thanks for the answers. But I tested several weeks ago and the token sent for librespot was not usable using spotify webapi. I need to retest U guess |
I see! I'll have a look tomorrow! |
For your information, I already provide artist and title to Kodi through a named pipe, like so: Of course, the named pipe could be handled in librespot, but my Rust is too poor. |
@michaelherger thanks for the link. Do you get album art with this ? |
You'd get a URL for the album art IIRC. Or all the information you need to get it. Check the web API. |
Run onstart/onstop when a new song is loaded
@plietar: maybe use gRPC for that? |
Hi!
Not a bug ! Thank you for your great work !
I wrote a plugin for volumio2 using spotify-connect-web and an other new one using librespot.
I managed multi users with 2 instances of librespot
I added some script to check cache size and when limit is reached, purge oldest files in the cache.
Now I would like to add metadata (track name and album art in volumio2. But I need some information on how to get this from librespot.
my repo https://github.com/balbuze/volumio-plugins/tree/master/plugins/music_service/volspotconnect2
The text was updated successfully, but these errors were encountered: