[GH-ISSUE #1431] Metadata pipe - is it possible? #645

Closed
opened 2026-02-27 19:31:44 +03:00 by kerem · 14 comments
Owner

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 librespot on):

Debian / Ubuntu in a docker container and also standalone

Thank you so much for any help!

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 `librespot` on): Debian / Ubuntu in a docker container and also standalone Thank you so much for any help!
kerem 2026-02-27 19:31:44 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@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.

<!-- gh-comment-id:2563906477 --> @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.
Author
Owner

@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.

<!-- gh-comment-id:2564036699 --> @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.
Author
Owner

@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.

<!-- gh-comment-id:2564043962 --> @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.
Author
Owner

@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

image

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.

<!-- gh-comment-id:2564091441 --> @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 <img width="419" alt="image" src="https://github.com/user-attachments/assets/1687d313-ec97-4758-a19e-aff601f2b3ef" /> 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.
Author
Owner

@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.

<!-- gh-comment-id:2564097714 --> @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.
Author
Owner

@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 :)

<!-- gh-comment-id:2564106255 --> @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 :)
Author
Owner

@kingosticks commented on GitHub (Dec 28, 2024):

Ok, this is just another #7 then

<!-- gh-comment-id:2564119035 --> @kingosticks commented on GitHub (Dec 28, 2024): Ok, this is just another #7 then
Author
Owner

@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.

<!-- gh-comment-id:2564301655 --> @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.
Author
Owner

@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.

<!-- gh-comment-id:2564328108 --> @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.
Author
Owner

@FrancisHGR commented on GitHub (Dec 28, 2024):

Thank you for the clarification @photovoltex and @kingosticks

<!-- gh-comment-id:2564363967 --> @FrancisHGR commented on GitHub (Dec 28, 2024): Thank you for the clarification @photovoltex and @kingosticks
Author
Owner

@photovoltex commented on GitHub (Dec 31, 2024):

Hey @FrancisHGR, did you find another solution in the end, or did you settle with your pervious?

<!-- gh-comment-id:2566515042 --> @photovoltex commented on GitHub (Dec 31, 2024): Hey @FrancisHGR, did you find another solution in the end, or did you settle with your pervious?
Author
Owner

@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.

<!-- gh-comment-id:2566563765 --> @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.
Author
Owner

@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.

<!-- gh-comment-id:2569777710 --> @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.
Author
Owner

@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.

<!-- gh-comment-id:2706427421 --> @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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#645
No description provided.