volumio-snapcast-plugin icon indicating copy to clipboard operation
volumio-snapcast-plugin copied to clipboard

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

Open cortegedusage opened this issue 7 years ago • 14 comments

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

cortegedusage avatar Oct 09 '17 20:10 cortegedusage

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 avatar Oct 09 '17 20:10 Saiyato

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",

Saiyato avatar Oct 30 '17 18:10 Saiyato

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

FilipLigaarden avatar Dec 05 '17 10:12 FilipLigaarden

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

Saiyato avatar Dec 05 '17 10:12 Saiyato

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

FilipLigaarden avatar Dec 07 '17 08:12 FilipLigaarden

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.

frafall avatar Dec 29 '17 19:12 frafall

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?

Gronis avatar Feb 07 '18 22:02 Gronis

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

FilipLigaarden avatar Feb 28 '18 12:02 FilipLigaarden

Any progress on this?

Gronis avatar Sep 15 '18 22:09 Gronis

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

JoakimLindbom avatar Dec 16 '18 13:12 JoakimLindbom

Would love to see this available!

cerbera79 avatar Jun 30 '19 13:06 cerbera79

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

JoakimLindbom avatar Jan 02 '20 11:01 JoakimLindbom

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

monte-monte avatar Jan 02 '20 21:01 monte-monte

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

JoakimLindbom avatar Jan 02 '20 23:01 JoakimLindbom