Hooking into events in MPD

Need help with MPD?
Post Reply
bpl
Posts: 2
Joined: February 11th, 2020, 8:12 pm

Hooking into events in MPD

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

max
Forum team
Posts: 1130
Joined: January 15th, 2013, 3:43 pm

Re: Hooking into events in MPD

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

bpl
Posts: 2
Joined: February 11th, 2020, 8:12 pm

Re: Hooking into events in MPD

Post by bpl »

Cool, thanks, I'll try that.

Post Reply