From a18fc87d9751906ce245c7e58a6f028684c8a204 Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 8 May 2013 14:19:22 -0400 Subject: [PATCH 1/2] CC-5065 : Playlist length is not built on actual cue in/out value --- airtime_mvc/application/models/Block.php | 13 +++++++++---- airtime_mvc/application/models/airtime/CcFiles.php | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index 1a068fd08..6098f2b85 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -488,7 +488,7 @@ SQL; } foreach ($p_items as $ac) { - Logging::info("Adding audio file {$ac[0]}"); + //Logging::info("Adding audio file {$ac[0]}"); try { if (is_array($ac) && $ac[1] == 'audioclip') { $res = $this->insertBlockElement($this->buildEntry($ac[0], $pos)); @@ -658,7 +658,7 @@ SQL; public function getFadeInfo($pos) { - Logging::info("Getting fade info for pos {$pos}"); + //Logging::info("Getting fade info for pos {$pos}"); $row = CcBlockcontentsQuery::create() ->joinWith(CcFilesPeer::OM_CLASS) @@ -1275,8 +1275,10 @@ SQL; $isBlockFull = false; while ($iterator->valid()) { + $id = $iterator->current()->getDbId(); - $length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength()); + $fileLength = $iterator->current()->getCueLength(); + $length = Application_Common_DateHelper::calculateLengthInSeconds($fileLength); $insertList[] = array('id'=>$id, 'length'=>$length); $totalTime += $length; $totalItems++; @@ -1291,8 +1293,11 @@ SQL; $sizeOfInsert = count($insertList); - // if block is not full and reapeat_track is check, fill up more + // if block is not full and repeat_track is check, fill up more while (!$isBlockFull && $repeat == 1 && $sizeOfInsert > 0) { + Logging::debug("adding repeated tracks."); + Logging::debug("total time = " . $totalTime); + $randomEleKey = array_rand(array_slice($insertList, 0, $sizeOfInsert)); $insertList[] = $insertList[$randomEleKey]; $totalTime += $insertList[$randomEleKey]['length']; diff --git a/airtime_mvc/application/models/airtime/CcFiles.php b/airtime_mvc/application/models/airtime/CcFiles.php index 001c2c7a1..7ceb5e5e8 100644 --- a/airtime_mvc/application/models/airtime/CcFiles.php +++ b/airtime_mvc/application/models/airtime/CcFiles.php @@ -12,6 +12,20 @@ * @package propel.generator.campcaster */ class CcFiles extends BaseCcFiles { + + public function getCueLength() + { + $cuein = $this->getDbCuein(); + $cueout = $this->getDbCueout(); + + $cueinSec = Application_Common_DateHelper::calculateLengthInSeconds($cuein); + $cueoutSec = Application_Common_DateHelper::calculateLengthInSeconds($cueout); + $lengthSec = bcsub($cueoutSec, $cueinSec, 6); + + $length = Application_Common_DateHelper::secondsToPlaylistTime($lengthSec); + + return $length; + } public function getDbLength($format = "H:i:s.u") { From fe88e6249af8d2cacb0fbf3fdbb11cf9cba26b22 Mon Sep 17 00:00:00 2001 From: denise Date: Wed, 8 May 2013 15:08:56 -0400 Subject: [PATCH 2/2] CC-5093: Please disable link option for recording show --- airtime_mvc/application/services/ShowFormService.php | 2 +- airtime_mvc/public/js/airtime/schedule/add-show.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/services/ShowFormService.php b/airtime_mvc/application/services/ShowFormService.php index e9cb8c5ea..a82279a56 100644 --- a/airtime_mvc/application/services/ShowFormService.php +++ b/airtime_mvc/application/services/ShowFormService.php @@ -216,7 +216,7 @@ class Application_Service_ShowFormService 'add_show_no_end' => (!$service_show->getRepeatingEndDate()), 'add_show_monthly_repeat_type' => $monthlyRepeatType)); - if (!$this->ccShow->isLinkable()) { + if (!$this->ccShow->isLinkable() || $this->ccShow->isRecorded()) { $form->getElement('add_show_linked')->setOptions(array('disabled' => true)); } } diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index 7f0d0e29f..2e8fd7454 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -191,6 +191,12 @@ function setAddShowEvents() { $(this).blur(); form.find("#add_show_rebroadcast").toggle(); + if (form.find("#add_show_record").attr("checked")) { + form.find("#add_show_linked").attr("checked", false).attr("disabled", true); + } else { + form.find("#add_show_linked").attr("disabled", false); + } + //uncheck rebroadcast checkbox form.find("#add_show_rebroadcast").attr('checked', false);