DJ Management Script

I present to you the script I wrote to take care of Live DJs in Sam. There are a number of different ways this could be done. If you wish to do it differently or port it to a language other than PHP, go for it (just be sure to share).

Before switching from Auto DJ to the specified Live DJ the script checks that the Live DJ is actually on the air. If the Live DJ is on the air, the Auto DJ fades to the Live DJ. If the Live DJ is not on the air when he is supposed to be, nothing happens. If the Live DJ drops the stream, the scripts switches back to the Auto DJ and rechecks every 2 seconds to see if the Live DJ has returned. If the Live DJ returns, we switch back to him.

Known issues:
* If schedule.php is inaccessible or doesn’t return the expected number of lines, Sam will crash.
* If current.txt or past.txt are inaccessible or don’t return the expected number of lines, Sam will crash.
Continue reading