public function format() { $formatted = ""; $sign = $this->_seconds < 0 ? "-" : "+"; $perfect = true; $time = Application_Common_DateHelper::secondsToPlaylistTime(abs($this->_seconds)); $info = explode(":", $time); $formatted .= $sign; if (intval($info[0]) > 0) { $info[0] = ltrim($info[0], "0"); $formatted .= " {$info[0]}h"; $perfect = false; } if (intval($info[1]) > 0) { $info[1] = ltrim($info[1], "0"); $formatted .= " {$info[1]}m"; $perfect = false; } if (intval($info[2]) > 0) { $sec = round($info[2], 0); $formatted .= " {$sec}s"; $perfect = false; } //0 over/under lap of content. if ($perfect === true) { $formatted = "+ 0s"; } return $formatted; }
public function getCueLength() { $cuein = $this->getDbCuein(); $cueout = $this->getDbCueout(); $cueinSec = Application_Common_DateHelper::calculateLengthInSeconds($cuein); $cueoutSec = Application_Common_DateHelper::calculateLengthInSeconds($cueout); $lengthSec = bcsub($cueoutSec, $cueinSec, 6); $length = Application_Common_DateHelper::secondsToPlaylistTime($lengthSec); return $length; }
private static function buildWhereClauseForAdvancedSearch($dbname2searchTerm) { $where = array(); $where['clause'] = array(); $where['params'] = array(); foreach ($dbname2searchTerm as $dbname => $term) { $isRange = false; if (strstr($term, '~')) { $info = explode('~', $term); if ($dbname == 'utime' || $dbname == 'mtime' || $dbname == 'lptime') { $input1 = $info[0] != "" ? Application_Common_DateHelper::UserTimezoneStringToUTCString($info[0]) : null; $input2 = $info[1] != "" ? Application_Common_DateHelper::UserTimezoneStringToUTCString($info[1]) : null; } else { if ($dbname == 'bit_rate' || $dbname == 'sample_rate') { $input1 = isset($info[0]) ? doubleval($info[0]) * 1000 : null; $input2 = isset($info[1]) ? doubleval($info[1]) * 1000 : null; } else { $input1 = isset($info[0]) ? $info[0] : null; $input2 = isset($info[1]) ? $info[1] : null; } } $isRange = true; } else { $input1 = $term; } if ($isRange) { $sub = array(); if ($input1 != null) { $sub[] = $dbname . " >= :" . $dbname . "1"; } if ($input2 != null) { $sub[] = $dbname . " <= :" . $dbname . "2"; } if (!empty($sub)) { $where['clause'][$dbname] = "(" . implode(' AND ', $sub) . ")"; if ($input1 != null) { $where['params'][$dbname . "1"] = $input1; } if ($input2 != null) { $where['params'][$dbname . "2"] = $input2; } } } else { if (trim($input1) !== "") { $where['clause'][$dbname] = $dbname . " ILIKE :" . $dbname . "1"; $where['params'][$dbname . "1"] = "%" . $input1 . "%"; } } } return $where; }
/** * * Enter description here ... * @param DateTime $instanceStart * @param string $clipLength */ private static function findEndTime($instanceStart, $clipLength) { $startEpoch = $instanceStart->format("U.u"); $durationSeconds = Application_Common_DateHelper::playlistTimeToSeconds($clipLength); //add two float numbers to 6 subsecond precision //DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. $endEpoch = bcadd($startEpoch, (string) $durationSeconds, 6); $dt = DateTime::createFromFormat("U.u", $endEpoch, new DateTimeZone("UTC")); if ($dt === false) { //PHP 5.3.2 problem $dt = DateTime::createFromFormat("U", intval($endEpoch), new DateTimeZone("UTC")); } return $dt; }
public function editShowAction() { //1) Get add_show_start_date since it might not have been sent $js = $this->_getParam('data'); $data = array(); //need to convert from serialized jQuery array. foreach ($js as $j) { $data[$j["name"]] = $j["value"]; } $data['add_show_hosts'] = $this->_getParam('hosts'); $data['add_show_day_check'] = $this->_getParam('days'); if ($data['add_show_day_check'] == "") { $data['add_show_day_check'] = null; } $show = new Application_Model_Show($data['add_show_id']); $validateStartDate = true; $validateStartTime = true; if (!array_key_exists('add_show_start_date', $data)) { //Changing the start date was disabled, since the //array key does not exist. We need to repopulate this entry from the db. //The start date will be returned in UTC time, so lets convert it to local time. $dt = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime()); $data['add_show_start_date'] = $dt->format("Y-m-d"); if (!array_key_exists('add_show_start_time', $data)) { $data['add_show_start_time'] = $dt->format("H:i"); $validateStartTime = false; } $validateStartDate = false; } $data['add_show_record'] = $show->isRecorded(); $origianlShowStartDateTime = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime()); $success = Application_Model_Schedule::addUpdateShow($data, $this, $validateStartDate, $origianlShowStartDateTime, true, $data['add_show_instance_id']); if ($success) { $scheduler = new Application_Model_Scheduler(); $showInstances = CcShowInstancesQuery::create()->filterByDbShowId($data['add_show_id'])->find(); foreach ($showInstances as $si) { $scheduler->removeGaps($si->getDbId()); } $this->view->addNewShow = true; $this->view->newForm = $this->view->render('schedule/add-show-form.phtml'); } else { if (!$validateStartDate) { $this->view->when->getElement('add_show_start_date')->setOptions(array('disabled' => true)); } if (!$validateStartTime) { $this->view->when->getElement('add_show_start_time')->setOptions(array('disabled' => true)); } $this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true)); $this->view->addNewShow = false; $this->view->action = "edit-show"; $this->view->form = $this->view->render('schedule/add-show-form.phtml'); } }
private function makeScheduledItemRow($p_item) { $row = $this->defaultRowArray; if (isset($p_item["sched_starts"])) { $schedStartDT = new DateTime($p_item["sched_starts"], new DateTimeZone("UTC")); $schedStartDT->setTimezone(new DateTimeZone($this->timezone)); $schedEndDT = new DateTime($p_item["sched_ends"], new DateTimeZone("UTC")); $schedEndDT->setTimezone(new DateTimeZone($this->timezone)); $showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC")); $this->getItemStatus($p_item, $row); $startsEpoch = floatval($schedStartDT->format("U.u")); $endsEpoch = floatval($schedEndDT->format("U.u")); $showEndEpoch = floatval($showEndDT->format("U.u")); //don't want an overbooked item to stay marked as current. $this->getScheduledStatus($startsEpoch, min($endsEpoch, $showEndEpoch), $row); $row["id"] = intval($p_item["sched_id"]); $row["image"] = $p_item["file_exists"]; $row["instance"] = intval($p_item["si_id"]); $row["starts"] = $schedStartDT->format("H:i:s"); $row["ends"] = $schedEndDT->format("H:i:s"); $cue_out = Application_Common_DateHelper::playlistTimeToSeconds($p_item['cue_out']); $cue_in = Application_Common_DateHelper::playlistTimeToSeconds($p_item['cue_in']); $run_time = $cue_out - $cue_in; $formatter = new LengthFormatter(Application_Common_DateHelper::secondsToPlaylistTime($run_time)); $row['runtime'] = $formatter->format(); $row["title"] = htmlspecialchars($p_item["file_track_title"]); $row["creator"] = htmlspecialchars($p_item["file_artist_name"]); $row["album"] = htmlspecialchars($p_item["file_album_title"]); $row["cuein"] = $p_item["cue_in"]; $row["cueout"] = $p_item["cue_out"]; $row["fadein"] = round(substr($p_item["fade_in"], 6), 6); $row["fadeout"] = round(substr($p_item["fade_out"], 6), 6); $row["mime"] = $p_item["file_mime"]; $row["pos"] = $this->pos++; $this->contentDT = $schedEndDT; } else { if (intval($p_item["si_record"]) === 1) { $row["record"] = true; $row["instance"] = intval($p_item["si_id"]); $showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC")); $showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC")); $startsEpoch = floatval($showStartDT->format("U.u")); $endsEpoch = floatval($showEndDT->format("U.u")); $this->getScheduledStatus($startsEpoch, $endsEpoch, $row); } else { $row["empty"] = true; $row["id"] = 0; $row["instance"] = intval($p_item["si_id"]); } } if (intval($p_item["si_rebroadcast"]) === 1) { $row["rebroadcast"] = true; } if ($this->currentShow === true) { $row["currentShow"] = true; } $this->getItemColor($p_item, $row); $this->getRowTimestamp($p_item, $row); $this->isAllowed($p_item, $row); return $row; }
public function updateCueValuesBySilanAction() { $request = $this->getRequest(); $data = json_decode($request->getParam('data'), $assoc = true); foreach ($data as $pair) { list($id, $info) = $pair; // TODO : move this code into model -- RG $file = Application_Model_StoredFile::RecallById($p_id = $id)->getPropelOrm(); //What we are doing here is setting a more accurate length that was //calculated with silan by actually scanning the entire file. This //process takes a really long time, and so we only do it in the background //after the file has already been imported -MK try { $length = $file->getDbLength(); if (isset($info['length'])) { $length = $info['length']; //length decimal number in seconds. Need to convert it to format //HH:mm:ss to get around silly PHP limitations. $length = Application_Common_DateHelper::secondsToPlaylistTime($length); $file->setDbLength($length); } $cuein = isset($info['cuein']) ? $info['cuein'] : 0; $cueout = isset($info['cueout']) ? $info['cueout'] : $length; $file->setDbCuein($cuein); $file->setDbCueout($cueout); $file->setDbSilanCheck(true); $file->save(); } catch (Exception $e) { Logging::info("Failed to update silan values for " . $file->getDbTrackTitle()); Logging::info("File length analyzed by Silan is: " . $length); //set silan_check to true so we don't attempt to re-anaylze again $file->setDbSilanCheck(true); $file->save(); } } $this->_helper->json->sendJson(array()); }
/** * Calculates the percentage of a show scheduled given the start and end times in date/time format * and the time_filled as the total time the schow is scheduled for in time format. * * TODO when using propel properly this should be a method on the propel show instance model. **/ private static function getPercentScheduled($p_starts, $p_ends, $p_time_filled) { $utcTimezone = new DatetimeZone("UTC"); $startDt = new DateTime($p_starts, $utcTimezone); $endDt = new DateTime($p_ends, $utcTimezone); $durationSeconds = intval($endDt->format("U")) - intval($startDt->format("U")); $time_filled = Application_Common_DateHelper::playlistTimeToSeconds($p_time_filled); if ($durationSeconds != 0) { //Prevent division by zero if the show duration somehow becomes zero. $percent = ceil($time_filled / $durationSeconds * 100); } else { $percent = 0; } return $percent; }
public function recordedShowsAction() { $today_timestamp = date("Y-m-d H:i:s"); $now = new DateTime($today_timestamp); $end_timestamp = $now->add(new DateInterval("PT2H")); $end_timestamp = $end_timestamp->format("Y-m-d H:i:s"); $this->view->shows = Application_Model_Show::getShows(Application_Common_DateHelper::ConvertToUtcDateTime($today_timestamp, date_default_timezone_get()), Application_Common_DateHelper::ConvertToUtcDateTime($end_timestamp, date_default_timezone_get()), $onlyRecord = true); $this->view->is_recording = false; $this->view->server_timezone = Application_Model_Preference::GetTimezone(); $rows = Application_Model_Show::getCurrentShow($today_timestamp); Application_Model_Show::convertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp")); if (count($rows) > 0) { $this->view->is_recording = $rows[0]['record'] == 1; } }
/** * Convert the columns given in the array $columnsToConvert in the * database result $rows to local timezone. * * @param type $rows arrays of arrays containing database query result * @param type $columnsToConvert array of column names to convert */ public static function convertToLocalTimeZone(&$rows, $columnsToConvert) { if (!is_array($rows)) { return; } foreach ($rows as &$row) { foreach ($columnsToConvert as $column) { $row[$column] = Application_Common_DateHelper::ConvertToLocalDateTimeString($row[$column]); } } }
public function getCurrentPlaylistAction() { $range = Application_Model_Schedule::GetPlayOrderRange(); $show = Application_Model_Show::getCurrentShow(); /* Convert all UTC times to localtime before sending back to user. */ $range["schedulerTime"] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range["schedulerTime"]); if (isset($range["previous"])) { $range["previous"]["starts"] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range["previous"]["starts"]); $range["previous"]["ends"] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range["previous"]["ends"]); } if (isset($range["current"])) { $range["current"]["starts"] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range["current"]["starts"]); $range["current"]["ends"] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range["current"]["ends"]); } if (isset($range["next"])) { $range["next"]["starts"] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range["next"]["starts"]); $range["next"]["ends"] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range["next"]["ends"]); } Application_Common_DateHelper::convertTimestamps($range["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"), "user"); Application_Common_DateHelper::convertTimestamps($range["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"), "user"); //TODO: Add timezone and timezoneOffset back into the ApiController's results. $range["timezone"] = Application_Common_DateHelper::getUserTimezoneAbbreviation(); $range["timezoneOffset"] = Application_Common_DateHelper::getUserTimezoneOffset(); $source_status = array(); $switch_status = array(); $live_dj = Application_Model_Preference::GetSourceStatus("live_dj"); $master_dj = Application_Model_Preference::GetSourceStatus("master_dj"); $scheduled_play_switch = Application_Model_Preference::GetSourceSwitchStatus("scheduled_play"); $live_dj_switch = Application_Model_Preference::GetSourceSwitchStatus("live_dj"); $master_dj_switch = Application_Model_Preference::GetSourceSwitchStatus("master_dj"); //might not be the correct place to implement this but for now let's just do it here $source_status['live_dj_source'] = $live_dj; $source_status['master_dj_source'] = $master_dj; $this->view->source_status = $source_status; $switch_status['live_dj_source'] = $live_dj_switch; $switch_status['master_dj_source'] = $master_dj_switch; $switch_status['scheduled_play'] = $scheduled_play_switch; $this->view->switch_status = $switch_status; $this->view->entries = $range; $this->view->show_name = isset($show[0]) ? $show[0]["name"] : ""; }
public function removeItems($scheduledItems, $adjustSched = true) { $showInstances = array(); $this->con->beginTransaction(); try { $this->validateRequest($scheduledItems); $scheduledIds = array(); foreach ($scheduledItems as $item) { $scheduledIds[] = $item["id"]; } $removedItems = CcScheduleQuery::create()->findPks($scheduledIds); //check to make sure all items selected are up to date foreach ($removedItems as $removedItem) { $instance = $removedItem->getCcShowInstances($this->con); //check to truncate the currently playing item instead of deleting it. if ($removedItem->isCurrentItem($this->epochNow)) { $nEpoch = $this->epochNow; $sEpoch = $removedItem->getDbStarts('U.u'); $length = bcsub($nEpoch, $sEpoch, 6); $cliplength = Application_Common_DateHelper::secondsToPlaylistTime($length); $cueinSec = Application_Common_DateHelper::playlistTimeToSeconds($removedItem->getDbCueIn()); $cueOutSec = bcadd($cueinSec, $length, 6); $cueout = Application_Common_DateHelper::secondsToPlaylistTime($cueOutSec); //Set DbEnds - 1 second because otherwise there can be a timing issue //when sending the new schedule to Pypo where Pypo thinks the track is still //playing. $removedItem->setDbCueOut($cueout)->setDbClipLength($cliplength)->setDbEnds($this->nowDT)->save($this->con); } else { $removedItem->delete($this->con); } } if ($adjustSched === true) { //get the show instances of the shows we must adjust times for. foreach ($removedItems as $item) { $instance = $item->getDBInstanceId(); if (!in_array($instance, $showInstances)) { $showInstances[] = $instance; } } foreach ($showInstances as $instance) { $this->removeGaps($instance); } } //update the status flag in cc_schedule. $instances = CcShowInstancesQuery::create()->filterByPrimaryKeys($showInstances)->find($this->con); foreach ($instances as $instance) { $instance->updateScheduleStatus($this->con); } //update the last scheduled timestamp. CcShowInstancesQuery::create()->filterByPrimaryKeys($showInstances)->update(array('DbLastScheduled' => new DateTime("now", new DateTimeZone("UTC"))), $this->con); $this->con->commit(); Application_Model_RabbitMq::PushSchedule(); } catch (Exception $e) { $this->con->rollback(); throw $e; } }
/** * Get the entire playlist as a two dimentional array, sorted in order of play. * @param boolean $filterFiles if this is true, it will only return files that has * file_exists flag set to true * @return array */ public function getContents($filterFiles = false) { Logging::info("Getting contents for playlist {$this->id}"); $sql = <<<SQL SELECT * FROM ( (SELECT pc.id AS id, pc.type, pc.position, pc.cliplength AS LENGTH, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, f.id AS item_id, f.track_title, f.artist_name AS creator, f.file_exists AS EXISTS, f.filepath AS path, f.length AS orig_length, f.mime AS mime FROM cc_playlistcontents AS pc JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = :playlist_id1 AND TYPE = 0) UNION ALL (SELECT pc.id AS id, pc.TYPE, pc.position, pc.cliplength AS LENGTH, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, ws.id AS item_id, (ws.name || ': ' || ws.url) AS title, sub.login AS creator, 't'::boolean AS EXISTS, ws.url AS path, ws.length AS orig_length, ws.mime as mime FROM cc_playlistcontents AS pc JOIN cc_webstream AS ws ON pc.stream_id=ws.id LEFT JOIN cc_subjs AS sub ON sub.id = ws.creator_id WHERE pc.playlist_id = :playlist_id2 AND pc.TYPE = 1) UNION ALL (SELECT pc.id AS id, pc.TYPE, pc.position, pc.cliplength AS LENGTH, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, bl.id AS item_id, bl.name AS title, sbj.login AS creator, 't'::boolean AS EXISTS, NULL::text AS path, bl.length AS orig_length, NULL::text as mime FROM cc_playlistcontents AS pc JOIN cc_block AS bl ON pc.block_id=bl.id JOIN cc_subjs AS sbj ON bl.creator_id=sbj.id WHERE pc.playlist_id = :playlist_id3 AND pc.TYPE = 2)) AS temp ORDER BY temp.position; SQL; $rows = Application_Common_Database::prepareAndExecute($sql, array(':playlist_id1' => $this->id, ':playlist_id2' => $this->id, ':playlist_id3' => $this->id)); $offset = 0; foreach ($rows as &$row) { $clipSec = Application_Common_DateHelper::playlistTimeToSeconds($row['length']); $offset += $clipSec; $offset_cliplength = Application_Common_DateHelper::secondsToPlaylistTime($offset); //format the length for UI. if ($row['type'] == 2) { $bl = new Application_Model_Block($row['item_id']); $formatter = new LengthFormatter($bl->getLength()); } else { $formatter = new LengthFormatter($row['length']); } $row['length'] = $formatter->format(); $formatter = new LengthFormatter($offset_cliplength); $row['offset'] = $formatter->format(); //format the fades in format 00(.000000) $fades = $this->getFadeInfo($row['position']); $row['fadein'] = $fades[0]; $row['fadeout'] = $fades[1]; // format the cues in format 00:00:00(.0) // we need to add the '.0' for cues and not fades // because propel takes care of this for us // (we use propel to fetch the fades) $row['cuein'] = str_pad(substr($row['cuein'], 0, 10), 10, '.0'); $row['cueout'] = str_pad(substr($row['cueout'], 0, 10), 10, '.0'); //format original length $formatter = new LengthFormatter($row['orig_length']); $row['orig_length'] = $formatter->format(); } return $rows; }
private function buildEntry($p_item, $pos) { $objType = $p_item[1]; $objId = $p_item[0]; if ($objType == 'audioclip') { $obj = CcFilesQuery::create()->findPK($objId, $this->con); } elseif ($objType == "stream") { $obj = CcWebstreamQuery::create()->findPK($objId, $this->con); } elseif ($objType == "block") { $obj = CcBlockQuery::create()->findPK($objId, $this->con); } else { throw new Exception("Unknown file type"); } if (isset($obj)) { if ($obj instanceof CcFiles && $obj->visible() || $obj instanceof CcWebstream || $obj instanceof CcBlock) { $entry = $this->plItem; $entry["id"] = $obj->getDbId(); $entry["pos"] = $pos; $entry["cliplength"] = $obj->getDbLength(); if ($obj instanceof CcFiles && $obj) { $entry["cuein"] = isset($p_item['cuein']) ? $p_item['cuein'] : $obj->getDbCuein(); $entry["cueout"] = isset($p_item['cueout']) ? $p_item['cueout'] : $obj->getDbCueout(); $cue_in = isset($p_item['cueInSec']) ? $p_item['cueInSec'] : Application_Common_DateHelper::calculateLengthInSeconds($entry['cuein']); $cue_out = isset($p_item['cueOutSec']) ? $p_item['cueOutSec'] : Application_Common_DateHelper::calculateLengthInSeconds($entry['cueout']); $entry["cliplength"] = isset($p_item['length']) ? $p_item['length'] : Application_Common_DateHelper::secondsToPlaylistTime($cue_out - $cue_in); } elseif ($obj instanceof CcWebstream && $obj) { $entry["cuein"] = "00:00:00"; $entry["cueout"] = $entry["cliplength"]; } $entry["ftype"] = $objType; $entry["fadein"] = isset($p_item['fadein']) ? $p_item['fadein'] : $entry["fadein"]; $entry["fadeout"] = isset($p_item['fadeout']) ? $p_item['fadeout'] : $entry["fadeout"]; } return $entry; } else { throw new Exception("trying to add a object that does not exist."); } }
public function removeItems($scheduledItems, $adjustSched = true, $cancelShow = false) { $showInstances = array(); $this->con->beginTransaction(); try { $this->validateRequest($scheduledItems); $scheduledIds = array(); foreach ($scheduledItems as $item) { $scheduledIds[] = $item["id"]; } $removedItems = CcScheduleQuery::create()->findPks($scheduledIds); //check to make sure all items selected are up to date foreach ($removedItems as $removedItem) { $instance = $removedItem->getCcShowInstances($this->con); //check if instance is linked and if so get the schedule items //for all linked instances so we can delete them too if (!$cancelShow && $instance->getCcShow()->isLinked()) { //returns all linked instances if linked $ccShowInstances = $this->getInstances($instance->getDbId()); $instanceIds = array(); foreach ($ccShowInstances as $ccShowInstance) { $instanceIds[] = $ccShowInstance->getDbId(); } /* * Find all the schedule items that are in the same position * as the selected item by the user. * The position of each track is the same across each linked instance */ $itemsToDelete = CcScheduleQuery::create()->filterByDbPosition($removedItem->getDbPosition())->filterByDbInstanceId($instanceIds, Criteria::IN)->find(); foreach ($itemsToDelete as $item) { if (!$removedItems->contains($item)) { $removedItems->append($item); } } } //check to truncate the currently playing item instead of deleting it. if ($removedItem->isCurrentItem($this->epochNow)) { $nEpoch = $this->epochNow; $sEpoch = $removedItem->getDbStarts('U.u'); $length = bcsub($nEpoch, $sEpoch, 6); $cliplength = Application_Common_DateHelper::secondsToPlaylistTime($length); $cueinSec = Application_Common_DateHelper::playlistTimeToSeconds($removedItem->getDbCueIn()); $cueOutSec = bcadd($cueinSec, $length, 6); $cueout = Application_Common_DateHelper::secondsToPlaylistTime($cueOutSec); //Set DbEnds - 1 second because otherwise there can be a timing issue //when sending the new schedule to Pypo where Pypo thinks the track is still //playing. $removedItem->setDbCueOut($cueout)->setDbClipLength($cliplength)->setDbEnds($this->nowDT)->save($this->con); } else { $removedItem->delete($this->con); } // update is_scheduled in cc_files but only if // the file is not scheduled somewhere else $fileId = $removedItem->getDbFileId(); // check if the removed item is scheduled somewhere else $futureScheduledFiles = Application_Model_Schedule::getAllFutureScheduledFiles(); if (!is_null($fileId) && !in_array($fileId, $futureScheduledFiles)) { $db_file = CcFilesQuery::create()->findPk($fileId, $this->con); $db_file->setDbIsScheduled(false)->save($this->con); } } if ($adjustSched === true) { //get the show instances of the shows we must adjust times for. foreach ($removedItems as $item) { $instance = $item->getDBInstanceId(); if (!in_array($instance, $showInstances)) { $showInstances[] = $instance; } } foreach ($showInstances as $instance) { $this->removeGaps($instance); $this->calculateCrossfades($instance); } } //update the status flag in cc_schedule. $instances = CcShowInstancesQuery::create()->filterByPrimaryKeys($showInstances)->find($this->con); foreach ($instances as $instance) { $instance->updateScheduleStatus($this->con); $instance->correctSchedulePositions(); } //update the last scheduled timestamp. CcShowInstancesQuery::create()->filterByPrimaryKeys($showInstances)->update(array('DbLastScheduled' => new DateTime("now", new DateTimeZone("UTC"))), $this->con); $this->con->commit(); Application_Model_RabbitMq::PushSchedule(); } catch (Exception $e) { $this->con->rollback(); throw $e; } }
public function getListofFilesMeetCriteria() { $storedCrit = $this->getCriteria(); $qry = CcFilesQuery::create(); $qry->useFkOwnerQuery("subj", "left join"); if (isset($storedCrit["crit"])) { foreach ($storedCrit["crit"] as $crit) { $i = 0; foreach ($crit as $criteria) { //$spCriteriaPhpName = self::$criteria2PeerMap[$criteria['criteria']]; $spCriteria = $criteria['criteria']; $spCriteriaModifier = $criteria['modifier']; $column = CcFilesPeer::getTableMap()->getColumnByPhpName(self::$criteria2PeerMap[$spCriteria]); // if the column is timestamp, convert it into UTC if ($column->getType() == PropelColumnTypes::TIMESTAMP) { $spCriteriaValue = Application_Common_DateHelper::ConvertToUtcDateTimeString($criteria['value']); /* Check if only a date was supplied and trim * the time after it is converted to UTC time */ if (strlen($criteria['value']) <= 10) { //extract date only from timestamp in db $spCriteria = 'date(' . $spCriteria . ')'; $spCriteriaValue = substr($spCriteriaValue, 0, 10); } if (isset($criteria['extra'])) { $spCriteriaExtra = Application_Common_DateHelper::ConvertToUtcDateTimeString($criteria['extra']); if (strlen($criteria['extra']) <= 10) { $spCriteriaExtra = substr($spCriteriaExtra, 0, 10); } } } elseif ($spCriteria == "bit_rate" || $spCriteria == 'sample_rate') { // multiply 1000 because we store only number value // e.g 192kps is stored as 192000 $spCriteriaValue = $criteria['value'] * 1000; if (isset($criteria['extra'])) { $spCriteriaExtra = $criteria['extra'] * 1000; } /* * If user is searching for an exact match of length we need to * search as if it starts with the specified length because the * user only sees the rounded version (i.e. 4:02.7 is 4:02.761625 * in the database) */ } elseif ($spCriteria == 'length' && $spCriteriaModifier == "is") { $spCriteriaModifier = "starts with"; $spCriteria = $spCriteria . '::text'; $spCriteriaValue = $criteria['value']; } else { /* Propel does not escape special characters properly when using LIKE/ILIKE * We have to add extra slashes in these cases */ $tempModifier = trim(self::$modifier2CriteriaMap[$spCriteriaModifier]); if ($tempModifier == 'ILIKE') { $spCriteriaValue = addslashes($criteria['value']); // addslashes() does not esapce '%' so we have to do it manually $spCriteriaValue = str_replace('%', '\\%', $spCriteriaValue); } else { $spCriteriaValue = $criteria['value']; } $spCriteriaExtra = $criteria['extra']; } if ($spCriteriaModifier == "starts with") { $spCriteriaValue = "{$spCriteriaValue}%"; } elseif ($spCriteriaModifier == "ends with") { $spCriteriaValue = "%{$spCriteriaValue}"; } elseif ($spCriteriaModifier == "contains" || $spCriteriaModifier == "does not contain") { $spCriteriaValue = "%{$spCriteriaValue}%"; } elseif ($spCriteriaModifier == "is in the range") { $spCriteriaValue = "{$spCriteria} >= '{$spCriteriaValue}' AND {$spCriteria} <= '{$spCriteriaExtra}'"; } $spCriteriaModifier = self::$modifier2CriteriaMap[$spCriteriaModifier]; try { if ($spCriteria == "owner_id") { $spCriteria = "subj.login"; } if ($i > 0) { $qry->addOr($spCriteria, $spCriteriaValue, $spCriteriaModifier); } else { $qry->add($spCriteria, $spCriteriaValue, $spCriteriaModifier); } if ($spCriteriaModifier == Criteria::NOT_ILIKE || $spCriteriaModifier == Criteria::NOT_EQUAL) { $qry->addOr($spCriteria, null, Criteria::ISNULL); } } catch (Exception $e) { Logging::info($e); } $i++; } } // check if file exists $qry->add("file_exists", "true", Criteria::EQUAL); $qry->addAscendingOrderByColumn('random()'); } // construct limit restriction $limits = array(); if (isset($storedCrit['limit'])) { if ($storedCrit['limit']['modifier'] == "items") { $limits['time'] = 1440 * 60; $limits['items'] = $storedCrit['limit']['value']; } else { $limits['time'] = $storedCrit['limit']['modifier'] == "hours" ? intval(floatval($storedCrit['limit']['value']) * 60 * 60) : intval($storedCrit['limit']['value'] * 60); $limits['items'] = null; } } try { $out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find(); return array("files" => $out, "limit" => $limits, "count" => $out->count()); } catch (Exception $e) { Logging::info($e); } }
public function isValid($params) { $isValid = true; $data = $this->preValidation($params); $criteria2PeerMap = array(0 => "Select criteria", "album_title" => "DbAlbumTitle", "artist_name" => "DbArtistName", "bit_rate" => "DbBitRate", "bpm" => "DbBpm", "composer" => "DbComposer", "conductor" => "DbConductor", "copyright" => "DbCopyright", "cuein" => "DbCuein", "cueout" => "DbCueout", "encoded_by" => "DbEncodedBy", "utime" => "DbUtime", "mtime" => "DbMtime", "lptime" => "DbLPtime", "genre" => "DbGenre", "info_url" => "DbInfoUrl", "isrc_number" => "DbIsrcNumber", "label" => "DbLabel", "language" => "DbLanguage", "length" => "DbLength", "mime" => "DbMime", "mood" => "DbMood", "owner_id" => "DbOwnerId", "replay_gain" => "DbReplayGain", "sample_rate" => "DbSampleRate", "track_title" => "DbTrackTitle", "track_number" => "DbTrackNumber", "year" => "DbYear"); // things we need to check // 1. limit value shouldn't be empty and has upperbound of 24 hrs // 2. sp_criteria or sp_criteria_modifier shouldn't be 0 // 3. validate formate according to DB column type $multiplier = 1; $result = 0; // validation start if ($data['etc']['sp_limit_options'] == 'hours') { $multiplier = 60; } if ($data['etc']['sp_limit_options'] == 'hours' || $data['etc']['sp_limit_options'] == 'mins') { $element = $this->getElement("sp_limit_value"); if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) { $element->addError(_("Limit cannot be empty or smaller than 0")); $isValid = false; } else { $mins = floatval($data['etc']['sp_limit_value']) * $multiplier; if ($mins > 1440) { $element->addError(_("Limit cannot be more than 24 hrs")); $isValid = false; } } } else { $element = $this->getElement("sp_limit_value"); if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) { $element->addError(_("Limit cannot be empty or smaller than 0")); $isValid = false; } elseif (!ctype_digit($data['etc']['sp_limit_value'])) { $element->addError(_("The value should be an integer")); $isValid = false; } elseif (intval($data['etc']['sp_limit_value']) > 500) { $element->addError(_("500 is the max item limit value you can set")); $isValid = false; } } if (isset($data['criteria'])) { foreach ($data['criteria'] as $rowKey => $row) { foreach ($row as $key => $d) { $element = $this->getElement("sp_criteria_field_" . $rowKey . "_" . $key); // check for not selected select box if ($d['sp_criteria_field'] == "0" || $d['sp_criteria_modifier'] == "0") { $element->addError(_("You must select Criteria and Modifier")); $isValid = false; } else { $column = CcFilesPeer::getTableMap()->getColumnByPhpName($criteria2PeerMap[$d['sp_criteria_field']]); // validation on type of column if (in_array($d['sp_criteria_field'], array('length', 'cuein', 'cueout'))) { if (!preg_match("/^(\\d{2}):(\\d{2}):(\\d{2})/", $d['sp_criteria_value'])) { $element->addError(_("'Length' should be in '00:00:00' format")); $isValid = false; } } elseif ($column->getType() == PropelColumnTypes::TIMESTAMP) { if (!preg_match("/(\\d{4})-(\\d{2})-(\\d{2})/", $d['sp_criteria_value'])) { $element->addError(_("The value should be in timestamp format (e.g. 0000-00-00 or 0000-00-00 00:00:00)")); $isValid = false; } else { $result = Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_value']); if (!$result["success"]) { // check for if it is in valid range( 1753-01-01 ~ 12/31/9999 ) $element->addError($result["errMsg"]); $isValid = false; } } if (isset($d['sp_criteria_extra'])) { if (!preg_match("/(\\d{4})-(\\d{2})-(\\d{2})/", $d['sp_criteria_extra'])) { $element->addError(_("The value should be in timestamp format (e.g. 0000-00-00 or 0000-00-00 00:00:00)")); $isValid = false; } else { $result = Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_extra']); if (!$result["success"]) { // check for if it is in valid range( 1753-01-01 ~ 12/31/9999 ) $element->addError($result["errMsg"]); $isValid = false; } } } } elseif ($column->getType() == PropelColumnTypes::INTEGER && $d['sp_criteria_field'] != 'owner_id') { if (!is_numeric($d['sp_criteria_value'])) { $element->addError(_("The value has to be numeric")); $isValid = false; } // length check if ($d['sp_criteria_value'] >= pow(2, 31)) { $element->addError(_("The value should be less then 2147483648")); $isValid = false; } } elseif ($column->getType() == PropelColumnTypes::VARCHAR) { if (strlen($d['sp_criteria_value']) > $column->getSize()) { $element->addError(sprintf(_("The value should be less than %s characters"), $column->getSize())); $isValid = false; } } } if ($d['sp_criteria_value'] == "") { $element->addError(_("Value cannot be empty")); $isValid = false; } } //end foreach } //for loop } //if return $isValid; }
public function getListOfFilesUnderLimit() { $info = $this->getListofFilesMeetCriteria(); $files = $info['files']; $limit = $info['limit']; $repeat = $info['repeat_tracks']; $insertList = array(); $totalTime = 0; $totalItems = 0; // this moves the pointer to the first element in the collection $files->getFirst(); $iterator = $files->getIterator(); $isBlockFull = false; while ($iterator->valid()) { $id = $iterator->current()->getDbId(); $fileLength = $iterator->current()->getCueLength(); $length = Application_Common_DateHelper::calculateLengthInSeconds($fileLength); $insertList[] = array('id' => $id, 'length' => $length); $totalTime += $length; $totalItems++; if (!is_null($limit['items']) && $limit['items'] == count($insertList) || $totalItems > 500 || $totalTime > $limit['time']) { $isBlockFull = true; break; } $iterator->next(); } $sizeOfInsert = count($insertList); // if block is not full and repeat_track is check, fill up more while (!$isBlockFull && $repeat == 1 && $sizeOfInsert > 0) { Logging::debug("adding repeated tracks."); Logging::debug("total time = " . $totalTime); $randomEleKey = array_rand(array_slice($insertList, 0, $sizeOfInsert)); $insertList[] = $insertList[$randomEleKey]; $totalTime += $insertList[$randomEleKey]['length']; $totalItems++; if (!is_null($limit['items']) && $limit['items'] == count($insertList) || $totalItems > 500 || $totalTime > $limit['time']) { break; } } return $insertList; }
public static function searchLibraryFiles($datatables) { $baseUrl = Application_Common_OsPath::getBaseDir(); $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME); $displayColumns = self::getLibraryColumns(); $plSelect = array(); $blSelect = array(); $fileSelect = array(); $streamSelect = array(); foreach ($displayColumns as $key) { if ($key === "id") { $plSelect[] = "PL.id AS " . $key; $blSelect[] = "BL.id AS " . $key; $fileSelect[] = "FILES.id AS {$key}"; $streamSelect[] = "ws.id AS " . $key; } elseif ($key === "track_title") { $plSelect[] = "name AS " . $key; $blSelect[] = "name AS " . $key; $fileSelect[] = $key; $streamSelect[] = "name AS " . $key; } elseif ($key === "ftype") { $plSelect[] = "'playlist'::varchar AS " . $key; $blSelect[] = "'block'::varchar AS " . $key; $fileSelect[] = $key; $streamSelect[] = "'stream'::varchar AS " . $key; } elseif ($key === "artist_name") { $plSelect[] = "login AS " . $key; $blSelect[] = "login AS " . $key; $fileSelect[] = $key; $streamSelect[] = "login AS " . $key; } elseif ($key === "owner_id") { $plSelect[] = "login AS " . $key; $blSelect[] = "login AS " . $key; $fileSelect[] = "sub.login AS {$key}"; $streamSelect[] = "login AS " . $key; } elseif ($key === "replay_gain") { $plSelect[] = "NULL::NUMERIC AS " . $key; $blSelect[] = "NULL::NUMERIC AS " . $key; $fileSelect[] = $key; $streamSelect[] = "NULL::NUMERIC AS " . $key; } elseif ($key === "lptime") { $plSelect[] = "NULL::TIMESTAMP AS " . $key; $blSelect[] = "NULL::TIMESTAMP AS " . $key; $fileSelect[] = $key; $streamSelect[] = $key; } elseif ($key === "is_scheduled" || $key === "is_playlist") { $plSelect[] = "NULL::boolean AS " . $key; $blSelect[] = "NULL::boolean AS " . $key; $fileSelect[] = $key; $streamSelect[] = "NULL::boolean AS " . $key; } elseif ($key === "cuein" || $key === "cueout") { $plSelect[] = "NULL::INTERVAL AS " . $key; $blSelect[] = "NULL::INTERVAL AS " . $key; $fileSelect[] = $key; $streamSelect[] = "NULL::INTERVAL AS " . $key; } else { if ($key === "length") { $plSelect[] = $key; $blSelect[] = $key; $fileSelect[] = "(cueout - cuein)::INTERVAL AS length"; $streamSelect[] = $key; } else { if (in_array($key, array("utime", "mtime"))) { $plSelect[] = $key; $blSelect[] = $key; $fileSelect[] = $key; $streamSelect[] = $key; } elseif ($key === "year") { $plSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS " . $key; $blSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS " . $key; $fileSelect[] = "year AS " . $key; $streamSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS " . $key; } else { if (in_array($key, array("track_number", "bit_rate", "sample_rate", "bpm"))) { $plSelect[] = "NULL::int AS " . $key; $blSelect[] = "NULL::int AS " . $key; $fileSelect[] = $key; $streamSelect[] = "NULL::int AS " . $key; } elseif ($key === "filepath") { $plSelect[] = "NULL::VARCHAR AS " . $key; $blSelect[] = "NULL::VARCHAR AS " . $key; $fileSelect[] = $key; $streamSelect[] = "url AS " . $key; } else { if ($key == "mime") { $plSelect[] = "NULL::VARCHAR AS " . $key; $blSelect[] = "NULL::VARCHAR AS " . $key; $fileSelect[] = $key; $streamSelect[] = $key; } else { $plSelect[] = "NULL::text AS " . $key; $blSelect[] = "NULL::text AS " . $key; $fileSelect[] = $key; $streamSelect[] = "NULL::text AS " . $key; } } } } } } $plSelect = "SELECT " . join(",", $plSelect); $blSelect = "SELECT " . join(",", $blSelect); $fileSelect = "SELECT " . join(",", $fileSelect); $streamSelect = "SELECT " . join(",", $streamSelect); $type = intval($datatables["type"]); $plTable = "({$plSelect} FROM cc_playlist AS PL LEFT JOIN cc_subjs AS sub ON (sub.id = PL.creator_id))"; $blTable = "({$blSelect} FROM cc_block AS BL LEFT JOIN cc_subjs AS sub ON (sub.id = BL.creator_id))"; $fileTable = "({$fileSelect} FROM cc_files AS FILES LEFT JOIN cc_subjs AS sub ON (sub.id = FILES.owner_id) WHERE file_exists = 'TRUE' AND hidden='FALSE')"; //$fileTable = "({$fileSelect} FROM cc_files AS FILES WHERE file_exists = 'TRUE')"; $streamTable = "({$streamSelect} FROM cc_webstream AS ws LEFT JOIN cc_subjs AS sub ON (sub.id = ws.creator_id))"; $unionTable = "({$plTable} UNION {$blTable} UNION {$fileTable} UNION {$streamTable}) AS RESULTS"; //choose which table we need to select data from. // TODO : use constants instead of numbers -- RG switch ($type) { case 0: $fromTable = $unionTable; break; case 1: $fromTable = $fileTable . " AS File"; //need an alias for the table if it's standalone. break; case 2: $fromTable = $plTable . " AS Playlist"; //need an alias for the table if it's standalone. break; case 3: $fromTable = $blTable . " AS Block"; //need an alias for the table if it's standalone. break; case 4: $fromTable = $streamTable . " AS StreamTable"; //need an alias for the table if it's standalone. break; default: $fromTable = $unionTable; } // update is_scheduled to false for tracks that // have already played out self::updatePastFilesIsScheduled(); $results = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables); $displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone()); $utcTimezone = new DateTimeZone("UTC"); foreach ($results['aaData'] as &$row) { $row['id'] = intval($row['id']); //taken from Datatables.php, needs to be cleaned up there. if (isset($r['ftype'])) { if ($r['ftype'] == 'playlist') { $pl = new Application_Model_Playlist($r['id']); $r['length'] = $pl->getLength(); } elseif ($r['ftype'] == "block") { $bl = new Application_Model_Block($r['id']); $r['bl_type'] = $bl->isStatic() ? 'static' : 'dynamic'; $r['length'] = $bl->getLength(); } } if ($row['ftype'] === "audioclip") { $cuein_formatter = new LengthFormatter($row["cuein"]); $row["cuein"] = $cuein_formatter->format(); $cueout_formatter = new LengthFormatter($row["cueout"]); $row["cueout"] = $cueout_formatter->format(); $cuein = Application_Common_DateHelper::playlistTimeToSeconds($row["cuein"]); $cueout = Application_Common_DateHelper::playlistTimeToSeconds($row["cueout"]); $row_length = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein); $formatter = new SamplerateFormatter($row['sample_rate']); $row['sample_rate'] = $formatter->format(); $formatter = new BitrateFormatter($row['bit_rate']); $row['bit_rate'] = $formatter->format(); //soundcloud status $file = Application_Model_StoredFile::RecallById($row['id']); $row['soundcloud_id'] = $file->getSoundCloudId(); // for audio preview $row['audioFile'] = $row['id'] . "." . pathinfo($row['filepath'], PATHINFO_EXTENSION); } else { $row['audioFile'] = $row['id']; $row_length = $row['length']; } $len_formatter = new LengthFormatter($row_length); $row['length'] = $len_formatter->format(); //convert mtime and utime to localtime $row['mtime'] = new DateTime($row['mtime'], $utcTimezone); $row['mtime']->setTimeZone($displayTimezone); $row['mtime'] = $row['mtime']->format('Y-m-d H:i:s'); $row['utime'] = new DateTime($row['utime'], $utcTimezone); $row['utime']->setTimeZone($displayTimezone); $row['utime'] = $row['utime']->format('Y-m-d H:i:s'); //need to convert last played to localtime if it exists. if (isset($row['lptime'])) { $row['lptime'] = new DateTime($row['lptime'], $utcTimezone); $row['lptime']->setTimeZone($displayTimezone); $row['lptime'] = $row['lptime']->format('Y-m-d H:i:s'); } // we need to initalize the checkbox and image row because we do not retrieve // any data from the db for these and datatables will complain $row['checkbox'] = ""; $row['image'] = ""; $type = substr($row['ftype'], 0, 2); $row['tr_id'] = "{$type}_{$row['id']}"; } return $results; }
private static function createFileScheduleEvent(&$data, $item, $media_id, $uri) { $start = self::AirtimeTimeToPypoTime($item["start"]); $end = self::AirtimeTimeToPypoTime($item["end"]); $schedule_item = array('id' => $media_id, 'type' => 'file', 'row_id' => $item["id"], 'uri' => $uri, 'fade_in' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_in"]), 'fade_out' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_out"]), 'cue_in' => Application_Common_DateHelper::CalculateLengthInSeconds($item["cue_in"]), 'cue_out' => Application_Common_DateHelper::CalculateLengthInSeconds($item["cue_out"]), 'start' => $start, 'end' => $end, 'show_name' => $item["show_name"], 'replay_gain' => is_null($item["replay_gain"]) ? "0" : $item["replay_gain"], 'independent_event' => true); self::appendScheduleItem($data, $start, $schedule_item); }
private function populateFormRebroadcastRelative($form) { $relativeRebroadcasts = $this->ccShow->getRebroadcastsRelative(); $formValues = array(); $i = 1; foreach ($relativeRebroadcasts as $rr) { $formValues["add_show_rebroadcast_date_{$i}"] = $rr->getDbDayOffset(); $formValues["add_show_rebroadcast_time_{$i}"] = Application_Common_DateHelper::removeSecondsFromTime($rr->getDbStartTime()); $i++; } $form->populate($formValues); }
private static function createFileScheduleEvent(&$data, $item, $media_id, $uri) { $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; $replay_gain = is_null($item["replay_gain"]) ? "0" : $item["replay_gain"]; $replay_gain += Application_Model_Preference::getReplayGainModifier(); if (!Application_Model_Preference::GetEnableReplayGain()) { $replay_gain = 0; } $schedule_item = array('id' => $media_id, 'type' => 'file', 'row_id' => $item["id"], 'uri' => $uri, 'fade_in' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_in"]), 'fade_out' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_out"]), 'cue_in' => Application_Common_DateHelper::CalculateLengthInSeconds($item["cue_in"]), 'cue_out' => Application_Common_DateHelper::CalculateLengthInSeconds($item["cue_out"]), 'start' => $start, 'end' => $end, 'show_name' => $item["show_name"], 'replay_gain' => $replay_gain, 'independent_event' => $independent_event); if ($schedule_item['cue_in'] > $schedule_item['cue_out']) { $schedule_item['cue_in'] = $schedule_item['cue_out']; } self::appendScheduleItem($data, $start, $schedule_item); }
public function getTimeScheduledSecs() { $time_filled = $this->getTimeScheduled(); return Application_Common_DateHelper::playlistTimeToSeconds($time_filled); }
public static function GetDayEndTimestampInUtc($time = "") { $dayEndTimestamp = Application_Common_DateHelper::GetDayEndTimestamp($time); return Application_Common_DateHelper::ConvertToUtcDateTimeString($dayEndTimestamp); }