echo " This is a utility to help you debug the scheduler.\n";
echo " ************************************************************** \n";
echo "\n";
echo "Deleting playlists with the name '{$playlistName}'...";
// Delete any old playlists
$pl2 = Playlist::findPlaylistByName($playlistName);
foreach ($pl2 as $playlist) {
    //var_dump($playlist);
    $playlist->delete();
}
echo "done.\n";
// Create a new playlist
echo "Creating new playlist '{$playlistName}'...";
$pl = new Playlist();
$pl->create($playlistName);
$mediaFile = Application_Model_StoredFile::findByOriginalName("Peter_Rudenko_-_Opening.mp3");
if (is_null($mediaFile)) {
    echo "Adding test audio clip to the database.\n";
    $v = array("filepath" => __DIR__ . "/../../../audio_samples/vorbis.com/Hydrate-Kenny_Beltrey.ogg");
    $mediaFile = Application_Model_StoredFile::Insert($v);
}
$pl->addAudioClip($mediaFile->getId());
echo "done.\n";
//$pl2 = Playlist::findPlaylistByName("pypo_playlist_test");
//var_dump($pl2);
// Get current time
// In the format YYYY-MM-DD HH:MM:SS.nnnnnn
$startTime = date("Y-m-d H:i:s");
$endTime = date("Y-m-d H:i:s", time() + 60 * 60);
echo "Removing everything from the scheduler between {$startTime} and {$endTime}...";
// Check for succces