Page 1 of 1

Hooking into events in MPD

Posted: February 11th, 2020, 8:21 pm
by bpl
I run MPD on a server that is HDMI-connected to an AV-receiver. Whenever an MPD client requests to start playing music, I'd like to 'hook' into this event on the MPD server to check if the AV-receiver is currently on, switch it on if it is off and then proceed with playing the music. I can write a simple script to interact with the receiver, but I'm not sure how to detect the event of MPD starting playback. Is it possible to somehow intercept such events? Or does anyone have an alternative solution to this problem?

Thanks so much!

Re: Hooking into events in MPD

Posted: February 12th, 2020, 7:16 am
by max
Write a MPD client which waits for "player" idle events, and keeps track of MPD's playback status. You can do that in a couple of lines of Python.

Re: Hooking into events in MPD

Posted: February 12th, 2020, 8:42 pm
by bpl
Cool, thanks, I'll try that.