Merge branch '2.4.x' of dev.sourcefabric.org:airtime into 2.4.x

This commit is contained in:
Martin Konecny 2013-05-24 17:01:15 -04:00
commit f23fc472ef
16 changed files with 294 additions and 163 deletions

View file

@ -36,6 +36,7 @@
<script id="tmpl-pl-cues" type="text/template">
<div class="waveform-cues">
<div class="playlist-time-scale"></div>
<div class="playlist-tracks"></div>
<div class="playlist-controls">
<a class="btn btn-small btn_play"><i class="icon-play icon-white"></i><?php echo _("Play"); ?></a>
@ -61,10 +62,12 @@
<script id="tmpl-pl-fades" type="text/template">
<div class="waveform-fades">
<div class="playlist-time-scale"></div>
<div class="playlist-tracks"></div>
<div class="playlist-controls left-floated">
<a class="btn btn-small btn_play"><i class="icon-play icon-white"></i><?php echo _("Play"); ?></a>
<a class="btn btn-small btn_stop"><i class="icon-stop icon-white"></i><?php echo _("Stop"); ?></a>
<label class="audio audio_pos">00:00:00.0</label>
</div>
<div class="set-fade left-floated">
<a type="button" class="btn btn-small btn_cursor" data-state="cursor"><?php echo _("Cursor"); ?></a>

View file

@ -686,6 +686,10 @@ SQL;
public function createCrossfade($id1, $fadeOut, $id2, $fadeIn, $offset)
{
$this->con->beginTransaction();
if (!isset($offset)) {
$offset = Application_Model_Preference::GetDefaultCrossfadeDuration();
}
try {
if (isset($id1)) {

View file

@ -673,6 +673,10 @@ SQL;
{
$this->con->beginTransaction();
if (!isset($offset)) {
$offset = Application_Model_Preference::GetDefaultCrossfadeDuration();
}
try {
if (isset($id1)) {
$this->changeFadeInfo($id1, null, $fadeOut);

View file

@ -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++;

View file

@ -528,8 +528,6 @@ SQL;
*/
public function getRelativeFileUrl($baseUrl)
{
Logging::debug("Zend base url: $baseUrl");
return $baseUrl."api/get-media/file/".$this->getId().".".$this->getFileExtension();
}

View file

@ -197,12 +197,12 @@ class Application_Service_SchedulerService
if (count($ccSchedules) < 1 ||
self::replaceInstanceContentCheck($ccSchedules, $showStamp)) {
//$nextStartDT = $ccShowInstance->getDbStarts(null);
$instanceStart_sql = "SELECT starts FROM cc_show_instances ".
"WHERE id = {$id}";
"WHERE id = {$id} ".
"ORDER BY starts";
$nextStartDT = new DateTime(
Application_Common_Database::prepareAndExecute(
$instanceStart_sql, array(), Application_Common_Database::EXECUTE),
$instanceStart_sql, array(), Application_Common_Database::COLUMN),
new DateTimeZone("UTC"));
foreach ($showStamp as $item) {