Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
a6927442ec
|
@ -260,12 +260,15 @@ class Show {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all the show instances in the given time range.
|
||||||
|
*
|
||||||
* @param string $start_timestamp
|
* @param string $start_timestamp
|
||||||
* In the format "YYYY-MM-DD HH:mm:ss"
|
* In the format "YYYY-MM-DD HH:mm:ss". This time is inclusive.
|
||||||
* @param string $end_timestamp
|
* @param string $end_timestamp
|
||||||
* In the format "YYYY-MM-DD HH:mm:ss"
|
* In the format "YYYY-MM-DD HH:mm:ss". This time is inclusive.
|
||||||
* @param unknown_type $excludeInstance
|
* @param unknown_type $excludeInstance
|
||||||
* @param boolean $onlyRecord
|
* @param boolean $onlyRecord
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getShows($start_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=FALSE)
|
public static function getShows($start_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=FALSE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,9 +14,15 @@ require_once __DIR__.'/../../../library/propel/runtime/lib/Propel.php';
|
||||||
|
|
||||||
Propel::init(__DIR__.'/../../configs/airtime-conf.php');
|
Propel::init(__DIR__.'/../../configs/airtime-conf.php');
|
||||||
|
|
||||||
|
|
||||||
AirtimeInstall::DbConnect(true);
|
AirtimeInstall::DbConnect(true);
|
||||||
|
$sql = "DELETE FROM cc_show";
|
||||||
|
$CC_DBC->query($sql);
|
||||||
|
$sql = "DELETE FROM cc_show_days";
|
||||||
|
$CC_DBC->query($sql);
|
||||||
|
$sql = "DELETE FROM cc_show_instances";
|
||||||
|
$CC_DBC->query($sql);
|
||||||
|
|
||||||
|
/*
|
||||||
// Create a playlist
|
// Create a playlist
|
||||||
$playlist = new Playlist();
|
$playlist = new Playlist();
|
||||||
$playlist->create("Calendar Load test playlist ".uniqid());
|
$playlist->create("Calendar Load test playlist ".uniqid());
|
||||||
|
@ -34,65 +40,64 @@ $result = $playlist->addAudioClip($storedFile2->getId());
|
||||||
$result = $playlist->addAudioClip($storedFile2->getId());
|
$result = $playlist->addAudioClip($storedFile2->getId());
|
||||||
|
|
||||||
echo "Created playlist ".$playlist->getName()." with ID ".$playlist->getId()."\n";
|
echo "Created playlist ".$playlist->getName()." with ID ".$playlist->getId()."\n";
|
||||||
|
*/
|
||||||
// Create the shows
|
// Create the shows
|
||||||
|
|
||||||
$data = array();
|
|
||||||
|
|
||||||
$currentDate = date("Y\\-m\\-d");
|
function createTestShow($showNumber, $showTime, $duration = "1:00")
|
||||||
|
|
||||||
$year = date("Y");
|
|
||||||
$month = date("m");
|
|
||||||
$day = date("d");
|
|
||||||
|
|
||||||
$nextDay = $currentDate;
|
|
||||||
|
|
||||||
#echo $currentDate;
|
|
||||||
$currentHour = date("H");
|
|
||||||
$setHour = $currentHour + 1;
|
|
||||||
|
|
||||||
$showNumber = 1;
|
|
||||||
for ($days=1; $days<100; $days=$days+1)
|
|
||||||
{
|
{
|
||||||
// Adding shows until the end of the day
|
$data = array();
|
||||||
while ($setHour < 24)
|
$strTime = $showTime->format("Y-m-d H:i");
|
||||||
{
|
echo "Adding show: $strTime\n";
|
||||||
echo 'Adding show: '.$nextDay. ' '.$setHour.":00\n";
|
$data['add_show_name'] = 'automated show '.$showNumber;
|
||||||
$data['add_show_name'] = 'automated show '.$showNumber;
|
$data['add_show_start_date'] = $showTime->format("Y-m-d");
|
||||||
$data['add_show_start_date'] = $nextDay;
|
$data['add_show_start_time'] = $showTime->format("H:i");
|
||||||
$data['add_show_start_time'] = $setHour.':00';
|
$data['add_show_duration'] = $duration;
|
||||||
$showNumber = $showNumber + 1;
|
$data['add_show_no_end'] = 0;
|
||||||
$data['add_show_duration'] = '1:00';
|
$data['add_show_repeats'] = 0;
|
||||||
$data['add_show_no_end'] = 0;
|
$data['add_show_description'] = 'automated show';
|
||||||
$data['add_show_repeats'] = 0;
|
$data['add_show_url'] = 'http://www.OfirGal.com';
|
||||||
$data['add_show_description'] = 'automated show';
|
$data['add_show_color'] = "";
|
||||||
$data['add_show_url'] = 'http://www.OfirGal.com';
|
$data['add_show_background_color'] = "";
|
||||||
$data['add_show_color'] = "";
|
$data['add_show_record'] = 0;
|
||||||
$data['add_show_background_color'] = "";
|
$data['add_show_hosts'] ="";
|
||||||
$data['add_show_record'] = 0;
|
$showId = Show::create($data);
|
||||||
$data['add_show_hosts'] ="";
|
//echo "show created, ID: $showId\n";
|
||||||
$showId = Show::create($data);
|
|
||||||
Show::populateShowUntil($showId, "2012-01-01 00:00:00");
|
|
||||||
|
|
||||||
// populating the show with a playlist
|
// populating the show with a playlist
|
||||||
$show = new ShowInstance($showId);
|
$instances = Show::getShows($showTime->format("Y-m-d H:i:s"), $showTime->format("Y-m-d H:i:s"));
|
||||||
$show->scheduleShow(array($playlist->getId()));
|
$instance = array_pop($instances);
|
||||||
|
$show = new ShowInstance($instance["instance_id"]);
|
||||||
$setHour = $setHour + 1;
|
//echo "Adding playlist to show instance ".$show->getShowInstanceId()."\n";
|
||||||
}
|
$show->scheduleShow(array(1));
|
||||||
// set the next day
|
//echo "done\n";
|
||||||
$setHour = 0;
|
//$show->scheduleShow(array($playlist->getId()));
|
||||||
if ($day<30) {
|
|
||||||
$day = $day + 1;
|
|
||||||
} else {
|
|
||||||
$day = 1;
|
|
||||||
if ($month<12)
|
|
||||||
{
|
|
||||||
$month = $month + 1;
|
|
||||||
} else {
|
|
||||||
$month = 1;
|
|
||||||
$year = $year + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$nextDay = $year."-".$month."-".$day;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$showTime = new DateTime();
|
||||||
|
|
||||||
|
$resolution = "minute";
|
||||||
|
$showNumber = 1;
|
||||||
|
$numberOfDays = 0;
|
||||||
|
$numberOfHours = 1;
|
||||||
|
$endDate = new DateTime();
|
||||||
|
$endDate->add(new DateInterval("P".$numberOfDays."DT".$numberOfHours."H"));
|
||||||
|
echo "End date: ".$endDate->format("Y-m-d H:i")."\n";
|
||||||
|
|
||||||
|
while ($showTime < $endDate) {
|
||||||
|
echo $showTime->format("Y-m-d H:i")." < " .$endDate->format("Y-m-d H:i")."\n";
|
||||||
|
if ($resolution == "minute") {
|
||||||
|
createTestShow($showNumber, $showTime, "0:01");
|
||||||
|
$showTime->add(new DateInterval("PT1M"));
|
||||||
|
} elseif ($resolution == "hour") {
|
||||||
|
createTestShow($showNumber, $showTime);
|
||||||
|
$showTime->add(new DateInterval("PT1H"));
|
||||||
|
}
|
||||||
|
$showNumber = $showNumber + 1;
|
||||||
|
}
|
||||||
|
RabbitMq::PushScheduleFinal();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue