Merge branch '2.2.x' into devel
Conflicts: airtime_mvc/public/js/airtime/library/library.js
This commit is contained in:
commit
70511746d0
20 changed files with 195 additions and 79 deletions
|
@ -360,8 +360,10 @@ SQL;
|
|||
{
|
||||
$sql = <<<SQL
|
||||
SELECT SUM(cliplength) AS LENGTH
|
||||
FROM cc_blockcontents
|
||||
FROM cc_blockcontents as bc
|
||||
JOIN cc_files as f ON bc.file_id = f.id
|
||||
WHERE block_id = :block_id
|
||||
AND f.file_exists = true
|
||||
SQL;
|
||||
$result = Application_Common_Database::prepareAndExecute($sql, array(':block_id'=>$this->id), 'all', PDO::FETCH_NUM);
|
||||
return $result[0][0];
|
||||
|
@ -467,9 +469,9 @@ SQL;
|
|||
Logging::info("Adding to block");
|
||||
Logging::info("at position {$pos}");
|
||||
}
|
||||
|
||||
|
||||
foreach ($p_items as $ac) {
|
||||
Logging::info("Adding audio file {$ac}");
|
||||
Logging::info("Adding audio file {$ac[0]}");
|
||||
try {
|
||||
if (is_array($ac) && $ac[1] == 'audioclip') {
|
||||
$res = $this->insertBlockElement($this->buildEntry($ac[0], $pos));
|
||||
|
|
|
@ -204,9 +204,9 @@ class Application_Model_Preference
|
|||
$fade = $out;
|
||||
}
|
||||
|
||||
$fade = number_format($fade, 2);
|
||||
$fade = number_format($fade, 1);
|
||||
//fades need 2 leading zeros for DateTime conversion
|
||||
$fade = rtrim(str_pad($fade, 5, "0", STR_PAD_LEFT), "0");
|
||||
$fade = str_pad($fade, 4, "0", STR_PAD_LEFT);
|
||||
|
||||
return $fade;
|
||||
}
|
||||
|
|
|
@ -674,6 +674,12 @@ SQL;
|
|||
$start = self::AirtimeTimeToPypoTime($item["start"]);
|
||||
$end = self::AirtimeTimeToPypoTime($item["end"]);
|
||||
|
||||
list(,,,$start_hour,,) = explode("-", $start);
|
||||
list(,,,$end_hour,,) = explode("-", $end);
|
||||
|
||||
$same_hour = $start_hour == $end_hour;
|
||||
$independent_event = !$same_hour;
|
||||
|
||||
$schedule_item = array(
|
||||
'id' => $media_id,
|
||||
'type' => 'file',
|
||||
|
@ -687,7 +693,7 @@ SQL;
|
|||
'end' => $end,
|
||||
'show_name' => $item["show_name"],
|
||||
'replay_gain' => is_null($item["replay_gain"]) ? "0": $item["replay_gain"],
|
||||
'independent_event' => false
|
||||
'independent_event' => $independent_event,
|
||||
);
|
||||
self::appendScheduleItem($data, $start, $schedule_item);
|
||||
}
|
||||
|
@ -827,26 +833,60 @@ SQL;
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if two events are less than or equal to 1 second apart
|
||||
*/
|
||||
public static function areEventsLinked($event1, $event2) {
|
||||
$dt1 = DateTime::createFromFormat("Y-m-d-H-i-s", $event1['start']);
|
||||
$dt2 = DateTime::createFromFormat("Y-m-d-H-i-s", $event2['start']);
|
||||
|
||||
$seconds = $dt2->getTimestamp() - $dt1->getTimestamp();
|
||||
return $seconds <= 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose of this function is to iterate through the entire
|
||||
* schedule array that was just built and fix the data up a bit. For
|
||||
* example, if we have two consecutive webstreams, we don't need the
|
||||
* first webstream to shutdown the output, when the second one will
|
||||
* just switch it back on. Preventing this behaviour stops hiccups
|
||||
* in output sound.
|
||||
* Streams are a 4 stage process.
|
||||
* 1) start buffering stream 5 seconds ahead of its start time
|
||||
* 2) at the start time tell liquidsoap to switch to this source
|
||||
* 3) at the end time, tell liquidsoap to stop reading this stream
|
||||
* 4) at the end time, tell liquidsoap to switch away from input.http source.
|
||||
*
|
||||
* When we have two streams back-to-back, some of these steps are unnecessary
|
||||
* for the second stream. Instead of sending commands 1,2,3,4,1,2,3,4 we should
|
||||
* send 1,2,1,2,3,4 - We don't need to tell liquidsoap to stop reading (#3), because #1
|
||||
* of the next stream implies this when we pass in a new url. We also don't need #4.
|
||||
*
|
||||
* There's a special case here is well. When the back-to-back streams are the same, we
|
||||
* can collapse the instructions 1,2,(3,4,1,2),3,4 to 1,2,3,4. We basically cut out the
|
||||
* middle part. This function handles this.
|
||||
*/
|
||||
private static function filterData(&$data)
|
||||
private static function foldData(&$data)
|
||||
{
|
||||
$previous_key = null;
|
||||
$previous_val = null;
|
||||
$previous_previous_key = null;
|
||||
$previous_previous_val = null;
|
||||
$previous_previous_previous_key = null;
|
||||
$previous_previous_previous_val = null;
|
||||
foreach ($data as $k => $v) {
|
||||
if ($v["type"] == "stream_buffer_start"
|
||||
&& !is_null($previous_val)
|
||||
&& $previous_val["type"] == "stream_output_end") {
|
||||
|
||||
if ($v["type"] == "stream_output_start"
|
||||
&& !is_null($previous_previous_val)
|
||||
&& $previous_previous_val["type"] == "stream_output_end"
|
||||
&& self::areEventsLinked($previous_previous_val, $v)) {
|
||||
|
||||
unset($data[$previous_previous_previous_key]);
|
||||
unset($data[$previous_previous_key]);
|
||||
unset($data[$previous_key]);
|
||||
if ($previous_previous_val['uri'] == $v['uri']) {
|
||||
unset($data[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
$previous_previous_previous_key = $previous_previous_key;
|
||||
$previous_previous_previous_val = $previous_previous_val;
|
||||
$previous_previous_key = $previous_key;
|
||||
$previous_previous_val = $previous_val;
|
||||
$previous_key = $k;
|
||||
$previous_val = $v;
|
||||
}
|
||||
|
@ -859,10 +899,12 @@ SQL;
|
|||
$data = array();
|
||||
$data["media"] = array();
|
||||
|
||||
//Harbor kick times *MUST* be ahead of schedule events, so that pypo
|
||||
//executes them first.
|
||||
self::createInputHarborKickTimes($data, $range_start, $range_end);
|
||||
self::createScheduledEvents($data, $range_start, $range_end);
|
||||
|
||||
self::filterData($data["media"]);
|
||||
self::foldData($data["media"]);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
|
|
@ -266,8 +266,12 @@ class Application_Model_ShowBuilder
|
|||
$row["instance"] = intval($p_item["si_id"]);
|
||||
$row["starts"] = $schedStartDT->format("H:i:s");
|
||||
$row["ends"] = $schedEndDT->format("H:i:s");
|
||||
|
||||
$formatter = new LengthFormatter($p_item['file_length']);
|
||||
|
||||
$cue_out = Application_Common_DateHelper::calculateLengthInSeconds($p_item['cue_out']);
|
||||
$cue_in = Application_Common_DateHelper::calculateLengthInSeconds($p_item['cue_in']);
|
||||
$run_time = $cue_out-$cue_in;
|
||||
|
||||
$formatter = new LengthFormatter(Application_Common_DateHelper::ConvertMSToHHMMSSmm($run_time*1000));
|
||||
$row['runtime'] = $formatter->format();
|
||||
|
||||
$row["title"] = $p_item["file_track_title"];
|
||||
|
|
|
@ -34,7 +34,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
|
||||
public function getCreatorId()
|
||||
{
|
||||
return $this->Webstream->getCcSubjs()->getDbId();
|
||||
return $this->webstream->getDbCreatorId();
|
||||
}
|
||||
|
||||
public function getLastModified($p_type)
|
||||
|
@ -51,7 +51,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
$di = new DateInterval("PT{$hours}H{$min}M{$sec}S");
|
||||
|
||||
return $di->format("%Hh %Im");
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue