philippe44 / AirConnect

Use AirPlay to stream to UPnP/Sonos & Chromecast devices
Other
3.46k stars 217 forks source link

Retrieve Metadata Interface Somewhere #294

Open syhan opened 3 years ago

syhan commented 3 years ago

I would like to know any possibility to add an extra interface (ideally a web endpoint or simply a file) to retrieve metadata while playing MP3 and the RTSP SET_PARAMETER channel? So that it would be possible to display the metadata info (track name, current lyrics, artist, etc.) somewhere else

Thanks

philippe44 commented 3 years ago

What target (speakers) are you using? If you send mp3 as well to it, then you will have metadata if they support ICY protocol. Otherwise, I would have to create another thread with a small webserver just for that. Can you elaborate a bit more how you want to display then the metadata and maybe if you can gather a few more interested users, I can think about adding such option

yinka commented 3 years ago

I am interested in this as well: large album art. artist, album and current track

Being trying to build something similar to this, but I'd rather have it on a webpage

syhan commented 3 years ago

@philippe44 actually I am using a Xiaoai speaker which offers DLNA/bluetooth capability for accessibility, but there's no display equipped, so I'd like to show it somewhere, ideally my Raspberry Pi + LCD, and one further request, it would be nicer if you could wrap existing AirPlay device (I have two Apple TV 3rd Gen without display attached) so that headless AirPlay would be displayed anywhere it like

@yinka a neat solution, liked

philippe44 commented 3 years ago

Now that I'm thinking about it, and I'd have to refresh my memory about AirPlay remote & controllers, but can't you already query the controller? I'm doing something similar in AirConnect to feedback UPnP/Cast actions to it. Finding the remote controller then connecting to it

syhan commented 3 years ago

Ok, thanks for the insight, I'll try to digest the code (though I have no expertise in C) and see any point I could hook in:)

philippe44 commented 3 years ago

Oh if you are not familiar with C, I would not recommend doing that. it will be extra painful. I was more thinking about using any tools/language/library you're comfortable with, totally external to AirConnect, to connect to the AirPlay controller and query it.

I'm not sure this is possible, I'd have to re-read AirPlay description and DACP/DAAP. Otherwise, as said above, I would then need to add a webserver to serve metadata request. It's easy for artist/album but albumart is a bit more inconvenient, especially because AirPlay sends a full jpeg blob, not an URL. and even today, for players that support ICY, the artwork is a fixed item, not the real one

syhan commented 3 years ago

I've read the AirPlay protocol long time ago, what come to my mind should be worked as a proxy/shadow AirPlay service and bypass all RSTP requests to the "real" AirPlay but only expose the metadata to the external consumer. What stops me move on is how to talk with AirPlay controller, maybe I could get some inspiration from this project and seek the possibility. But anyway, thanks in advance and look forward

philippe44 commented 3 years ago

What about a MQTT broker?

syhan commented 3 years ago

What about a MQTT broker?

Do you mean AirConnect acts like a MQTT publisher, any subscriber whom listen to the topic would get the information in time? I like this solution and it would be simple to integrate with HomeAssistant as well as other existing service:)

philippe44 commented 3 years ago

Yes, that's the idea. I think shairport does that as well so I would stick to the same format (but I'm not decided yet to add that feature)

postlund commented 3 years ago

A related topic, albeit no quite the same, but does anybody know if it's possible to query an AirPlay receiver for current metadata? I'm writing a client library and I would like to expose what is currently playing if something is playing but also support streaming (in which case I know what is playing as a side-effect). Seems like RAOP only cares for output, so I took a look at the video part ("AirPlay") and /playback-status seems to do what I'm after, but I just get Internal server error when calling that. Other endpoints, like /server-info works fine. Setting up a reverse connection seems to work OK too, but I never see any events there. So I'm not sure where to go from here. As iOS can do it from action center, I assume it's possible. I however suspect that it's done via the companion protocol, something I have just partially reverse engineered. So that would leave me with no options for now. The receiver in my case is a HomePod mini (just to mention that).