cc-2015: on reboot resume show
-use native capabilities of liquidsoap cue-in cue-out for song cue-in/cue-out
This commit is contained in:
parent
ec32047efa
commit
ec6db96025
3 changed files with 33 additions and 8 deletions
|
@ -127,5 +127,35 @@ class DateHelper
|
||||||
$explode = explode(" ", $p_timestamp);
|
$explode = explode(" ", $p_timestamp);
|
||||||
return $explode[1];
|
return $explode[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Given a track length in the format HH:MM:SS.mm, we want to
|
||||||
|
* convert this to seconds. This is useful for Liquidsoap which
|
||||||
|
* likes input parameters give in seconds.
|
||||||
|
* For example, 00:06:31.444, should be converted to 391.444 seconds
|
||||||
|
* @param int $p_time
|
||||||
|
* The time interval in format HH:MM:SS.mm we wish to
|
||||||
|
* convert to seconds.
|
||||||
|
* @return int
|
||||||
|
* The input parameter converted to seconds.
|
||||||
|
*/
|
||||||
|
public static function calculateLengthInSeconds($p_time){
|
||||||
|
|
||||||
|
if (2 !== substr_count($p_time, ":")){
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 === substr_count($p_time, ".")){
|
||||||
|
list($hhmmss, $ms) = explode(".", $p_time);
|
||||||
|
} else {
|
||||||
|
$hhmmss = $p_time;
|
||||||
|
$ms = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
list($hours, $minutes, $seconds) = explode(":", $hhmmss);
|
||||||
|
|
||||||
|
$totalSeconds = $hours*3600 + $minutes*60 + $seconds + $ms/1000;
|
||||||
|
|
||||||
|
return $totalSeconds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -697,11 +697,6 @@ class Schedule {
|
||||||
$storedFile = StoredFile::Recall($item["file_id"]);
|
$storedFile = StoredFile::Recall($item["file_id"]);
|
||||||
$uri = $storedFile->getFileUrl();
|
$uri = $storedFile->getFileUrl();
|
||||||
|
|
||||||
// For pypo, a cueout of zero means no cueout
|
|
||||||
$cueOut = "0";
|
|
||||||
if (Schedule::TimeDiff($item["cue_out"], $item["clip_length"]) > 0.001) {
|
|
||||||
$cueOut = Schedule::WallTimeToMillisecs($item["cue_out"]);
|
|
||||||
}
|
|
||||||
$starts = Schedule::AirtimeTimeToPypoTime($item["starts"]);
|
$starts = Schedule::AirtimeTimeToPypoTime($item["starts"]);
|
||||||
$medias[$starts] = array(
|
$medias[$starts] = array(
|
||||||
'row_id' => $item["id"],
|
'row_id' => $item["id"],
|
||||||
|
@ -710,8 +705,8 @@ class Schedule {
|
||||||
'fade_in' => Schedule::WallTimeToMillisecs($item["fade_in"]),
|
'fade_in' => Schedule::WallTimeToMillisecs($item["fade_in"]),
|
||||||
'fade_out' => Schedule::WallTimeToMillisecs($item["fade_out"]),
|
'fade_out' => Schedule::WallTimeToMillisecs($item["fade_out"]),
|
||||||
'fade_cross' => 0,
|
'fade_cross' => 0,
|
||||||
'cue_in' => Schedule::WallTimeToMillisecs($item["cue_in"]),
|
'cue_in' => DateHelper::CalculateLengthInSeconds($item["cue_in"]),
|
||||||
'cue_out' => $cueOut,
|
'cue_out' => DateHelper::CalculateLengthInSeconds($item["cue_out"]),
|
||||||
'export_source' => 'scheduler',
|
'export_source' => 'scheduler',
|
||||||
'start' => $starts,
|
'start' => $starts,
|
||||||
'end' => Schedule::AirtimeTimeToPypoTime($item["ends"])
|
'end' => Schedule::AirtimeTimeToPypoTime($item["ends"])
|
||||||
|
|
|
@ -260,7 +260,7 @@ class PypoFetch(Thread):
|
||||||
|
|
||||||
delta = dtnow - media_start #we get a TimeDelta object from this operation
|
delta = dtnow - media_start #we get a TimeDelta object from this operation
|
||||||
logger.info("Starting media item at %d second point", delta.seconds)
|
logger.info("Starting media item at %d second point", delta.seconds)
|
||||||
media['cue_in'] = delta.seconds + 10 #TODO is cue_in in seconds?
|
media['cue_in'] = delta.seconds + 10
|
||||||
td = timedelta(seconds=10)
|
td = timedelta(seconds=10)
|
||||||
playlist['start'] = (dtnow + td).strftime('%Y-%m-%d-%H-%M-%S')
|
playlist['start'] = (dtnow + td).strftime('%Y-%m-%d-%H-%M-%S')
|
||||||
logger.info("Crash detected, setting playlist to restart at %s", (dtnow + td).strftime('%Y-%m-%d-%H-%M-%S'))
|
logger.info("Crash detected, setting playlist to restart at %s", (dtnow + td).strftime('%Y-%m-%d-%H-%M-%S'))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue