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

Metadata pipe - is it possible? #1431

Closed
FrancisHGR opened this issue Dec 27, 2024 · 13 comments
Closed

Metadata pipe - is it possible? #1431

FrancisHGR opened this issue Dec 27, 2024 · 13 comments
Labels

Comments

@FrancisHGR
Copy link

FrancisHGR commented Dec 27, 2024

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!

@FrancisHGR FrancisHGR added the bug label Dec 27, 2024
@kingosticks
Copy link
Contributor

kingosticks commented 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
Copy link
Author

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
Copy link
Contributor

kingosticks commented 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
Copy link
Author

FrancisHGR commented 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.

@kingosticks
Copy link
Contributor

kingosticks commented 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
Copy link
Author

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
Copy link
Contributor

Ok, this is just another #7 then

@FrancisHGR
Copy link
Author

FrancisHGR commented 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
Copy link
Member

#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
Copy link
Author

Thank you for the clarification @photovoltex and @kingosticks

@photovoltex
Copy link
Member

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

@FrancisHGR
Copy link
Author

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
Copy link

iVolt1 commented 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.

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

No branches or pull requests

4 participants