CC-3174 : showbuilder

fixing scheduling rebroadcasts, show content.
This commit is contained in:
Naomi Aro 2012-02-27 14:33:56 +01:00
parent 4a02d12600
commit 9c248bb34d
2 changed files with 27 additions and 29 deletions

View File

@ -230,9 +230,8 @@ class Application_Model_Scheduler {
} }
/* /*
* @param array $scheduledIds * @param array $scheduleItems
* @param array $fileIds * @param array $mediaItems
* @param array $playlistIds
*/ */
public function scheduleAfter($scheduleItems, $mediaItems, $adjustSched = true) { public function scheduleAfter($scheduleItems, $mediaItems, $adjustSched = true) {

View File

@ -364,19 +364,16 @@ class Application_Model_ShowInstance {
* @param int $plId * @param int $plId
* Playlist ID. * Playlist ID.
*/ */
public function addPlaylistToShow($plId) public function addPlaylistToShow($pl_id)
{ {
$sched = new Application_Model_ScheduleGroup(); $ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
$lastGroupId = $this->getLastGroupId(); $id = $this->_showInstance->getDbId();
if (is_null($lastGroupId)) { $scheduler = new Application_Model_Scheduler();
$groupId = $sched->add($this->_instanceId, $this->getShowInstanceStart(), null, $plId); $scheduler->scheduleAfter(
} array(array("id" => 0, "instance" => $id, "timestamp" => $ts)),
else { array(array("id" => $pl_id, "type" => "playlist"))
$groupId = $sched->addPlaylistAfter($this->_instanceId, $lastGroupId, $plId); );
}
Application_Model_RabbitMq::PushSchedule();
$this->updateScheduledTime();
} }
/** /**
@ -386,17 +383,14 @@ class Application_Model_ShowInstance {
*/ */
public function addFileToShow($file_id) public function addFileToShow($file_id)
{ {
$sched = new Application_Model_ScheduleGroup(); $ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
$lastGroupId = $this->getLastGroupId(); $id = $this->_showInstance->getDbId();
if (is_null($lastGroupId)) { $scheduler = new Application_Model_Scheduler();
$groupId = $sched->add($this->_instanceId, $this->getShowInstanceStart(), $file_id); $scheduler->scheduleAfter(
} array(array("id" => 0, "instance" => $id, "timestamp" => $ts)),
else { array(array("id" => $file_id, "type" => "audioclip"))
$groupId = $sched->addFileAfter($this->_instanceId, $lastGroupId, $file_id); );
}
Application_Model_RabbitMq::PushSchedule();
$this->updateScheduledTime();
} }
/** /**
@ -592,8 +586,15 @@ class Application_Model_ShowInstance {
foreach ($rebroadcasts as $rebroadcast) { foreach ($rebroadcasts as $rebroadcast) {
$rebroad = new Application_Model_ShowInstance($rebroadcast->getDbId()); try {
$rebroad->addFileToShow($file_id); $rebroad = new Application_Model_ShowInstance($rebroadcast->getDbId());
$rebroad->addFileToShow($file_id);
}
catch (Exception $e) {
Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
}
} }
} }
@ -655,9 +656,7 @@ class Application_Model_ShowInstance {
global $CC_DBC; global $CC_DBC;
$sql = "SELECT * $sql = "SELECT *
FROM (cc_schedule AS s LEFT JOIN cc_files AS f ON f.id = s.file_id FROM (cc_schedule AS s LEFT JOIN cc_files AS f ON f.id = s.file_id)
LEFT JOIN cc_playlist AS p ON p.id = s.playlist_id )
WHERE s.instance_id = '{$this->_instanceId}' ORDER BY starts"; WHERE s.instance_id = '{$this->_instanceId}' ORDER BY starts";
Logging::log($sql); Logging::log($sql);