Trying to stop media player after 1 random song in automation

Hey All, I have a script that will play a playlist on shuffle. What I want to do is stop the media player after one song plays. Looking at the media player attributes as it plays, nothing I see changes to a default state before switching to a new song. Is there a way to write something that could stop the player once the attribute changes to anything? Since it’s random there wouldn’t be a set attribute to stop it.

The ultimate goal is to have a random song play from a holiday playlist on the hour.

Thanks for your time.

If anyone ever stumbles across this, I kind of figured it out. I created an input boolean to turn on when the song starts and created another automation that when the media player attribute for the title changes, it will stop the media player (I delayed the input boolean to turn on 10 seconds to make sure it works). The condition is that the input boolean needs to be on. When the automation stops the song after it changes the title, another action turns off the input boolean.