Hooking into stop / play commands

You can accomplish this by writing an extension and implementing the appropriate core listener method(s). See Can anyone show me an example of API CoreListener?

Or you could use the mpd interface’s idle functionality: https://bbs.archlinux.org/viewtopic.php?pid=581518#p581518