cc-3476: dynamic timeout

This commit is contained in:
Martin Konecny 2012-03-23 12:49:50 -04:00
parent 2070de03ce
commit c301cd5256
3 changed files with 23 additions and 5 deletions

View File

@ -292,5 +292,17 @@ class Application_Model_DateHelper
return $p_dateString;
return self::ConvertToUtcDateTime($p_dateString)->format($p_format);
}
/*
* Example input: "00:02:32.746562". Output is a DateInterval object
* representing that 2 minute, 32.746562 second interval.
*
*/
public static function getDateIntervalFromString($p_interval){
list($hour_min_sec, $subsec) = explode(".", $p_interval);
list($hour, $min, $sec) = explode(":", $hour_min_sec);
return new DateInterval("PT{$hour}H{$min}M{$sec}S");
}
}

View File

@ -645,16 +645,19 @@ class Application_Model_Schedule {
$uri = $storedFile->getFilePath();
$showEndDateTime = new DateTime($item["show_end"], $utcTimeZone);
$trackStartDateTime = new DateTime($item["start"], $utcTimeZone);
$trackEndDateTime = new DateTime($item["end"], $utcTimeZone);
/* Note: cue_out and end are always the same. */
/* TODO: Not all tracks will have "show_end" */
if ($trackEndDateTime->getTimestamp() > $showEndDateTime->getTimestamp()){
$diff = $trackEndDateTime->getTimestamp() - $showEndDateTime->getTimestamp();
//assuming ends takes cue_out into assumption
$item["cue_out"] = $item["cue_out"] - $diff;
$di = $trackStartDateTime->diff($showEndDateTime);
$item["cue_out"] = $di->format("%H:%i:%s").".000";
}
$start = Application_Model_Schedule::AirtimeTimeToPypoTime($item["start"]);
$data["media"][$start] = array(

View File

@ -161,11 +161,14 @@ class PypoPush(Thread):
#Everything OK for this iteration.
pass
else:
#A different item has been scheduled at the same time!
#A different item has been scheduled at the same time! Need to remove
#all tracks from the Liquidsoap queue starting at this point, and re-add
#them.
problem_at_iteration = iteration
break
else:
#There are no more items scheduled for this time!
#There are no more items scheduled for this time! The user has shortened
#the playlist, so we simply need to remove tracks from the queue.
problem_at_iteration = iteration
break
iteration+=1