CC-3451 : Ability to delete the currently playing clip
This commit is contained in:
parent
275faa1881
commit
10e4ae781f
5 changed files with 154 additions and 122 deletions
|
@ -130,11 +130,11 @@ class Application_Model_Scheduler {
|
|||
//fillers are for only storing a chunk of time space that has already passed.
|
||||
$filler = new CcSchedule();
|
||||
$filler->setDbStarts($DT)
|
||||
->setDbEnds($nowDT)
|
||||
->setDbClipLength($cliplength)
|
||||
->setDbPlayoutStatus(-1)
|
||||
->setDbInstanceId($instance->getDbId())
|
||||
->save($this->con);
|
||||
->setDbEnds($nowDT)
|
||||
->setDbClipLength($cliplength)
|
||||
->setDbPlayoutStatus(-1)
|
||||
->setDbInstanceId($instance->getDbId())
|
||||
->save($this->con);
|
||||
}
|
||||
else {
|
||||
$nextDT = $DT;
|
||||
|
@ -425,6 +425,8 @@ class Application_Model_Scheduler {
|
|||
|
||||
$removedItems = CcScheduleQuery::create()->findPks(array_keys($scheduledIds));
|
||||
|
||||
//check to see if the current item is being deleted so we can truncate the record.
|
||||
$currentItem = null;
|
||||
//check to make sure all items selected are up to date
|
||||
foreach ($removedItems as $removedItem) {
|
||||
$ts = $scheduledIds[$removedItem->getDbId()];
|
||||
|
@ -438,10 +440,25 @@ class Application_Model_Scheduler {
|
|||
$show = $instance->getCcShow($this->con);
|
||||
throw new OutDatedScheduleException("The show {$show->getDbName()} has been previously updated!");
|
||||
}
|
||||
|
||||
//check to truncate the currently playing item instead of deleting it.
|
||||
if ($removedItem->isCurrentItem()) {
|
||||
$now = new DateTime("now", new DateTimeZone("UTC"));
|
||||
|
||||
$nEpoch = $now->format('U');
|
||||
$sEpoch = $removedItem->getDbStarts('U');
|
||||
$length = $nEpoch - $sEpoch;
|
||||
$cliplength = Application_Model_Playlist::secondsToPlaylistTime($length);
|
||||
|
||||
$removedItem->setDbClipLength($cliplength);
|
||||
$removedItem->setDbEnds($now);
|
||||
$removedItem->save($this->con);
|
||||
}
|
||||
else {
|
||||
$removedItem->delete($this->con);
|
||||
}
|
||||
}
|
||||
|
||||
$removedItems->delete($this->con);
|
||||
|
||||
if ($adjustSched === true) {
|
||||
//get the show instances of the shows we must adjust times for.
|
||||
foreach ($removedItems as $item) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue