CC-2149: Adjustments for DEB packaging

-Done
This commit is contained in:
martin 2011-04-13 12:07:00 -04:00
parent 5f512d47ff
commit 2148de0e92
48 changed files with 53 additions and 31 deletions

View file

@ -1,17 +1,43 @@
<?php
require_once '../../application/configs/conf.php';
// Define path to application directory
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../application'));
echo APPLICATION_PATH.PHP_EOL;
// Ensure library/ is on include_path
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(APPLICATION_PATH . '/../library'));
set_include_path(get_include_path() . PATH_SEPARATOR . APPLICATION_PATH . '/models');
echo get_include_path().PHP_EOL;
//Pear classes.
set_include_path(APPLICATION_PATH . get_include_path() . PATH_SEPARATOR . '/../library/pear');
//Controller plugins.
set_include_path(APPLICATION_PATH . get_include_path() . PATH_SEPARATOR . '/controllers/plugins');
require_once APPLICATION_PATH.'/configs/conf.php';
require_once 'DB.php';
require_once '../../application/models/Playlist.php';
require_once '../../application/models/StoredFile.php';
require_once(__DIR__.'/../../library/propel/runtime/lib/Propel.php');
require_once(APPLICATION_PATH.'/../library/propel/runtime/lib/Propel.php');
require_once 'Soundcloud.php';
require_once 'Playlist.php';
require_once 'StoredFile.php';
require_once 'Schedule.php';
require_once 'Shows.php';
require_once 'Users.php';
require_once 'RabbitMq.php';
require_once 'Preference.php';
//require_once APPLICATION_PATH.'/controllers/plugins/RabbitMqPlugin.php';
// Initialize Propel with the runtime configuration
Propel::init(__DIR__."/../../application/configs/propel-config.php");
// Add the generated 'classes' directory to the include path
set_include_path(__DIR__."/../../application/models" . PATH_SEPARATOR . get_include_path());
Propel::init(__DIR__."/../../../application/configs/airtime-conf.php");
$dsn = $CC_CONFIG['dsn'];
$CC_DBC = DB::connect($dsn, TRUE);
$CC_DBC = DB::connect($dsn, FALSE);
if (PEAR::isError($CC_DBC)) {
echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
exit(1);
@ -20,10 +46,10 @@ $CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
$playlistName = "pypo_playlist_test";
$minutesFromNow = 1;
$secondsFromNow = 30;
echo " ************************************************************** \n";
echo " This script schedules a playlist to play $minutesFromNow minute(s) from now.\n";
echo " This script schedules a playlist to play $secondsFromNow minute(s) from now.\n";
echo " This is a utility to help you debug the scheduler.\n";
echo " ************************************************************** \n";
echo "\n";
@ -45,20 +71,7 @@ $pl->create($playlistName);
$mediaFile = 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/OpSound/Peter Rudenko - Opening.mp3");
$mediaFile = StoredFile::Insert($v);
if (PEAR::isError($mediaFile)) {
var_dump($mediaFile);
exit();
}
}
$pl->addAudioClip($mediaFile->getId());
echo "done.\n";
$mediaFile = StoredFile::findByOriginalName("Manolo Camp - Morning Coffee.mp3");
if (is_null($mediaFile)) {
echo "Adding test audio clip to the database.\n";
$v = array("filepath" => __DIR__."/../../audio_samples/OpSound/Manolo Camp - Morning Coffee.mp3");
$v = array("filepath" => __DIR__."/../../../audio_samples/vorbis.com/Hydrate-Kenny_Beltrey.ogg");
$mediaFile = StoredFile::Insert($v);
if (PEAR::isError($mediaFile)) {
var_dump($mediaFile);
@ -78,9 +91,9 @@ $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...";
// Scheduler: remove any playlists for the next hour
//Schedule::RemoveItemsInRange($startTime, $endTime);
// Check for succcess
// Check for succces
$scheduleClear = Schedule::isScheduleEmptyInRange($startTime, "01:00:00");
if (!$scheduleClear) {
echo "\nERROR: Schedule could not be cleared.\n\n";
@ -92,8 +105,15 @@ echo "done.\n";
// Schedule the playlist for two minutes from now
echo "Scheduling new playlist...\n";
//$playTime = date("Y-m-d H:i:s", time()+(60*$minutesFromNow));
$playTime = date("Y-m-d H:i:s", time()+(20*$minutesFromNow));
$scheduleGroup = new ScheduleGroup();
$scheduleGroup->add($playTime, null, $pl->getId());
$playTime = date("Y-m-d H:i:s", time()+($secondsFromNow));
//$scheduleGroup = new ScheduleGroup();
//$scheduleGroup->add($playTime, null, $pl->getId());
//$show = new ShowInstance($showInstanceId);
//$show->scheduleShow(array($pl->getId()));
//$show->setShowStart();
//$show->setShowEnd();
echo " SUCCESS: Playlist scheduled at $playTime\n\n";