mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #1431] Metadata pipe - is it possible? #645
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#645
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @FrancisHGR on GitHub (Dec 27, 2024).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1431
Description
I would like to pipe the metadata of the spotify content (artist + song title) in the same way I pipe the audio. I am not sure whether this feature is included and I am to stupid to find it or whether its not included. I found some hints in the cargo.toml but I am not expert on this.
Version
I am using the latest version, 0.6.0. Everything else is working besides that. I pipe the music to owntone.
Host (what you are running
librespoton):Debian / Ubuntu in a docker container and also standalone
Thank you so much for any help!
@kingosticks commented on GitHub (Dec 27, 2024):
You probably want https://github.com/librespot-org/librespot/wiki/Events it's the closest thing we have to what you're after.
@FrancisHGR commented on GitHub (Dec 27, 2024):
Thank you for pointing me to Events. The data seems to be there, this would require however to build an own pipe and store the data in some form of format that can be interrupted by owntone (which I lack documentation for).
is there no integrated solution that already saves the metadata in the right format in a pipe, in the same way like the audio output is stored there. I can’t be the only one with this need.
@kingosticks commented on GitHub (Dec 27, 2024):
What's the format you require? Some specific metadata format your other software understands? This project doesn't provide things like that, but all the tools are there for you to create what you need for your use case.
Perhaps open this up as a discussion topic rather than an issue. Maybe someone has done something similar before.
@FrancisHGR commented on GitHub (Dec 27, 2024):
I was not aware that my question is so unclear. I referred to owntone as the app consuming the pipe metadata. With some research I was able to deduct the following format for the metadata pipe:
<item><type>636f7265</type><code>61736172</code><length>8</length> <data encoding="base64"> SW50ZXJwcmV0</data></item> <item><type>636f7265</type><code>6173616c</code><length>13</length> <data encoding="base64"> U29uZw==</data></item> <item><type>636f7265</type><code>6d696e6d</code><length>38</length> <data encoding="base64"> QWxidW0=</data></item>this is then shown as Interpret, Song and Album. I can pipe it already into owntone via cat metadata.txt > spotify.metadata
Together with your hint about events, I think I can use this Python event handler ( https://github.com/librespot-org/librespot/blob/dev/contrib/event_handler_example.py ) script to write into a txt file and then pipe it to owntone.
I just can't believe this hacky solution is the only one and librespot doesn't have a really elegant one.
@kingosticks commented on GitHub (Dec 27, 2024):
Great, glad you found a solution to your problem. Perhaps suggest the owntone developers integrate it into their offering. Something so specific to a downstream project is never going to be provided here, it makes no sense. If there's some generic functionality/improvement that librespot can provide that makes this sort of thing easier, please feel free to make suggestions. The idea is we provide simple and flexible mechanisms that can be customised to serve everyone's needs, not just particular programs like owntone. Hope that is clearer.
@FrancisHGR commented on GitHub (Dec 28, 2024):
I think there is a misunderstanding. I am not asking for anything that is particular for only owntone.
I was asking for a pipe of the metadata, in the very exact same way the audio can be piped. This is after all a central functionality at the core of librespot, isn't it?
So piping metadata of the song / album / artist via a flag via librespot is all I was asking for. If and how this data is then interpreted and reformatted, is a complete different topic and indeed specific to a downstream project.
But again, the main question was how to have not only an audio pipe via mkfifo but also metadata pipe via mkfifo.
Hope this was more understandable :)
@kingosticks commented on GitHub (Dec 28, 2024):
Ok, this is just another #7 then
@FrancisHGR commented on GitHub (Dec 28, 2024):
I think this thread sums it up well.
There is talk of a --metadata-pipe /opt/music/spotify.metadata which however gives me command line parsing errors. Also there is this metadata folder as part of this repo: https://github.com/librespot-org/librespot/tree/dev/metadata
That's why my question was, is there an integrated command line functionality or not? I was unsure and wanted to confirm.
@photovoltex commented on GitHub (Dec 28, 2024):
#214 wasn't merged as it seems to be declared out of scope of the library project with the argument to implement it in https://github.com/librespot-org/librespotd.
So currently the binary doesn't provide the feature you are looking for. The library however does provide the functionality, as @kingosticks already pointed out.
You could take a look at https://github.com/Spotifyd/spotifyd. Maybe they did implement something similar to what you are looking for.
@FrancisHGR commented on GitHub (Dec 28, 2024):
Thank you for the clarification @photovoltex and @kingosticks
@photovoltex commented on GitHub (Dec 31, 2024):
Hey @FrancisHGR, did you find another solution in the end, or did you settle with your pervious?
@FrancisHGR commented on GitHub (Dec 31, 2024):
I investigated the format that is needed for the metadata in a txt file, example above. You can then create a fifo with "mkfifo spotify.metadata" and pipe the metadata with "cat ./metadata.txt > spotify.metadata" .
Beyond that I didn't continue, in principle I have an idea how to do it but I have other more pressing things to do for now. In case another librespot version is available that includes a metadata pipe, I'd be interested though.
@iVolt1 commented on GitHub (Jan 3, 2025):
librespot-java has had the code to output metadata to a pipe that is consumable for OwnTone so that may be a good reference. Since librespot-java is not actively maintained beyond the occasional bug fix, it would be nice to see this feature added to librespot.
@iVolt1 commented on GitHub (Mar 7, 2025):
Will this enhancement ever get any traction? There are no great work aounds and it seems entirely in scope for what a spotify connect player should do and is implemented in other spotify connect players. I think someone provided code to do this years back, although that probably needs to be completely rewritten.