Depending on your parameters, you could setup a JSON file to generate on song change.. something like this -
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))):
"history": [
<!--songlist.START=0-->
<!--songlist.LIMIT=2500-->
<!--LOOP(songlist)-->
{
"title": "$songlist.title$",
"artist": "$songlist.artist$",
"album": "$songlist.album$",
"minsec": "$songlist.mmss$",
"combine": "$songlist.combine$",
"duration": $songlist.duration$,
"picture": "$songlist.picture$",
"buycd": "$songlist.buycd$",
"songid": "$songlist.songID$",
"feedback": {
"likes": 0,
"dislikes": 0
}
},
<!--LOOP_END-->
]
set the song limit to whatever your threshold of how long it must be before the song can be played again.
Then set up a watcher in your php script to check the output JSON file, and if the song id exists in the history, make the visibility: none, or have create a throw.warning that pops up to let them know why they can't choose that song.
anyway,
hope that helps.