mpd idle mask

Cool stuff you can do with MPD. A place for you to put your hacks and patches, or be inspired by others'.
Post Reply
maihoaomv
Posts: 5
Joined: June 12th, 2015, 5:51 am

mpd idle mask

Post 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
max
Forum team
Posts: 1270
Joined: January 15th, 2013, 3:43 pm

Re: mpd idle mask

Post 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).
maihoaomv
Posts: 5
Joined: June 12th, 2015, 5:51 am

Re: mpd idle mask

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