Saiyato / volumio-snapcast-plugin

Volumio 2 SnapCast plugin, to easily manage SnapCast functionality
115 stars 25 forks source link

Enhancement: snapcast cliënt notifying the front-end. #21

Open cortegedusage opened 7 years ago

cortegedusage commented 7 years ago

Would be nice if the cliënt could inform volumio it is playing. So it would say snapcast playing in the gui

Saiyato commented 7 years ago

I've only recently read into the volatile state stuff... problem is there is no metadata, so I'm unsure how to propagate the volatile state.

I am sure about the place though, it should be in the client indeed, so I need to make it a bit fatter, because the streaming state is kept at the server, it will need a ndjson library for communication.

Saiyato commented 6 years ago

Just brainstorming here, the server knows whether the clients are playing or not, so querying the server using the mac address of the client should suffice.

Ergo; a ndjson request should be sent every x-seconds to query the server whether the stream the client is connected to is (still) playing or not.

Example:

"streams": [{
                "id": "VOLUMIO-MPD",
                "status": "idle",
                "uri": {
                    "fragment": "",
                    "host": "",
                    "path": "/tmp/snapfifo",
                    "query": {
                        "buffer_ms": "20",
                        "codec": "flac",
                        "mode": "read",
                        "name": "VOLUMIO-MPD",
                        "sampleformat": "44100:16:2"
                    },
                    "raw": "pipe:///tmp/snapfifo?name=VOLUMIO-MPD&mode=read&sampleformat=44100:16:2",
                    "scheme": "pipe"
                }
            }

This part matters: "status": "idle",

FilipLigaarden commented 6 years ago

Snapcast's dev branch has now added support for metadata.

Saiyato commented 6 years ago

That would help alot in populating the volatile state, thanks for the heads up

FilipLigaarden commented 6 years ago

Sorry, let me correct myself. There is a pull request, not yet merged with support for metadata. https://github.com/badaix/snapcast/pull/319

frafall commented 6 years ago

I've sent a pull request to @badaix but haven't gotten response yet. (30 days now).

Status is that I collect metadata from Shairport and Librespot and I'm currently working on a Pulseaudio interface (instead of the pipe) which will include reading the metadata properties as set by Mopidy and others. Currently its text only but its open for any tag name the user wants, I base on Vorbis types. I aim to implement album art, looking into best way to encode to json, will probably go for base64.

Major issues are the non-activity of Librespot, seems it's currently fragmenting, would hate for that to happen but it really needs some proper meta data api.

I'm also testing a Snapcast version with static groups, ie no groups added/deleted by snapserver except the first default group as I wanted a zone concept more than dynamic groups.

I have not done a lot on the client handing off metadata, just made a class for it to put on stderr. I'm kinda undecided on how to hand off metadata, my only use case is json on stderr to a Kodi addon so any input would be appreciated.

Gronis commented 6 years ago

I can see that the your PR on snapcast has been merged. Any progress here to use that metadata and update volumio's front-end?

FilipLigaarden commented 6 years ago

@Gronis frafall's pull merged, will probably be supported in next release of snapcast and hopefully soon after by this plugin.

Gronis commented 6 years ago

Any progress on this?

JoakimLindbom commented 5 years ago

Frafall has been ill, but just 2 days ago he's back online. https://github.com/badaix/snapcast/issues/308

cerbera79 commented 5 years ago

Would love to see this available!

JoakimLindbom commented 4 years ago

I'm taking a stab on this. I've got all modules built on my Rpi4; will report back if the base is stable.

monte-monte commented 4 years ago

@JoakimLindbom great news! I was going to try to implement this feature myself. Any ETA on this? I would like to try the code as soon as possible, cause I'm working on a project that requires this functionality. Thanks!

JoakimLindbom commented 4 years ago

No ETA. Right now I'm porting Frafall's code for librespot from 2017 to the latest dev branch of the current version. Only 200 commits or so behind...