From e104146b9ad5ba5a8d93d369522ec47dfff919ce Mon Sep 17 00:00:00 2001 From: denise Date: Thu, 23 May 2013 16:10:00 -0400 Subject: [PATCH 1/9] CC-5138: Linked Show: Time limitation exceeds when adding 24 hours smart block into daily repeating & linked shows Removed propel from calculateCrossfades function and used prepared statements instead --- airtime_mvc/application/models/Scheduler.php | 56 +++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/airtime_mvc/application/models/Scheduler.php b/airtime_mvc/application/models/Scheduler.php index 25b01fa01..efaa8e682 100644 --- a/airtime_mvc/application/models/Scheduler.php +++ b/airtime_mvc/application/models/Scheduler.php @@ -424,33 +424,39 @@ class Application_Model_Scheduler * This function recalculates the start/end times of items in a gapless show to * account for crossfade durations. */ - private function calculateCrossfades($showInstance) + private function calculateCrossfades($instanceId) { - Logging::info("adjusting start, end times of scheduled items to account for crossfades show instance #".$showInstance); - - $instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con); - if (is_null($instance)) { - throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!")); - } - - $itemStartDT = $instance->getDbStarts(null); - $itemEndDT = null; - - $schedule = CcScheduleQuery::create() - ->filterByDbInstanceId($showInstance) - ->orderByDbStarts() - ->find($this->con); - - foreach ($schedule as $item) { - $itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength()); + Logging::info("adjusting start, end times of scheduled items to account for crossfades show instance #".$instanceId); - $item->setDbStarts($itemStartDT) - ->setDbEnds($itemEndDT); + $sql = "SELECT * FROM cc_show_instances ". + "WHERE id = {$instanceId}"; + $instance = Application_Common_Database::prepareAndExecute( + $sql, array(), Application_Common_Database::SINGLE); - $itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration); - } - - $schedule->save($this->con); + if (is_null($instance)) { + throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!")); + } + + $itemStartDT = new DateTime($instance["starts"], new DateTimeZone("UTC")); + $itemEndDT = null; + + $schedule_sql = "SELECT * FROM cc_schedule ". + "WHERE instance_id = {$instanceId} ". + "ORDER BY starts"; + $schedule = Application_Common_Database::prepareAndExecute($schedule_sql); + + foreach ($schedule as $item) { + $itemEndDT = $this->findEndTime($itemStartDT, $item["clip_length"]); + + $update_sql = "UPDATE cc_schedule SET ". + "starts = '{$itemStartDT->format("Y-m-d H:i:s")}', ". + "ends = '{$itemEndDT->format("Y-m-d H:i:s")}' ". + "WHERE id = {$item["id"]}"; + Application_Common_Database::prepareAndExecute( + $update_sql, array(), Application_Common_Database::EXECUTE); + + $itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration); + } } /* @@ -526,7 +532,6 @@ class Application_Model_Scheduler $dropIndex_sql, array(), Application_Common_Database::EXECUTE); foreach ($scheduleItems as $schedule) { - Logging::info($schedule); $id = intval($schedule["id"]); /* Find out if the show where the cursor position (where an item will @@ -737,6 +742,7 @@ class Application_Model_Scheduler $update_sql, array(), Application_Common_Database::EXECUTE); } + //$nextStartDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration); $nextStartDT = $endTimeDT; $pos++; From 75e6f21ce06cd3a3c890d722ce9c69f1df82f877 Mon Sep 17 00:00:00 2001 From: Naomi Date: Thu, 23 May 2013 18:33:40 -0400 Subject: [PATCH 2/9] CC-5108 : Waveform Editor UI putting on the timescale for time reference. fade editor now has cursor playback info. --- .../application/layouts/scripts/layout.phtml | 3 ++ airtime_mvc/application/models/Block.php | 4 ++ airtime_mvc/application/models/Playlist.php | 4 ++ airtime_mvc/application/models/StoredFile.php | 2 - airtime_mvc/public/css/waveform.css | 39 +++++++++++++++++-- airtime_mvc/public/js/airtime/library/spl.js | 18 +++++++-- .../public/js/waveformplaylist/playlist.js | 32 ++++++++++++++- .../public/js/waveformplaylist/playout.js | 3 +- .../public/js/waveformplaylist/time_scale.js | 21 +++++++++- .../public/js/waveformplaylist/track.js | 29 +++++++++++++- 10 files changed, 141 insertions(+), 14 deletions(-) diff --git a/airtime_mvc/application/layouts/scripts/layout.phtml b/airtime_mvc/application/layouts/scripts/layout.phtml index f7c029ba5..fc46df5c4 100644 --- a/airtime_mvc/application/layouts/scripts/layout.phtml +++ b/airtime_mvc/application/layouts/scripts/layout.phtml @@ -36,6 +36,7 @@