Page 1 of 1

mpd idle mask

Posted: March 23rd, 2021, 5:50 pm
by maihoaomv
Could someone please explain to me what some of the idle mask do?
Some are self-explanatory but a few I could not find much in a way of an explanation of their function.

MPD_IDLE_STICKER
MPD_IDLE_SUBSCRIPTION
MPD_IDLE_PARTITION
MPD_IDLE_NEIGHBOR
MPD_IDLE_MOUNT

I'm trying to write a simple idle function running in a gtk thread that fetches an mpd connection and blocks until an errors occurs.

What would be the best idle mask to use that won't cause idle to exit on anything except an error?

Thanks

Re: mpd idle mask

Posted: March 23rd, 2021, 9:05 pm
by max
The protocol documentation explains them all!
https://www.musicpd.org/doc/html/protoc ... d-s-status

Don't run this in a separate thread - this only adds overhead and is very fragile. Rather register the libmpdclient socket in the GLib event loop and let it invoke a callback when MPD reports an event. This is what ncmpc does (though it doesn't use GTK/GLib, but its own non-blocking I/O event loop, but the concept is the same).

Re: mpd idle mask

Posted: March 24th, 2021, 4:39 pm
by maihoaomv
Max
The link was what I was looking for. As I found out, running it in a thread caused some weird things to happen.
Thank you for the input.