Simple way to run script on playback and stop

Is there a simple way to have OSMC run a shell script on playback and stop events?

I have a Ulanzi clock that I want to turn off during playback. I have searched but only found something like ISY Event Handler which doesn’t seem to exist anymore.

Check this thread should give enough ideas

https://forum.kodi.tv/showthread.php?tid=130923&pid=1097326#pid1097326