CC-1665: Scheduled stream rebroadcasting and recording

-allow user more flexibility for entering length interval (require hours OR minutes)
This commit is contained in:
Martin Konecny 2012-08-28 12:30:33 -04:00
parent 7f66bdbb66
commit fc67d7f08d
3 changed files with 23 additions and 4 deletions

View File

@ -891,7 +891,6 @@ class ApiController extends Zend_Controller_Action
* out a message to pypo that a potential change has been made. */
public function rabbitmqDoPushAction()
{
$request = $this->getRequest();
Logging::info("Notifying RabbitMQ to send message to pypo");
Application_Model_RabbitMq::PushSchedule();

View File

@ -40,7 +40,7 @@ class Application_Model_User
->filterByDbHost($userId)->count() > 0;
}
public function isHost($showId)
public function isHost()
{
return $this->isUserType(UTYPE_HOST);
}

View File

@ -111,10 +111,30 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
$di = null;
$length = $parameters["length"];
$result = preg_match("/^([0-9]{1,2})h ([0-5]?[0-9])m$/", $length, $matches);
if ($result == 1 && count($matches) == 3) {
$result = preg_match("/^(?:([0-9]{1,2})h)?\s*(?:([0-6]?[0-9])m)?$/", $length, $matches);
$invalid_date_interval = false;
if ($result == 1 && count($matches) == 2) {
$hours = $matches[1];
$minutes = 0;
} else if ($result == 1 && count($matches) == 3) {
$hours = $matches[1];
$minutes = $matches[2];
} else {
$invalid_date_interval = true;
}
if (!$invalid_date_interval) {
if (!is_numeric($hours)) {
$hours = 0;
}
if (!is_numeric($minutes)) {
$minutes = 0;
}
$di = new DateInterval("PT{$hours}H{$minutes}M");
$totalMinutes = $di->h * 60 + $di->i;