Check if music playing

Hey guys,
is there any possibility which allows me to check via ssh/sh-script/python-script whether music is playing or not (including music via airplay)?
I want to trigger a script when I start and stop playing music with my PI