Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
446233fbd4
75 changed files with 1982 additions and 2960 deletions
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once 'formatters/LengthFormatter.php';
|
||||
|
||||
/**
|
||||
*
|
||||
* @package Airtime
|
||||
|
@ -89,7 +91,7 @@ class Application_Model_Playlist {
|
|||
public function setName($p_newname)
|
||||
{
|
||||
$this->pl->setDbName($p_newname);
|
||||
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
}
|
||||
|
||||
|
@ -106,7 +108,7 @@ class Application_Model_Playlist {
|
|||
public function setDescription($p_description)
|
||||
{
|
||||
$this->pl->setDbDescription($p_description);
|
||||
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
}
|
||||
|
||||
|
@ -123,7 +125,7 @@ class Application_Model_Playlist {
|
|||
public function setCreator($p_id) {
|
||||
|
||||
$this->pl->setDbCreatorId($p_id);
|
||||
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
}
|
||||
|
||||
|
@ -158,9 +160,15 @@ class Application_Model_Playlist {
|
|||
|
||||
|
||||
$clipSec = Application_Model_Playlist::playlistTimeToSeconds($files[$i]['cliplength']);
|
||||
//$files[$i]['cliplength'] = Application_Model_Playlist::secondsToPlaylistTime($clipSec);
|
||||
$offset += $clipSec;
|
||||
$files[$i]['offset'] = Application_Model_Playlist::secondsToPlaylistTime($offset);
|
||||
$offset_cliplength = Application_Model_Playlist::secondsToPlaylistTime($offset);
|
||||
|
||||
//format the length for UI.
|
||||
$formatter = new LengthFormatter($files[$i]['cliplength']);
|
||||
$files[$i]['cliplength'] = $formatter->format();
|
||||
|
||||
$formatter = new LengthFormatter($offset_cliplength);
|
||||
$files[$i]['offset'] = $formatter->format();
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
@ -218,13 +226,18 @@ class Application_Model_Playlist {
|
|||
{
|
||||
$file = CcFilesQuery::create()->findPK($p_item, $this->con);
|
||||
|
||||
$entry = $this->plItem;
|
||||
$entry["id"] = $file->getDbId();
|
||||
$entry["pos"] = $pos;
|
||||
$entry["cliplength"] = $file->getDbLength();
|
||||
$entry["cueout"] = $file->getDbLength();
|
||||
if (isset($file) && $file->getDbFileExists()) {
|
||||
$entry = $this->plItem;
|
||||
$entry["id"] = $file->getDbId();
|
||||
$entry["pos"] = $pos;
|
||||
$entry["cliplength"] = $file->getDbLength();
|
||||
$entry["cueout"] = $file->getDbLength();
|
||||
|
||||
return $entry;
|
||||
return $entry;
|
||||
}
|
||||
else {
|
||||
throw new Exception("trying to add a file that does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -300,7 +313,7 @@ class Application_Model_Playlist {
|
|||
$pos = $pos + 1;
|
||||
}
|
||||
|
||||
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
|
||||
$this->con->commit();
|
||||
|
@ -383,7 +396,7 @@ class Application_Model_Playlist {
|
|||
|
||||
|
||||
$this->pl = CcPlaylistQuery::create()->findPK($this->id);
|
||||
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
}
|
||||
|
||||
|
@ -415,7 +428,7 @@ class Application_Model_Playlist {
|
|||
$contents[$i]->save($this->con);
|
||||
}
|
||||
|
||||
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
|
||||
$this->con->commit();
|
||||
|
@ -462,47 +475,52 @@ class Application_Model_Playlist {
|
|||
$fadeIn = $fadeIn?'00:00:'.$fadeIn:$fadeIn;
|
||||
$fadeOut = $fadeOut?'00:00:'.$fadeOut:$fadeOut;
|
||||
|
||||
$this->con->beginTransaction();
|
||||
|
||||
$errArray= array();
|
||||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||
|
||||
$row = CcPlaylistcontentsQuery::create()->findPK($id);
|
||||
|
||||
if (is_null($row)) {
|
||||
$errArray["error"]="Playlist item does not exist.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$clipLength = $row->getDbCliplength();
|
||||
|
||||
if(!is_null($fadeIn)) {
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$clipLength}'";
|
||||
$r = $con->query($sql);
|
||||
if($r->fetchColumn(0)) {
|
||||
//"Fade In can't be larger than overall playlength.";
|
||||
$fadeIn = $clipLength;
|
||||
}
|
||||
$row->setDbFadein($fadeIn);
|
||||
}
|
||||
if(!is_null($fadeOut)){
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$clipLength}'";
|
||||
$r = $con->query($sql);
|
||||
if($r->fetchColumn(0)) {
|
||||
//Fade Out can't be larger than overall playlength.";
|
||||
$fadeOut = $clipLength;
|
||||
}
|
||||
$row->setDbFadeout($fadeOut);
|
||||
}
|
||||
|
||||
try {
|
||||
$row->save();
|
||||
$row = CcPlaylistcontentsQuery::create()->findPK($id);
|
||||
|
||||
if (is_null($row)) {
|
||||
throw new Exception("Playlist item does not exist.");
|
||||
}
|
||||
|
||||
$clipLength = $row->getDbCliplength();
|
||||
|
||||
if (!is_null($fadeIn)) {
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$clipLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
//"Fade In can't be larger than overall playlength.";
|
||||
$fadeIn = $clipLength;
|
||||
}
|
||||
$row->setDbFadein($fadeIn);
|
||||
}
|
||||
if (!is_null($fadeOut)){
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$clipLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
//Fade Out can't be larger than overall playlength.";
|
||||
$fadeOut = $clipLength;
|
||||
}
|
||||
$row->setDbFadeout($fadeOut);
|
||||
}
|
||||
|
||||
$row->save($this->con);
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log($e->getMessage());
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return array("fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut);
|
||||
return array("fadeIn"=> $fadeIn, "fadeOut"=> $fadeOut);
|
||||
}
|
||||
|
||||
public function setPlaylistfades($fadein, $fadeout) {
|
||||
|
@ -512,7 +530,7 @@ class Application_Model_Playlist {
|
|||
$row = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition(0)
|
||||
->findOne();
|
||||
->findOne($this->con);
|
||||
|
||||
$this->changeFadeInfo($row->getDbId(), $fadein, null);
|
||||
}
|
||||
|
@ -521,7 +539,7 @@ class Application_Model_Playlist {
|
|||
$row = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($this->getSize()-1)
|
||||
->findOne();
|
||||
->findOne($this->con);
|
||||
|
||||
$this->changeFadeInfo($row->getDbId(), null, $fadeout);
|
||||
}
|
||||
|
@ -540,126 +558,135 @@ class Application_Model_Playlist {
|
|||
*/
|
||||
public function changeClipLength($id, $cueIn, $cueOut)
|
||||
{
|
||||
$this->con->beginTransaction();
|
||||
|
||||
$errArray= array();
|
||||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||
|
||||
if (is_null($cueIn) && is_null($cueOut)) {
|
||||
$errArray["error"]="Cue in and cue out are null.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
->joinWith(CcFilesPeer::OM_CLASS)
|
||||
->filterByPrimaryKey($id)
|
||||
->findOne();
|
||||
|
||||
if (is_null($row)) {
|
||||
$errArray["error"]="Playlist item does not exist!.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$oldCueIn = $row->getDBCuein();
|
||||
$oldCueOut = $row->getDbCueout();
|
||||
$fadeIn = $row->getDbFadein();
|
||||
$fadeOut = $row->getDbFadeout();
|
||||
|
||||
$file = $row->getCcFiles();
|
||||
$origLength = $file->getDbLength();
|
||||
|
||||
|
||||
if(!is_null($cueIn) && !is_null($cueOut)){
|
||||
|
||||
if($cueOut === ""){
|
||||
$cueOut = $origLength;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$cueOut}'";
|
||||
$r = $con->query($sql);
|
||||
if($r->fetchColumn(0)) {
|
||||
$errArray["error"]= "Can't set cue in to be larger than cue out.";
|
||||
try {
|
||||
if (is_null($cueIn) && is_null($cueOut)) {
|
||||
$errArray["error"] = "Cue in and cue out are null.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||
$r = $con->query($sql);
|
||||
if($r->fetchColumn(0)){
|
||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||
return $errArray;
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
->joinWith(CcFilesPeer::OM_CLASS)
|
||||
->filterByPrimaryKey($id)
|
||||
->findOne($this->con);
|
||||
|
||||
if (is_null($row)) {
|
||||
throw new Exception("Playlist item does not exist.");
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'";
|
||||
$r = $con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
$oldCueIn = $row->getDBCuein();
|
||||
$oldCueOut = $row->getDbCueout();
|
||||
$fadeIn = $row->getDbFadein();
|
||||
$fadeOut = $row->getDbFadeout();
|
||||
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDbCueout($cueOut);
|
||||
$row->setDBCliplength($cliplength);
|
||||
$file = $row->getCcFiles($this->con);
|
||||
$origLength = $file->getDbLength();
|
||||
|
||||
}
|
||||
else if(!is_null($cueIn)) {
|
||||
if (!is_null($cueIn) && !is_null($cueOut)){
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
|
||||
$r = $con->query($sql);
|
||||
if($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||
return $errArray;
|
||||
if ($cueOut === ""){
|
||||
$cueOut = $origLength;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$cueOut}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)){
|
||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDbCueout($cueOut);
|
||||
$row->setDBCliplength($cliplength);
|
||||
|
||||
}
|
||||
else if (!is_null($cueIn)) {
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDBCliplength($cliplength);
|
||||
}
|
||||
else if (!is_null($cueOut)) {
|
||||
|
||||
if ($cueOut === ""){
|
||||
$cueOut = $origLength;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue out to be smaller than cue in.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)){
|
||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$oldCueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
|
||||
$row->setDbCueout($cueOut);
|
||||
$row->setDBCliplength($cliplength);
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'";
|
||||
$r = $con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
$cliplength = $row->getDbCliplength();
|
||||
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDBCliplength($cliplength);
|
||||
}
|
||||
else if(!is_null($cueOut)) {
|
||||
|
||||
if($cueOut === ""){
|
||||
$cueOut = $origLength;
|
||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)){
|
||||
$fadeIn = $cliplength;
|
||||
$row->setDbFadein($fadeIn);
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'";
|
||||
$r = $con->query($sql);
|
||||
if($r->fetchColumn(0)) {
|
||||
$errArray["error"] ="Can't set cue out to be smaller than cue in.";
|
||||
return $errArray;
|
||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$cliplength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)){
|
||||
$fadeOut = $cliplength;
|
||||
$row->setDbFadein($fadeOut);
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||
$r = $con->query($sql);
|
||||
if($r->fetchColumn(0)){
|
||||
$errArray["error"] ="Can't set cue out to be greater than file length.";
|
||||
return $errArray;
|
||||
}
|
||||
$row->save($this->con);
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$oldCueIn}'";
|
||||
$r = $con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
|
||||
$row->setDbCueout($cueOut);
|
||||
$row->setDBCliplength($cliplength);
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$cliplength = $row->getDbCliplength();
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
|
||||
$r = $con->query($sql);
|
||||
if($r->fetchColumn(0)){
|
||||
$fadeIn = $cliplength;
|
||||
$row->setDbFadein($fadeIn);
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$cliplength}'";
|
||||
$r = $con->query($sql);
|
||||
if($r->fetchColumn(0)){
|
||||
$fadeOut = $cliplength;
|
||||
$row->setDbFadein($fadeOut);
|
||||
}
|
||||
|
||||
$row->save();
|
||||
|
||||
return array("cliplength"=>$cliplength, "cueIn"=>$cueIn, "cueOut"=>$cueOut, "length"=>$this->getLength(),
|
||||
"fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut);
|
||||
return array("cliplength"=> $cliplength, "cueIn"=> $cueIn, "cueOut"=> $cueOut, "length"=> $this->getLength(),
|
||||
"fadeIn"=> $fadeIn, "fadeOut"=> $fadeOut);
|
||||
}
|
||||
|
||||
public function getAllPLMetaData()
|
||||
|
|
|
@ -38,6 +38,7 @@ class Application_Model_Scheduler {
|
|||
$data = $this->fileInfo;
|
||||
$data["id"] = $id;
|
||||
$data["cliplength"] = $file->getDbLength();
|
||||
$data["cueout"] = $file->getDbLength();
|
||||
|
||||
$files[] = $data;
|
||||
}
|
||||
|
|
|
@ -1396,7 +1396,7 @@ class Application_Model_Show {
|
|||
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
|
||||
}
|
||||
|
||||
$sql = "SELECT starts, ends, record, rebroadcast, instance_id, show_id, name,
|
||||
$sql = "SELECT starts, ends, record, rebroadcast, instance_id, show_id, name,
|
||||
color, background_color, file_id, cc_show_instances.id AS instance_id
|
||||
FROM cc_show_instances
|
||||
LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id
|
||||
|
@ -1538,7 +1538,7 @@ class Application_Model_Show {
|
|||
$event["end"] = $endDateTime->format("Y-m-d H:i:s");
|
||||
$event["endUnix"] = $endDateTime->format("U");
|
||||
$event["allDay"] = false;
|
||||
$event["description"] = $show["description"];
|
||||
//$event["description"] = $show["description"];
|
||||
$event["showId"] = intval($show["show_id"]);
|
||||
$event["record"] = intval($show["record"]);
|
||||
$event["rebroadcast"] = intval($show["rebroadcast"]);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once 'formatters/LengthFormatter.php';
|
||||
|
||||
class Application_Model_ShowBuilder {
|
||||
|
||||
private $timezone;
|
||||
|
@ -9,12 +11,13 @@ class Application_Model_ShowBuilder {
|
|||
private $opts;
|
||||
|
||||
private $contentDT;
|
||||
private $epoch_now;
|
||||
|
||||
private $defaultRowArray = array(
|
||||
"header" => false,
|
||||
"footer" => false,
|
||||
"empty" => false,
|
||||
"checkbox" => false,
|
||||
"allowed" => false,
|
||||
"id" => 0,
|
||||
"instance" => "",
|
||||
"starts" => "",
|
||||
|
@ -37,26 +40,7 @@ class Application_Model_ShowBuilder {
|
|||
$this->timezone = date_default_timezone_get();
|
||||
$this->user = Application_Model_User::GetCurrentUser();
|
||||
$this->opts = $p_opts;
|
||||
}
|
||||
|
||||
/*
|
||||
* @param DateInterval $p_interval
|
||||
*
|
||||
* @return string $runtime
|
||||
*/
|
||||
private function formatDuration($p_interval){
|
||||
|
||||
$hours = $p_interval->format("%h");
|
||||
$mins = $p_interval->format("%i");
|
||||
|
||||
if( $hours == 0) {
|
||||
$runtime = $p_interval->format("%i:%S");
|
||||
}
|
||||
else {
|
||||
$runtime = $p_interval->format("%h:%I:%S");
|
||||
}
|
||||
|
||||
return $runtime;
|
||||
$this->epoch_now = time();
|
||||
}
|
||||
|
||||
private function formatTimeFilled($p_sec) {
|
||||
|
@ -89,6 +73,7 @@ class Application_Model_ShowBuilder {
|
|||
private function makeFooterRow($p_item) {
|
||||
|
||||
$row = $this->defaultRowArray;
|
||||
$this->isAllowed($p_item, $row);
|
||||
$row["footer"] = true;
|
||||
|
||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||
|
@ -101,6 +86,39 @@ class Application_Model_ShowBuilder {
|
|||
return $row;
|
||||
}
|
||||
|
||||
private function isAllowed($p_item, &$row) {
|
||||
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
|
||||
//can only schedule the show if it hasn't started and you are allowed.
|
||||
if ($this->epoch_now < $showStartDT->format('U') && $this->user->canSchedule($p_item["show_id"]) == true) {
|
||||
$row["allowed"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
private function getItemStatus($p_item, &$row) {
|
||||
|
||||
$showEndDT = new DateTime($p_item["si_ends"]);
|
||||
$schedStartDT = new DateTime($p_item["sched_starts"]);
|
||||
$schedEndDT = new DateTime($p_item["sched_ends"]);
|
||||
|
||||
$showEndEpoch = intval($showEndDT->format("U"));
|
||||
$schedStartEpoch = intval($schedStartDT->format("U"));
|
||||
$schedEndEpoch = intval($schedEndDT->format("U"));
|
||||
|
||||
if ($schedEndEpoch < $showEndEpoch) {
|
||||
$status = 0; //item will playout in full
|
||||
}
|
||||
else if ($schedStartEpoch < $showEndEpoch && $schedEndEpoch > $showEndEpoch) {
|
||||
$status = 1; //item is on boundry
|
||||
}
|
||||
else {
|
||||
$status = 2; //item is overscheduled won't play.
|
||||
}
|
||||
|
||||
$row["status"] = $status;
|
||||
}
|
||||
|
||||
private function getRowTimestamp($p_item, &$row) {
|
||||
|
||||
if (is_null($p_item["si_last_scheduled"])) {
|
||||
|
@ -116,7 +134,9 @@ class Application_Model_ShowBuilder {
|
|||
private function makeHeaderRow($p_item) {
|
||||
|
||||
$row = $this->defaultRowArray;
|
||||
$this->getRowTimestamp($p_item, &$row);
|
||||
$this->isAllowed($p_item, $row);
|
||||
Logging::log("making header for show id ".$p_item["show_id"]);
|
||||
$this->getRowTimestamp($p_item, $row);
|
||||
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
$showStartDT->setTimezone(new DateTimeZone($this->timezone));
|
||||
|
@ -137,15 +157,9 @@ class Application_Model_ShowBuilder {
|
|||
|
||||
private function makeScheduledItemRow($p_item) {
|
||||
$row = $this->defaultRowArray;
|
||||
$epoch_now = time();
|
||||
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
$this->getRowTimestamp($p_item, &$row);
|
||||
|
||||
//can only schedule the show if it hasn't started and you are allowed.
|
||||
if ($epoch_now < $showStartDT->format('U') && $this->user->canSchedule($p_item["show_id"]) == true) {
|
||||
$row["checkbox"] = true;
|
||||
}
|
||||
$this->isAllowed($p_item, $row);
|
||||
$this->getRowTimestamp($p_item, $row);
|
||||
|
||||
if (isset($p_item["sched_starts"])) {
|
||||
|
||||
|
@ -154,13 +168,16 @@ class Application_Model_ShowBuilder {
|
|||
$schedEndDT = new DateTime($p_item["sched_ends"], new DateTimeZone("UTC"));
|
||||
$schedEndDT->setTimezone(new DateTimeZone($this->timezone));
|
||||
|
||||
$runtime = $schedStartDT->diff($schedEndDT);
|
||||
$this->getItemStatus($p_item, $row);
|
||||
|
||||
$row["id"] = intval($p_item["sched_id"]);
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
$row["starts"] = $schedStartDT->format("H:i:s");
|
||||
$row["ends"] = $schedEndDT->format("H:i:s");
|
||||
$row["runtime"] = $this->formatDuration($runtime);
|
||||
|
||||
$formatter = new LengthFormatter($p_item['file_length']);
|
||||
$row['runtime'] = $formatter->format();
|
||||
|
||||
$row["title"] = $p_item["file_track_title"];
|
||||
$row["creator"] = $p_item["file_artist_name"];
|
||||
$row["album"] = $p_item["file_album_title"];
|
||||
|
@ -172,6 +189,8 @@ class Application_Model_ShowBuilder {
|
|||
$row["empty"] = true;
|
||||
$row["id"] = 0 ;
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
|
||||
//return null;
|
||||
}
|
||||
|
||||
return $row;
|
||||
|
@ -219,7 +238,11 @@ class Application_Model_ShowBuilder {
|
|||
}
|
||||
|
||||
//make a normal data row.
|
||||
$display_items[] = $this->makeScheduledItemRow($item);
|
||||
$row = $this->makeScheduledItemRow($item);
|
||||
//don't display the empty rows.
|
||||
if (isset($row)) {
|
||||
$display_items[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
//make the last footer if there were any scheduled items.
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once 'formatters/LengthFormatter.php';
|
||||
|
||||
class Application_Model_ShowInstance {
|
||||
|
||||
private $_instanceId;
|
||||
|
@ -599,9 +601,14 @@ class Application_Model_ShowInstance {
|
|||
{
|
||||
$time = $this->_showInstance->getDbTimeFilled();
|
||||
|
||||
if(is_null($time)) {
|
||||
if (is_null($time)) {
|
||||
$time = "00:00:00";
|
||||
}
|
||||
else {
|
||||
$formatter = new LengthFormatter($time);
|
||||
$time = $formatter->format();
|
||||
}
|
||||
|
||||
return $time;
|
||||
}
|
||||
|
||||
|
@ -631,15 +638,11 @@ class Application_Model_ShowInstance {
|
|||
|
||||
public function getShowLength()
|
||||
{
|
||||
global $CC_DBC;
|
||||
$start = $this->getShowInstanceStart(null);
|
||||
$end = $this->getShowInstanceEnd(null);
|
||||
|
||||
$start_timestamp = $this->getShowInstanceStart();
|
||||
$end_timestamp = $this->getShowInstanceEnd();
|
||||
|
||||
$sql = "SELECT TIMESTAMP '{$end_timestamp}' - TIMESTAMP '{$start_timestamp}' ";
|
||||
$length = $CC_DBC->GetOne($sql);
|
||||
|
||||
return $length;
|
||||
$interval = $start->diff($end);
|
||||
return $interval->format("%h:%I:%S");
|
||||
}
|
||||
|
||||
public function searchPlaylistsForShow($datatables)
|
||||
|
@ -657,47 +660,22 @@ class Application_Model_ShowInstance {
|
|||
|
||||
WHERE s.instance_id = '{$this->_instanceId}' ORDER BY starts";
|
||||
|
||||
return $CC_DBC->GetAll($sql);
|
||||
}
|
||||
Logging::log($sql);
|
||||
|
||||
public function getShowContent()
|
||||
{
|
||||
global $CC_DBC;
|
||||
$results = $CC_DBC->GetAll($sql);
|
||||
|
||||
$res = $this->getShowListContent();
|
||||
foreach ($results as &$row) {
|
||||
|
||||
if(count($res) <= 0) {
|
||||
return $res;
|
||||
$dt = new DateTime($row["starts"], new DateTimeZone("UTC"));
|
||||
$dt->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$row["starts"] = $dt->format("Y-m-d H:i:s");
|
||||
|
||||
$formatter = new LengthFormatter($row["clip_length"]);
|
||||
$row["clip_length"] = $formatter->format();
|
||||
}
|
||||
|
||||
$items = array();
|
||||
$currGroupId = -1;
|
||||
$pl_counter = -1;
|
||||
$f_counter = -1;
|
||||
foreach ($res as $row) {
|
||||
if($currGroupId != $row["group_id"]){
|
||||
$currGroupId = $row["group_id"];
|
||||
$pl_counter = $pl_counter + 1;
|
||||
$f_counter = -1;
|
||||
|
||||
$items[$pl_counter]["pl_name"] = $row["name"];
|
||||
$items[$pl_counter]["pl_creator"] = $row["creator"];
|
||||
$items[$pl_counter]["pl_description"] = $row["description"];
|
||||
$items[$pl_counter]["pl_group"] = $row["group_id"];
|
||||
|
||||
$sql = "SELECT SUM(clip_length) FROM cc_schedule WHERE group_id = '{$currGroupId}'";
|
||||
$length = $CC_DBC->GetOne($sql);
|
||||
|
||||
$items[$pl_counter]["pl_length"] = $length;
|
||||
}
|
||||
$f_counter = $f_counter + 1;
|
||||
|
||||
$items[$pl_counter]["pl_content"][$f_counter]["f_name"] = $row["track_title"];
|
||||
$items[$pl_counter]["pl_content"][$f_counter]["f_artist"] = $row["artist_name"];
|
||||
$items[$pl_counter]["pl_content"][$f_counter]["f_length"] = $row["length"];
|
||||
}
|
||||
|
||||
return $items;
|
||||
return $results;
|
||||
}
|
||||
|
||||
public static function GetShowsInstancesIdsInRange($p_timeNow, $p_start, $p_end)
|
||||
|
|
|
@ -1,312 +0,0 @@
|
|||
<?
|
||||
define('INDCH', ' ');
|
||||
|
||||
require_once("XmlParser.php");
|
||||
|
||||
/**
|
||||
* SmilPlaylist class
|
||||
*
|
||||
* @package Airtime
|
||||
* @subpackage StorageServer
|
||||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
*/
|
||||
class SmilPlaylist {
|
||||
|
||||
/**
|
||||
* Parse SMIL file or string
|
||||
*
|
||||
* @param string $data
|
||||
* local path to SMIL file or SMIL string
|
||||
* @param string $loc
|
||||
* location: 'file'|'string'
|
||||
* @return array
|
||||
* reference, parse result tree (or PEAR::error)
|
||||
*/
|
||||
private static function &parse($data='', $loc='file')
|
||||
{
|
||||
return XmlParser::parse($data, $loc);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Import SMIL file to storage
|
||||
*
|
||||
* @param GreenBox $gb
|
||||
* reference to GreenBox object
|
||||
* @param string $aPath
|
||||
* absolute path part of imported file (e.g. /home/user/airtime)
|
||||
* @param string $rPath
|
||||
* relative path/filename part of imported file
|
||||
* (e.g. playlists/playlist_1.smil)
|
||||
* @param array $gunids
|
||||
* hash relation from filenames to gunids
|
||||
* @param string $plid
|
||||
* playlist gunid
|
||||
* @param int $subjid
|
||||
* local subject (user) id (id of user doing the import)
|
||||
* @return Playlist
|
||||
*/
|
||||
public static function &import(&$gb, $aPath, $rPath, &$gunids, $plid, $subjid=NULL)
|
||||
{
|
||||
$parr = compact('subjid', 'aPath', 'plid', 'rPath');
|
||||
$path = realpath("$aPath/$rPath");
|
||||
if (FALSE === $path) {
|
||||
return PEAR::raiseError(
|
||||
"SmilPlaylist::import: file doesn't exist ($aPath/$rPath)"
|
||||
);
|
||||
}
|
||||
$lspl = SmilPlaylist::convert2lspl($gb, $path, $gunids, $parr);
|
||||
if (PEAR::isError($lspl)) {
|
||||
return $lspl;
|
||||
}
|
||||
require_once("Playlist.php");
|
||||
$pl =& Application_Model_Playlist::create($gb, $plid, "imported_SMIL");
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
$r = $pl->lock($gb, $subjid);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
$r = $pl->setMetadata($lspl, 'string', 'playlist');
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
$r = $pl->unlock($gb);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return $pl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Import SMIL file to storage.
|
||||
*
|
||||
* @param GreenBox $gb
|
||||
* @param string $data
|
||||
* local path to SMIL file
|
||||
* @param hasharray $gunids
|
||||
* hash relation from filenames to gunids
|
||||
* @param array $parr
|
||||
* array of subjid, aPath, plid, rPath
|
||||
* @return string
|
||||
* XML of playlist in Airtime playlist format
|
||||
*/
|
||||
public static function convert2lspl(&$gb, $data, &$gunids, $parr)
|
||||
{
|
||||
extract($parr);
|
||||
$tree = SmilPlaylist::parse($data);
|
||||
if (PEAR::isError($tree)) {
|
||||
return $tree;
|
||||
}
|
||||
if ($tree->name != 'smil') {
|
||||
return PEAR::raiseError("SmilPlaylist::parse: smil tag expected");
|
||||
}
|
||||
if (isset($tree->children[1])) {
|
||||
return PEAR::raiseError(sprintf(
|
||||
"SmilPlaylist::parse: unexpected tag %s in tag smil",
|
||||
$tree->children[1]->name
|
||||
));
|
||||
}
|
||||
$res = SmilPlaylistBodyElement::convert2lspl(
|
||||
$gb, $tree->children[0], &$gunids, $parr);
|
||||
return $res;
|
||||
}
|
||||
|
||||
} // SmilPlaylist
|
||||
|
||||
|
||||
/**
|
||||
* @package Airtime
|
||||
* @subpackage StorageServer
|
||||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
*/
|
||||
class SmilPlaylistBodyElement {
|
||||
|
||||
public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
|
||||
{
|
||||
extract($parr);
|
||||
$ind2 = $ind.INDCH;
|
||||
if ($tree->name != 'body') {
|
||||
return PEAR::raiseError("SmilPlaylist::parse: body tag expected");
|
||||
}
|
||||
if (isset($tree->children[1])) {
|
||||
return PEAR::raiseError(sprintf(
|
||||
"SmilPlaylist::parse: unexpected tag %s in tag body",
|
||||
$tree->children[1]->name
|
||||
));
|
||||
}
|
||||
$res = SmilPlaylistParElement::convert2lspl(
|
||||
$gb, $tree->children[0], &$gunids, $parr, $ind2);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$title = basename($rPath);
|
||||
$playlength = '0';
|
||||
$res = "$ind<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n".
|
||||
"$ind<playlist id=\"$plid\" playlength=\"$playlength\" title=\"$title\">\n".
|
||||
"$ind2<metadata/>\n".
|
||||
"$res".
|
||||
"$ind</playlist>\n";
|
||||
return $res;
|
||||
}
|
||||
|
||||
} // class SmilPlaylistBodyElement
|
||||
|
||||
|
||||
/**
|
||||
* @package Airtime
|
||||
* @subpackage StorageServer
|
||||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
*/
|
||||
class SmilPlaylistParElement {
|
||||
|
||||
public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
|
||||
{
|
||||
extract($parr);
|
||||
if ($tree->name != 'par') {
|
||||
return PEAR::raiseError("SmilPlaylist::parse: par tag expected");
|
||||
}
|
||||
$res = '';
|
||||
foreach ($tree->children as $i => $ch) {
|
||||
$ch =& $tree->children[$i];
|
||||
$r = SmilPlaylistAudioElement::convert2lspl($gb, $ch, &$gunids, $parr, $ind.INDCH);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
$res .= $r;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @package Airtime
|
||||
* @subpackage StorageServer
|
||||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
*/
|
||||
class SmilPlaylistAudioElement {
|
||||
public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
|
||||
{
|
||||
extract($parr);
|
||||
$uri = $tree->attrs['src']->val;
|
||||
$gunid = ( isset($gunids[basename($uri)]) ? $gunids[basename($uri)] : NULL);
|
||||
$ind2 = $ind.INDCH;
|
||||
if ($tree->name != 'audio') {
|
||||
return PEAR::raiseError("SmilPlaylist::parse: audio tag expected");
|
||||
}
|
||||
if (isset($tree->children[2])) {
|
||||
return PEAR::raiseError(sprintf(
|
||||
"SmilPlaylist::parse: unexpected tag %s in tag audio",
|
||||
$tree->children[2]->name
|
||||
));
|
||||
}
|
||||
$res = ''; $fadeIn = 0; $fadeOut = 0;
|
||||
foreach ($tree->children as $i => $ch) {
|
||||
$ch =& $tree->children[$i];
|
||||
$r = SmilPlaylistAnimateElement::convert2lspl($gb, $ch, &$gunids, $parr, $ind2);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
switch ($r['type']) {
|
||||
case "fadeIn": $fadeIn = $r['val']; break;
|
||||
case "fadeOut": $fadeOut = $r['val']; break;
|
||||
}
|
||||
}
|
||||
if ($fadeIn > 0 || $fadeOut > 0) {
|
||||
$fiGunid = Application_Model_StoredFile::CreateGunid();
|
||||
$fadeIn = Application_Model_Playlist::secondsToPlaylistTime($fadeIn);
|
||||
$fadeOut = Application_Model_Playlist::secondsToPlaylistTime($fadeOut);
|
||||
$fInfo = "$ind2<fadeInfo id=\"$fiGunid\" fadeIn=\"$fadeIn\" fadeOut=\"$fadeOut\"/>\n";
|
||||
} else {
|
||||
$fInfo = '';
|
||||
}
|
||||
$plElGunid = Application_Model_StoredFile::CreateGunid();
|
||||
$acGunid = $gunid;
|
||||
$type = 'audioClip';
|
||||
if (preg_match("|\.([a-zA-Z0-9]+)$|", $uri, $va)) {
|
||||
switch (strtolower($ext = $va[1])) {
|
||||
case "lspl":
|
||||
case "xml":
|
||||
case "smil":
|
||||
case "m3u":
|
||||
$type = 'playlist';
|
||||
$acId = $gb->bsImportPlaylistRaw($gunid,
|
||||
$aPath, $uri, $ext, $gunids, $subjid);
|
||||
if (PEAR::isError($acId)) {
|
||||
return $r;
|
||||
}
|
||||
//break;
|
||||
default:
|
||||
$ac = Application_Model_StoredFile::RecallByGunid($gunid);
|
||||
if (is_null($ac) || PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
}
|
||||
$r = $ac->md->getMetadataElement('dcterms:extent');
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
$playlength = $r[0]['value'];
|
||||
}
|
||||
}
|
||||
|
||||
$title = basename($tree->attrs['src']->val);
|
||||
$offset = Application_Model_Playlist::secondsToPlaylistTime($tree->attrs['begin']->val);
|
||||
$clipStart = Application_Model_Playlist::secondsToPlaylistTime($tree->attrs['clipStart']->val);
|
||||
$clipEnd = Application_Model_Playlist::secondsToPlaylistTime($tree->attrs['clipEnd']->val);
|
||||
$clipLength = Application_Model_Playlist::secondsToPlaylistTime($tree->attrs['clipLength']->val);
|
||||
$res = "$ind<playlistElement id=\"$plElGunid\" relativeOffset=\"$offset\" clipStart=\"$clipStart\" clipEnd=\"$clipEnd\" clipLength=\"$clipLength\">\n".
|
||||
"$ind2<$type id=\"$acGunid\" playlength=\"$playlength\" title=\"$title\"/>\n".
|
||||
$fInfo.
|
||||
"$ind</playlistElement>\n";
|
||||
return $res;
|
||||
}
|
||||
} // class SmilPlaylistAudioElement
|
||||
|
||||
|
||||
/**
|
||||
* @package Airtime
|
||||
* @subpackage StorageServer
|
||||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
*/
|
||||
class SmilPlaylistAnimateElement {
|
||||
|
||||
public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
|
||||
{
|
||||
extract($parr);
|
||||
if ($tree->name != 'animate') {
|
||||
return PEAR::raiseError("SmilPlaylist::parse: animate tag expected");
|
||||
}
|
||||
if ($tree->attrs['attributeName']->val == 'soundLevel' &&
|
||||
$tree->attrs['from']->val == '0%' &&
|
||||
$tree->attrs['to']->val == '100%' &&
|
||||
$tree->attrs['calcMode']->val == 'linear' &&
|
||||
$tree->attrs['fill']->val == 'freeze' &&
|
||||
$tree->attrs['begin']->val == '0s' &&
|
||||
preg_match("|^([0-9.]+)s$|", $tree->attrs['end']->val, $va)
|
||||
) {
|
||||
return array('type'=>'fadeIn', 'val'=>intval($va[1]));
|
||||
}
|
||||
if ($tree->attrs['attributeName']->val == 'soundLevel' &&
|
||||
$tree->attrs['from']->val == '100%' &&
|
||||
$tree->attrs['to']->val == '0%' &&
|
||||
$tree->attrs['calcMode']->val == 'linear' &&
|
||||
$tree->attrs['fill']->val == 'freeze' &&
|
||||
preg_match("|^([0-9.]+)s$|", $tree->attrs['begin']->val, $vaBegin) &&
|
||||
preg_match("|^([0-9.]+)s$|", $tree->attrs['end']->val, $vaEnd)
|
||||
) {
|
||||
return array('type'=>'fadeOut', 'val'=>($vaEnd[1] - $vaBegin[1]));
|
||||
}
|
||||
return PEAR::raiseError(
|
||||
"SmilPlaylistAnimateElement::convert2lspl: animate parameters too general"
|
||||
);
|
||||
}
|
||||
} // class SmilPlaylistAnimateElement
|
||||
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
|
||||
require_once 'formatters/LengthFormatter.php';
|
||||
require_once 'formatters/SamplerateFormatter.php';
|
||||
require_once 'formatters/BitrateFormatter.php';
|
||||
|
||||
/**
|
||||
* Application_Model_StoredFile class
|
||||
*
|
||||
|
@ -551,97 +555,98 @@ class Application_Model_StoredFile {
|
|||
return $res;
|
||||
}
|
||||
|
||||
/*
|
||||
* @param DateInterval $p_interval
|
||||
*
|
||||
* @return string $runtime
|
||||
*/
|
||||
private static function formatDuration($dt){
|
||||
public static function searchFilesForPlaylistBuilder($datatables) {
|
||||
|
||||
$hours = $dt->format("H");
|
||||
$min = $dt->format("i");
|
||||
$sec = $dt->format("s");
|
||||
$displayColumns = array("id", "track_title", "artist_name", "album_title", "genre", "length",
|
||||
"year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
|
||||
"bit_rate", "sample_rate", "isrc_number", "encoded_by", "label", "copyright", "mime", "language"
|
||||
);
|
||||
|
||||
$time = "PT{$hours}H{$min}M{$sec}S";
|
||||
$plSelect = array();
|
||||
$fileSelect = array();
|
||||
foreach ($displayColumns as $key) {
|
||||
|
||||
$p_interval = new DateInterval($time);
|
||||
|
||||
$hours = $p_interval->format("%h");
|
||||
$mins = $p_interval->format("%i");
|
||||
|
||||
if( $hours == 0) {
|
||||
$runtime = $p_interval->format("%i:%S");
|
||||
}
|
||||
else {
|
||||
$runtime = $p_interval->format("%h:%I:%S");
|
||||
}
|
||||
|
||||
return $runtime;
|
||||
}
|
||||
|
||||
public static function searchFilesForPlaylistBuilder($datatables)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$displayData = array("track_title", "artist_name", "album_title", "genre", "length", "year", "utime", "mtime", "ftype", "track_number");
|
||||
|
||||
$plSelect = "SELECT ";
|
||||
$fileSelect = "SELECT ";
|
||||
foreach ($displayData as $key) {
|
||||
|
||||
if ($key === "track_title") {
|
||||
$plSelect .= "name AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
} else if ($key === "ftype") {
|
||||
$plSelect .= "'playlist' AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
} else if ($key === "artist_name") {
|
||||
$plSelect .= "login AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
} else if ($key === "length") {
|
||||
$plSelect .= $key.", ";
|
||||
$fileSelect .= $key."::interval, ";
|
||||
} else if ($key === "year") {
|
||||
$plSelect .= "CAST(utime AS varchar) AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
} else if ($key === "utime") {
|
||||
$plSelect .= $key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
} else if ($key === "mtime") {
|
||||
$plSelect .= $key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
} else if ($key === "track_number") {
|
||||
$plSelect .= "NULL AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
} else {
|
||||
$plSelect .= "NULL AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
if ($key === "id") {
|
||||
$plSelect[] = "PL.id AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
else if ($key === "track_title") {
|
||||
$plSelect[] = "name AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
else if ($key === "ftype") {
|
||||
$plSelect[] = "'playlist'::varchar AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
else if ($key === "artist_name") {
|
||||
$plSelect[] = "login AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
//same columns in each table.
|
||||
else if(in_array($key, array("length", "utime", "mtime"))) {
|
||||
$plSelect[] = $key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
else if ($key === "year") {
|
||||
$plSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
//need to cast certain data as ints for the union to search on.
|
||||
else if (in_array($key, array("track_number"))){
|
||||
$plSelect[] = "NULL::int AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
else {
|
||||
$plSelect[] = "NULL::text AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
$fromTable = " ((".$plSelect."PL.id
|
||||
FROM cc_playlist AS PL LEFT JOIN cc_subjs AS sub ON (sub.id = PL.creator_id))
|
||||
UNION
|
||||
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES WHERE file_exists = 'TRUE')) AS RESULTS";
|
||||
$plSelect = "SELECT ". join(",", $plSelect);
|
||||
$fileSelect = "SELECT ". join(",", $fileSelect);
|
||||
|
||||
$results = Application_Model_StoredFile::searchFiles($fromTable, $datatables);
|
||||
$type = intval($datatables["type"]);
|
||||
|
||||
$plTable = "({$plSelect} FROM cc_playlist AS PL LEFT JOIN cc_subjs AS sub ON (sub.id = PL.creator_id))";
|
||||
$fileTable = "({$fileSelect} FROM cc_files AS FILES WHERE file_exists = 'TRUE')";
|
||||
$unionTable = "({$plTable} UNION {$fileTable} ) AS RESULTS";
|
||||
|
||||
//choose which table we need to select data from.
|
||||
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;
|
||||
default:
|
||||
$fromTable = $unionTable;
|
||||
}
|
||||
|
||||
$results = Application_Model_StoredFile::searchFiles($displayColumns, $fromTable, $datatables);
|
||||
|
||||
|
||||
foreach($results['aaData'] as &$row){
|
||||
foreach ($results['aaData'] as &$row) {
|
||||
|
||||
$row['id'] = intval($row['id']);
|
||||
|
||||
//$length = new DateTime($row['length']);
|
||||
//$row['length'] = self::formatDuration($length);
|
||||
$formatter = new LengthFormatter($row['length']);
|
||||
$row['length'] = $formatter->format();
|
||||
|
||||
if ($row['ftype'] === "audioclip") {
|
||||
$formatter = new SamplerateFormatter($row['sample_rate']);
|
||||
$row['sample_rate'] = $formatter->format();
|
||||
|
||||
$formatter = new BitrateFormatter($row['bit_rate']);
|
||||
$row['bit_rate'] = $formatter->format();
|
||||
}
|
||||
|
||||
// add checkbox row
|
||||
$row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>";
|
||||
|
||||
// a full timestamp is being returned for playlists' year column;
|
||||
// split it and grab only the year info
|
||||
$yearSplit = explode('-', $row['year']);
|
||||
$row['year'] = $yearSplit[0];
|
||||
|
||||
$type = substr($row['ftype'], 0, 2);
|
||||
|
||||
$row['tr_id'] = "{$type}_{$row['id']}";
|
||||
|
@ -649,7 +654,7 @@ class Application_Model_StoredFile {
|
|||
//TODO url like this to work on both playlist/showbuilder screens.
|
||||
//datatable stuff really needs to be pulled out and generalized within the project
|
||||
//access to zend view methods to access url helpers is needed.
|
||||
if($type == "au") {
|
||||
if ($type == "au") {
|
||||
$row['image'] = '<img src="/css/images/icon_audioclip.png">';
|
||||
}
|
||||
else {
|
||||
|
@ -660,55 +665,35 @@ class Application_Model_StoredFile {
|
|||
return $results;
|
||||
}
|
||||
|
||||
public static function searchPlaylistsForSchedule($datatables)
|
||||
{
|
||||
$fromTable = "cc_playlist AS pl LEFT JOIN cc_playlisttimes AS plt USING(id) LEFT JOIN cc_subjs AS sub ON pl.editedby = sub.id";
|
||||
//$datatables["optWhere"][] = "INTERVAL '{$time_remaining}' > INTERVAL '00:00:00'";
|
||||
$datatables["optWhere"][] = "plt.length > INTERVAL '00:00:00'";
|
||||
|
||||
return Application_Model_StoredFile::searchFiles($fromTable, $datatables);
|
||||
}
|
||||
|
||||
public static function searchFiles($fromTable, $data)
|
||||
public static function searchFiles($displayColumns, $fromTable, $data)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
||||
$where = array();
|
||||
|
||||
$columnsDisplayed = explode(",", $data["sColumns"]);
|
||||
|
||||
if($data["sSearch"] !== "")
|
||||
if ($data["sSearch"] !== "") {
|
||||
$searchTerms = explode(" ", $data["sSearch"]);
|
||||
|
||||
$selectorCount = "SELECT COUNT(*)";
|
||||
foreach( $columnsDisplayed as $key=>$col){
|
||||
if($col == ''){
|
||||
unset($columnsDisplayed[$key]);
|
||||
}
|
||||
}
|
||||
//$selectorRows = "SELECT " . join(',', $columnsDisplayed );
|
||||
$selectorRows = "SELECT * ";
|
||||
|
||||
$selectorCount = "SELECT COUNT(*) ";
|
||||
$selectorRows = "SELECT ".join(",", $displayColumns)." ";
|
||||
|
||||
$sql = $selectorCount." FROM ".$fromTable;
|
||||
$totalRows = $CC_DBC->getOne($sql);
|
||||
$sqlTotalRows = $sql;
|
||||
|
||||
// Where clause
|
||||
if(isset($data["optWhere"])) {
|
||||
$where[] = join(" AND ", $data["optWhere"]);
|
||||
}
|
||||
|
||||
if(isset($searchTerms)) {
|
||||
if (isset($searchTerms)) {
|
||||
$searchCols = array();
|
||||
for($i=0; $i<$data["iColumns"]; $i++) {
|
||||
if($data["bSearchable_".$i] == "true") {
|
||||
$searchCols[] = $columnsDisplayed[$i];
|
||||
for ($i = 0; $i < $data["iColumns"]; $i++) {
|
||||
if ($data["bSearchable_".$i] == "true") {
|
||||
$searchCols[] = $data["mDataProp_{$i}"];
|
||||
}
|
||||
}
|
||||
|
||||
$outerCond = array();
|
||||
|
||||
foreach($searchTerms as $term) {
|
||||
foreach ($searchTerms as $term) {
|
||||
$innerCond = array();
|
||||
|
||||
foreach($searchCols as $col) {
|
||||
foreach ($searchCols as $col) {
|
||||
$escapedTerm = pg_escape_string($term);
|
||||
$innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'";
|
||||
}
|
||||
|
@ -720,31 +705,47 @@ class Application_Model_StoredFile {
|
|||
|
||||
// Order By clause
|
||||
$orderby = array();
|
||||
for($i=0; $i<$data["iSortingCols"]; $i++){
|
||||
$orderby[] = $columnsDisplayed[$data["iSortCol_".$i]]." ".$data["sSortDir_".$i];
|
||||
for ($i = 0; $i < $data["iSortingCols"]; $i++){
|
||||
$num = $data["iSortCol_".$i];
|
||||
$orderby[] = $data["mDataProp_{$num}"]." ".$data["sSortDir_".$i];
|
||||
}
|
||||
$orderby[] = "id";
|
||||
$orderby = join("," , $orderby);
|
||||
// End Order By clause
|
||||
|
||||
if(isset($where)) {
|
||||
if (count($where) > 0) {
|
||||
$where = join(" AND ", $where);
|
||||
$sql = $selectorCount." FROM ".$fromTable." WHERE ".$where;
|
||||
$totalDisplayRows = $CC_DBC->getOne($sql);
|
||||
$sqlTotalDisplayRows = $sql;
|
||||
|
||||
$sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
|
||||
}
|
||||
else {
|
||||
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
|
||||
}
|
||||
|
||||
try {
|
||||
$r = $con->query($sqlTotalRows);
|
||||
$totalRows = $r->fetchColumn(0);
|
||||
|
||||
if (isset($sqlTotalDisplayRows)) {
|
||||
$r = $con->query($sqlTotalDisplayRows);
|
||||
$totalDisplayRows = $r->fetchColumn(0);
|
||||
}
|
||||
else {
|
||||
$totalDisplayRows = $totalRows;
|
||||
}
|
||||
|
||||
$r = $con->query($sql);
|
||||
$r->setFetchMode(PDO::FETCH_ASSOC);
|
||||
$results = $r->fetchAll();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log($e->getMessage());
|
||||
}
|
||||
|
||||
//display sql executed in airtime log for testing
|
||||
//Logging::log($sql);
|
||||
|
||||
$results = $CC_DBC->getAll($sql);
|
||||
|
||||
if(!isset($totalDisplayRows)) {
|
||||
$totalDisplayRows = $totalRows;
|
||||
}
|
||||
Logging::log($sql);
|
||||
|
||||
return array("sEcho" => intval($data["sEcho"]), "iTotalDisplayRecords" => $totalDisplayRows, "iTotalRecords" => $totalRows, "aaData" => $results);
|
||||
}
|
||||
|
|
|
@ -37,15 +37,16 @@ class Application_Model_User {
|
|||
|
||||
public function canSchedule($p_showId) {
|
||||
$type = $this->getType();
|
||||
$result = false;
|
||||
|
||||
if ( $type === UTYPE_ADMIN ||
|
||||
$type === UTYPE_PROGRAM_MANAGER ||
|
||||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0 )
|
||||
{
|
||||
return true;
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function isUserType($type, $showId=''){
|
||||
|
@ -240,6 +241,7 @@ class Application_Model_User {
|
|||
|
||||
public static function getUsersDataTablesInfo($datatables_post) {
|
||||
|
||||
$displayColumns = array("id", "login", "first_name", "last_name", "type");
|
||||
$fromTable = "cc_subjs";
|
||||
|
||||
// get current user
|
||||
|
@ -250,7 +252,7 @@ class Application_Model_User {
|
|||
$username = $auth->getIdentity()->login;
|
||||
}
|
||||
|
||||
$res = Application_Model_StoredFile::searchFiles($fromTable, $datatables_post);
|
||||
$res = Application_Model_StoredFile::searchFiles($displayColumns, $fromTable, $datatables_post);
|
||||
|
||||
// mark record which is for the current user
|
||||
foreach($res['aaData'] as &$record){
|
||||
|
|
|
@ -57,7 +57,7 @@ class CcFilesTableMap extends TableMap {
|
|||
$this->addColumn('BIT_RATE', 'DbBitRate', 'VARCHAR', false, 32, null);
|
||||
$this->addColumn('SAMPLE_RATE', 'DbSampleRate', 'VARCHAR', false, 32, null);
|
||||
$this->addColumn('FORMAT', 'DbFormat', 'VARCHAR', false, 128, null);
|
||||
$this->addColumn('LENGTH', 'DbLength', 'TIME', false, null, null);
|
||||
$this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
|
||||
$this->addColumn('ALBUM_TITLE', 'DbAlbumTitle', 'VARCHAR', false, 512, null);
|
||||
$this->addColumn('GENRE', 'DbGenre', 'VARCHAR', false, 64, null);
|
||||
$this->addColumn('COMMENTS', 'DbComments', 'LONGVARCHAR', false, null, null);
|
||||
|
|
|
@ -39,17 +39,14 @@ class CcScheduleTableMap extends TableMap {
|
|||
$this->setPrimaryKeyMethodInfo('cc_schedule_id_seq');
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('GROUP_ID', 'DbGroupId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
|
||||
$this->addColumn('CLIP_LENGTH', 'DbClipLength', 'TIME', false, null, '00:00:00');
|
||||
$this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00');
|
||||
$this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00');
|
||||
$this->addColumn('CUE_IN', 'DbCueIn', 'TIME', false, null, '00:00:00');
|
||||
$this->addColumn('CUE_OUT', 'DbCueOut', 'TIME', false, null, '00:00:00');
|
||||
$this->addColumn('SCHEDULE_GROUP_PLAYED', 'DbScheduleGroupPlayed', 'BOOLEAN', false, null, false);
|
||||
$this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false);
|
||||
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null);
|
||||
// validators
|
||||
|
|
|
@ -146,6 +146,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* The value for the length field.
|
||||
* Note: this column has a database default value of: '00:00:00'
|
||||
* @var string
|
||||
*/
|
||||
protected $length;
|
||||
|
@ -456,6 +457,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$this->filepath = '';
|
||||
$this->state = 'empty';
|
||||
$this->currentlyaccessing = 0;
|
||||
$this->length = '00:00:00';
|
||||
$this->file_exists = true;
|
||||
}
|
||||
|
||||
|
@ -729,36 +731,13 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [length] column value.
|
||||
* Get the [length] column value.
|
||||
*
|
||||
*
|
||||
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||
* If format is NULL, then the raw DateTime object will be returned.
|
||||
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
|
||||
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||
* @return string
|
||||
*/
|
||||
public function getDbLength($format = '%X')
|
||||
public function getDbLength()
|
||||
{
|
||||
if ($this->length === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
$dt = new DateTime($this->length);
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->length, true), $x);
|
||||
}
|
||||
|
||||
if ($format === null) {
|
||||
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
|
||||
return $dt;
|
||||
} elseif (strpos($format, '%') !== false) {
|
||||
return strftime($format, $dt->format('U'));
|
||||
} else {
|
||||
return $dt->format($format);
|
||||
}
|
||||
return $this->length;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1657,50 +1636,21 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
} // setDbFormat()
|
||||
|
||||
/**
|
||||
* Sets the value of [length] column to a normalized version of the date/time value specified.
|
||||
* Set the value of [length] column.
|
||||
*
|
||||
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
|
||||
* be treated as NULL for temporal objects.
|
||||
* @param string $v new value
|
||||
* @return CcFiles The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbLength($v)
|
||||
{
|
||||
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
|
||||
// -- which is unexpected, to say the least.
|
||||
if ($v === null || $v === '') {
|
||||
$dt = null;
|
||||
} elseif ($v instanceof DateTime) {
|
||||
$dt = $v;
|
||||
} else {
|
||||
// some string/numeric value passed; we normalize that so that we can
|
||||
// validate it.
|
||||
try {
|
||||
if (is_numeric($v)) { // if it's a unix timestamp
|
||||
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
|
||||
// We have to explicitly specify and then change the time zone because of a
|
||||
// DateTime bug: http://bugs.php.net/bug.php?id=43003
|
||||
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
|
||||
} else {
|
||||
$dt = new DateTime($v);
|
||||
}
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
|
||||
}
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ( $this->length !== null || $dt !== null ) {
|
||||
// (nested ifs are a little easier to read in this case)
|
||||
|
||||
$currNorm = ($this->length !== null && $tmpDt = new DateTime($this->length)) ? $tmpDt->format('H:i:s') : null;
|
||||
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
|
||||
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
)
|
||||
{
|
||||
$this->length = ($dt ? $dt->format('H:i:s') : null);
|
||||
$this->modifiedColumns[] = CcFilesPeer::LENGTH;
|
||||
}
|
||||
} // if either are not null
|
||||
if ($this->length !== $v || $this->isNew()) {
|
||||
$this->length = $v;
|
||||
$this->modifiedColumns[] = CcFilesPeer::LENGTH;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbLength()
|
||||
|
@ -2579,6 +2529,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->length !== '00:00:00') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->file_exists !== true) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -863,29 +863,20 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
|||
/**
|
||||
* Filter the query on the length column
|
||||
*
|
||||
* @param string|array $dbLength The value to use as filter.
|
||||
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
|
||||
* @param string $dbLength The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcFilesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbLength($dbLength = null, $comparison = null)
|
||||
{
|
||||
if (is_array($dbLength)) {
|
||||
$useMinMax = false;
|
||||
if (isset($dbLength['min'])) {
|
||||
$this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($dbLength['max'])) {
|
||||
$this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
if (null === $comparison) {
|
||||
if (is_array($dbLength)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $dbLength)) {
|
||||
$dbLength = str_replace('*', '%', $dbLength);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength, $comparison);
|
||||
|
|
|
@ -30,12 +30,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* The value for the playlist_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $playlist_id;
|
||||
|
||||
/**
|
||||
* The value for the starts field.
|
||||
* @var string
|
||||
|
@ -48,12 +42,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $ends;
|
||||
|
||||
/**
|
||||
* The value for the group_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $group_id;
|
||||
|
||||
/**
|
||||
* The value for the file_id field.
|
||||
* @var int
|
||||
|
@ -95,13 +83,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $cue_out;
|
||||
|
||||
/**
|
||||
* The value for the schedule_group_played field.
|
||||
* Note: this column has a database default value of: false
|
||||
* @var boolean
|
||||
*/
|
||||
protected $schedule_group_played;
|
||||
|
||||
/**
|
||||
* The value for the media_item_played field.
|
||||
* Note: this column has a database default value of: false
|
||||
|
@ -155,7 +136,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$this->fade_out = '00:00:00';
|
||||
$this->cue_in = '00:00:00';
|
||||
$this->cue_out = '00:00:00';
|
||||
$this->schedule_group_played = false;
|
||||
$this->media_item_played = false;
|
||||
}
|
||||
|
||||
|
@ -179,16 +159,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [playlist_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbPlaylistId()
|
||||
{
|
||||
return $this->playlist_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [starts] column value.
|
||||
*
|
||||
|
@ -255,16 +225,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [group_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbGroupId()
|
||||
{
|
||||
return $this->group_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [file_id] column value.
|
||||
*
|
||||
|
@ -440,16 +400,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [schedule_group_played] column value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getDbScheduleGroupPlayed()
|
||||
{
|
||||
return $this->schedule_group_played;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [media_item_played] column value.
|
||||
*
|
||||
|
@ -490,26 +440,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
return $this;
|
||||
} // setDbId()
|
||||
|
||||
/**
|
||||
* Set the value of [playlist_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcSchedule The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbPlaylistId($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->playlist_id !== $v) {
|
||||
$this->playlist_id = $v;
|
||||
$this->modifiedColumns[] = CcSchedulePeer::PLAYLIST_ID;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbPlaylistId()
|
||||
|
||||
/**
|
||||
* Sets the value of [starts] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
|
@ -608,26 +538,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
return $this;
|
||||
} // setDbEnds()
|
||||
|
||||
/**
|
||||
* Set the value of [group_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcSchedule The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbGroupId($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->group_id !== $v) {
|
||||
$this->group_id = $v;
|
||||
$this->modifiedColumns[] = CcSchedulePeer::GROUP_ID;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbGroupId()
|
||||
|
||||
/**
|
||||
* Set the value of [file_id] column.
|
||||
*
|
||||
|
@ -902,26 +812,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
return $this;
|
||||
} // setDbCueOut()
|
||||
|
||||
/**
|
||||
* Set the value of [schedule_group_played] column.
|
||||
*
|
||||
* @param boolean $v new value
|
||||
* @return CcSchedule The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbScheduleGroupPlayed($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (boolean) $v;
|
||||
}
|
||||
|
||||
if ($this->schedule_group_played !== $v || $this->isNew()) {
|
||||
$this->schedule_group_played = $v;
|
||||
$this->modifiedColumns[] = CcSchedulePeer::SCHEDULE_GROUP_PLAYED;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbScheduleGroupPlayed()
|
||||
|
||||
/**
|
||||
* Set the value of [media_item_played] column.
|
||||
*
|
||||
|
@ -996,10 +886,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->schedule_group_played !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->media_item_played !== false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1027,19 +913,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
try {
|
||||
|
||||
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
|
||||
$this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
|
||||
$this->starts = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
|
||||
$this->ends = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
|
||||
$this->group_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
|
||||
$this->file_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
|
||||
$this->clip_length = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
|
||||
$this->fade_in = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
|
||||
$this->fade_out = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
|
||||
$this->cue_in = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
|
||||
$this->cue_out = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
|
||||
$this->schedule_group_played = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null;
|
||||
$this->media_item_played = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null;
|
||||
$this->instance_id = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
|
||||
$this->starts = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
|
||||
$this->ends = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
|
||||
$this->file_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
|
||||
$this->clip_length = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
|
||||
$this->fade_in = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
|
||||
$this->fade_out = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
|
||||
$this->cue_in = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
|
||||
$this->cue_out = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
|
||||
$this->media_item_played = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null;
|
||||
$this->instance_id = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null;
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
@ -1048,7 +931,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 14; // 14 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
return $startcol + 11; // 11 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating CcSchedule object", $e);
|
||||
|
@ -1398,42 +1281,33 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
return $this->getDbId();
|
||||
break;
|
||||
case 1:
|
||||
return $this->getDbPlaylistId();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getDbStarts();
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
return $this->getDbEnds();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getDbGroupId();
|
||||
break;
|
||||
case 5:
|
||||
case 3:
|
||||
return $this->getDbFileId();
|
||||
break;
|
||||
case 6:
|
||||
case 4:
|
||||
return $this->getDbClipLength();
|
||||
break;
|
||||
case 7:
|
||||
case 5:
|
||||
return $this->getDbFadeIn();
|
||||
break;
|
||||
case 8:
|
||||
case 6:
|
||||
return $this->getDbFadeOut();
|
||||
break;
|
||||
case 9:
|
||||
case 7:
|
||||
return $this->getDbCueIn();
|
||||
break;
|
||||
case 10:
|
||||
case 8:
|
||||
return $this->getDbCueOut();
|
||||
break;
|
||||
case 11:
|
||||
return $this->getDbScheduleGroupPlayed();
|
||||
break;
|
||||
case 12:
|
||||
case 9:
|
||||
return $this->getDbMediaItemPlayed();
|
||||
break;
|
||||
case 13:
|
||||
case 10:
|
||||
return $this->getDbInstanceId();
|
||||
break;
|
||||
default:
|
||||
|
@ -1461,19 +1335,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$keys = CcSchedulePeer::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getDbId(),
|
||||
$keys[1] => $this->getDbPlaylistId(),
|
||||
$keys[2] => $this->getDbStarts(),
|
||||
$keys[3] => $this->getDbEnds(),
|
||||
$keys[4] => $this->getDbGroupId(),
|
||||
$keys[5] => $this->getDbFileId(),
|
||||
$keys[6] => $this->getDbClipLength(),
|
||||
$keys[7] => $this->getDbFadeIn(),
|
||||
$keys[8] => $this->getDbFadeOut(),
|
||||
$keys[9] => $this->getDbCueIn(),
|
||||
$keys[10] => $this->getDbCueOut(),
|
||||
$keys[11] => $this->getDbScheduleGroupPlayed(),
|
||||
$keys[12] => $this->getDbMediaItemPlayed(),
|
||||
$keys[13] => $this->getDbInstanceId(),
|
||||
$keys[1] => $this->getDbStarts(),
|
||||
$keys[2] => $this->getDbEnds(),
|
||||
$keys[3] => $this->getDbFileId(),
|
||||
$keys[4] => $this->getDbClipLength(),
|
||||
$keys[5] => $this->getDbFadeIn(),
|
||||
$keys[6] => $this->getDbFadeOut(),
|
||||
$keys[7] => $this->getDbCueIn(),
|
||||
$keys[8] => $this->getDbCueOut(),
|
||||
$keys[9] => $this->getDbMediaItemPlayed(),
|
||||
$keys[10] => $this->getDbInstanceId(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->aCcShowInstances) {
|
||||
|
@ -1517,42 +1388,33 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$this->setDbId($value);
|
||||
break;
|
||||
case 1:
|
||||
$this->setDbPlaylistId($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setDbStarts($value);
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
$this->setDbEnds($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setDbGroupId($value);
|
||||
break;
|
||||
case 5:
|
||||
case 3:
|
||||
$this->setDbFileId($value);
|
||||
break;
|
||||
case 6:
|
||||
case 4:
|
||||
$this->setDbClipLength($value);
|
||||
break;
|
||||
case 7:
|
||||
case 5:
|
||||
$this->setDbFadeIn($value);
|
||||
break;
|
||||
case 8:
|
||||
case 6:
|
||||
$this->setDbFadeOut($value);
|
||||
break;
|
||||
case 9:
|
||||
case 7:
|
||||
$this->setDbCueIn($value);
|
||||
break;
|
||||
case 10:
|
||||
case 8:
|
||||
$this->setDbCueOut($value);
|
||||
break;
|
||||
case 11:
|
||||
$this->setDbScheduleGroupPlayed($value);
|
||||
break;
|
||||
case 12:
|
||||
case 9:
|
||||
$this->setDbMediaItemPlayed($value);
|
||||
break;
|
||||
case 13:
|
||||
case 10:
|
||||
$this->setDbInstanceId($value);
|
||||
break;
|
||||
} // switch()
|
||||
|
@ -1580,19 +1442,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$keys = CcSchedulePeer::getFieldNames($keyType);
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setDbPlaylistId($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setDbStarts($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setDbEnds($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setDbGroupId($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setDbFileId($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setDbClipLength($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setDbFadeIn($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setDbFadeOut($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setDbCueIn($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setDbCueOut($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setDbScheduleGroupPlayed($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setDbMediaItemPlayed($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setDbInstanceId($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setDbStarts($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setDbEnds($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setDbFileId($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setDbClipLength($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setDbFadeIn($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setDbFadeOut($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setDbCueIn($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setDbCueOut($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setDbMediaItemPlayed($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setDbInstanceId($arr[$keys[10]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1605,17 +1464,14 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$criteria = new Criteria(CcSchedulePeer::DATABASE_NAME);
|
||||
|
||||
if ($this->isColumnModified(CcSchedulePeer::ID)) $criteria->add(CcSchedulePeer::ID, $this->id);
|
||||
if ($this->isColumnModified(CcSchedulePeer::PLAYLIST_ID)) $criteria->add(CcSchedulePeer::PLAYLIST_ID, $this->playlist_id);
|
||||
if ($this->isColumnModified(CcSchedulePeer::STARTS)) $criteria->add(CcSchedulePeer::STARTS, $this->starts);
|
||||
if ($this->isColumnModified(CcSchedulePeer::ENDS)) $criteria->add(CcSchedulePeer::ENDS, $this->ends);
|
||||
if ($this->isColumnModified(CcSchedulePeer::GROUP_ID)) $criteria->add(CcSchedulePeer::GROUP_ID, $this->group_id);
|
||||
if ($this->isColumnModified(CcSchedulePeer::FILE_ID)) $criteria->add(CcSchedulePeer::FILE_ID, $this->file_id);
|
||||
if ($this->isColumnModified(CcSchedulePeer::CLIP_LENGTH)) $criteria->add(CcSchedulePeer::CLIP_LENGTH, $this->clip_length);
|
||||
if ($this->isColumnModified(CcSchedulePeer::FADE_IN)) $criteria->add(CcSchedulePeer::FADE_IN, $this->fade_in);
|
||||
if ($this->isColumnModified(CcSchedulePeer::FADE_OUT)) $criteria->add(CcSchedulePeer::FADE_OUT, $this->fade_out);
|
||||
if ($this->isColumnModified(CcSchedulePeer::CUE_IN)) $criteria->add(CcSchedulePeer::CUE_IN, $this->cue_in);
|
||||
if ($this->isColumnModified(CcSchedulePeer::CUE_OUT)) $criteria->add(CcSchedulePeer::CUE_OUT, $this->cue_out);
|
||||
if ($this->isColumnModified(CcSchedulePeer::SCHEDULE_GROUP_PLAYED)) $criteria->add(CcSchedulePeer::SCHEDULE_GROUP_PLAYED, $this->schedule_group_played);
|
||||
if ($this->isColumnModified(CcSchedulePeer::MEDIA_ITEM_PLAYED)) $criteria->add(CcSchedulePeer::MEDIA_ITEM_PLAYED, $this->media_item_played);
|
||||
if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) $criteria->add(CcSchedulePeer::INSTANCE_ID, $this->instance_id);
|
||||
|
||||
|
@ -1679,17 +1535,14 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
*/
|
||||
public function copyInto($copyObj, $deepCopy = false)
|
||||
{
|
||||
$copyObj->setDbPlaylistId($this->playlist_id);
|
||||
$copyObj->setDbStarts($this->starts);
|
||||
$copyObj->setDbEnds($this->ends);
|
||||
$copyObj->setDbGroupId($this->group_id);
|
||||
$copyObj->setDbFileId($this->file_id);
|
||||
$copyObj->setDbClipLength($this->clip_length);
|
||||
$copyObj->setDbFadeIn($this->fade_in);
|
||||
$copyObj->setDbFadeOut($this->fade_out);
|
||||
$copyObj->setDbCueIn($this->cue_in);
|
||||
$copyObj->setDbCueOut($this->cue_out);
|
||||
$copyObj->setDbScheduleGroupPlayed($this->schedule_group_played);
|
||||
$copyObj->setDbMediaItemPlayed($this->media_item_played);
|
||||
$copyObj->setDbInstanceId($this->instance_id);
|
||||
|
||||
|
@ -1843,17 +1696,14 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
public function clear()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->playlist_id = null;
|
||||
$this->starts = null;
|
||||
$this->ends = null;
|
||||
$this->group_id = null;
|
||||
$this->file_id = null;
|
||||
$this->clip_length = null;
|
||||
$this->fade_in = null;
|
||||
$this->fade_out = null;
|
||||
$this->cue_in = null;
|
||||
$this->cue_out = null;
|
||||
$this->schedule_group_played = null;
|
||||
$this->media_item_played = null;
|
||||
$this->instance_id = null;
|
||||
$this->alreadyInSave = false;
|
||||
|
|
|
@ -26,7 +26,7 @@ abstract class BaseCcSchedulePeer {
|
|||
const TM_CLASS = 'CcScheduleTableMap';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 14;
|
||||
const NUM_COLUMNS = 11;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
@ -34,18 +34,12 @@ abstract class BaseCcSchedulePeer {
|
|||
/** the column name for the ID field */
|
||||
const ID = 'cc_schedule.ID';
|
||||
|
||||
/** the column name for the PLAYLIST_ID field */
|
||||
const PLAYLIST_ID = 'cc_schedule.PLAYLIST_ID';
|
||||
|
||||
/** the column name for the STARTS field */
|
||||
const STARTS = 'cc_schedule.STARTS';
|
||||
|
||||
/** the column name for the ENDS field */
|
||||
const ENDS = 'cc_schedule.ENDS';
|
||||
|
||||
/** the column name for the GROUP_ID field */
|
||||
const GROUP_ID = 'cc_schedule.GROUP_ID';
|
||||
|
||||
/** the column name for the FILE_ID field */
|
||||
const FILE_ID = 'cc_schedule.FILE_ID';
|
||||
|
||||
|
@ -64,9 +58,6 @@ abstract class BaseCcSchedulePeer {
|
|||
/** the column name for the CUE_OUT field */
|
||||
const CUE_OUT = 'cc_schedule.CUE_OUT';
|
||||
|
||||
/** the column name for the SCHEDULE_GROUP_PLAYED field */
|
||||
const SCHEDULE_GROUP_PLAYED = 'cc_schedule.SCHEDULE_GROUP_PLAYED';
|
||||
|
||||
/** the column name for the MEDIA_ITEM_PLAYED field */
|
||||
const MEDIA_ITEM_PLAYED = 'cc_schedule.MEDIA_ITEM_PLAYED';
|
||||
|
||||
|
@ -89,12 +80,12 @@ abstract class BaseCcSchedulePeer {
|
|||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbStarts', 'DbEnds', 'DbGroupId', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbScheduleGroupPlayed', 'DbMediaItemPlayed', 'DbInstanceId', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbStarts', 'dbEnds', 'dbGroupId', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbScheduleGroupPlayed', 'dbMediaItemPlayed', 'dbInstanceId', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::STARTS, self::ENDS, self::GROUP_ID, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::SCHEDULE_GROUP_PLAYED, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'STARTS', 'ENDS', 'GROUP_ID', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'SCHEDULE_GROUP_PLAYED', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'starts', 'ends', 'group_id', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'schedule_group_played', 'media_item_played', 'instance_id', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -104,12 +95,12 @@ abstract class BaseCcSchedulePeer {
|
|||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbGroupId' => 4, 'DbFileId' => 5, 'DbClipLength' => 6, 'DbFadeIn' => 7, 'DbFadeOut' => 8, 'DbCueIn' => 9, 'DbCueOut' => 10, 'DbScheduleGroupPlayed' => 11, 'DbMediaItemPlayed' => 12, 'DbInstanceId' => 13, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbGroupId' => 4, 'dbFileId' => 5, 'dbClipLength' => 6, 'dbFadeIn' => 7, 'dbFadeOut' => 8, 'dbCueIn' => 9, 'dbCueOut' => 10, 'dbScheduleGroupPlayed' => 11, 'dbMediaItemPlayed' => 12, 'dbInstanceId' => 13, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::STARTS => 2, self::ENDS => 3, self::GROUP_ID => 4, self::FILE_ID => 5, self::CLIP_LENGTH => 6, self::FADE_IN => 7, self::FADE_OUT => 8, self::CUE_IN => 9, self::CUE_OUT => 10, self::SCHEDULE_GROUP_PLAYED => 11, self::MEDIA_ITEM_PLAYED => 12, self::INSTANCE_ID => 13, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, 'GROUP_ID' => 4, 'FILE_ID' => 5, 'CLIP_LENGTH' => 6, 'FADE_IN' => 7, 'FADE_OUT' => 8, 'CUE_IN' => 9, 'CUE_OUT' => 10, 'SCHEDULE_GROUP_PLAYED' => 11, 'MEDIA_ITEM_PLAYED' => 12, 'INSTANCE_ID' => 13, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'starts' => 2, 'ends' => 3, 'group_id' => 4, 'file_id' => 5, 'clip_length' => 6, 'fade_in' => 7, 'fade_out' => 8, 'cue_in' => 9, 'cue_out' => 10, 'schedule_group_played' => 11, 'media_item_played' => 12, 'instance_id' => 13, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbClipLength' => 4, 'DbFadeIn' => 5, 'DbFadeOut' => 6, 'DbCueIn' => 7, 'DbCueOut' => 8, 'DbMediaItemPlayed' => 9, 'DbInstanceId' => 10, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbClipLength' => 4, 'dbFadeIn' => 5, 'dbFadeOut' => 6, 'dbCueIn' => 7, 'dbCueOut' => 8, 'dbMediaItemPlayed' => 9, 'dbInstanceId' => 10, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::CLIP_LENGTH => 4, self::FADE_IN => 5, self::FADE_OUT => 6, self::CUE_IN => 7, self::CUE_OUT => 8, self::MEDIA_ITEM_PLAYED => 9, self::INSTANCE_ID => 10, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'CLIP_LENGTH' => 4, 'FADE_IN' => 5, 'FADE_OUT' => 6, 'CUE_IN' => 7, 'CUE_OUT' => 8, 'MEDIA_ITEM_PLAYED' => 9, 'INSTANCE_ID' => 10, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'clip_length' => 4, 'fade_in' => 5, 'fade_out' => 6, 'cue_in' => 7, 'cue_out' => 8, 'media_item_played' => 9, 'instance_id' => 10, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -182,32 +173,26 @@ abstract class BaseCcSchedulePeer {
|
|||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(CcSchedulePeer::ID);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::PLAYLIST_ID);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::STARTS);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::ENDS);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::GROUP_ID);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::FILE_ID);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::CLIP_LENGTH);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::FADE_IN);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::FADE_OUT);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::CUE_IN);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::CUE_OUT);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::SCHEDULE_GROUP_PLAYED);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::MEDIA_ITEM_PLAYED);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.PLAYLIST_ID');
|
||||
$criteria->addSelectColumn($alias . '.STARTS');
|
||||
$criteria->addSelectColumn($alias . '.ENDS');
|
||||
$criteria->addSelectColumn($alias . '.GROUP_ID');
|
||||
$criteria->addSelectColumn($alias . '.FILE_ID');
|
||||
$criteria->addSelectColumn($alias . '.CLIP_LENGTH');
|
||||
$criteria->addSelectColumn($alias . '.FADE_IN');
|
||||
$criteria->addSelectColumn($alias . '.FADE_OUT');
|
||||
$criteria->addSelectColumn($alias . '.CUE_IN');
|
||||
$criteria->addSelectColumn($alias . '.CUE_OUT');
|
||||
$criteria->addSelectColumn($alias . '.SCHEDULE_GROUP_PLAYED');
|
||||
$criteria->addSelectColumn($alias . '.MEDIA_ITEM_PLAYED');
|
||||
$criteria->addSelectColumn($alias . '.INSTANCE_ID');
|
||||
}
|
||||
|
|
|
@ -7,32 +7,26 @@
|
|||
*
|
||||
*
|
||||
* @method CcScheduleQuery orderByDbId($order = Criteria::ASC) Order by the id column
|
||||
* @method CcScheduleQuery orderByDbPlaylistId($order = Criteria::ASC) Order by the playlist_id column
|
||||
* @method CcScheduleQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column
|
||||
* @method CcScheduleQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column
|
||||
* @method CcScheduleQuery orderByDbGroupId($order = Criteria::ASC) Order by the group_id column
|
||||
* @method CcScheduleQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
|
||||
* @method CcScheduleQuery orderByDbClipLength($order = Criteria::ASC) Order by the clip_length column
|
||||
* @method CcScheduleQuery orderByDbFadeIn($order = Criteria::ASC) Order by the fade_in column
|
||||
* @method CcScheduleQuery orderByDbFadeOut($order = Criteria::ASC) Order by the fade_out column
|
||||
* @method CcScheduleQuery orderByDbCueIn($order = Criteria::ASC) Order by the cue_in column
|
||||
* @method CcScheduleQuery orderByDbCueOut($order = Criteria::ASC) Order by the cue_out column
|
||||
* @method CcScheduleQuery orderByDbScheduleGroupPlayed($order = Criteria::ASC) Order by the schedule_group_played column
|
||||
* @method CcScheduleQuery orderByDbMediaItemPlayed($order = Criteria::ASC) Order by the media_item_played column
|
||||
* @method CcScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
|
||||
*
|
||||
* @method CcScheduleQuery groupByDbId() Group by the id column
|
||||
* @method CcScheduleQuery groupByDbPlaylistId() Group by the playlist_id column
|
||||
* @method CcScheduleQuery groupByDbStarts() Group by the starts column
|
||||
* @method CcScheduleQuery groupByDbEnds() Group by the ends column
|
||||
* @method CcScheduleQuery groupByDbGroupId() Group by the group_id column
|
||||
* @method CcScheduleQuery groupByDbFileId() Group by the file_id column
|
||||
* @method CcScheduleQuery groupByDbClipLength() Group by the clip_length column
|
||||
* @method CcScheduleQuery groupByDbFadeIn() Group by the fade_in column
|
||||
* @method CcScheduleQuery groupByDbFadeOut() Group by the fade_out column
|
||||
* @method CcScheduleQuery groupByDbCueIn() Group by the cue_in column
|
||||
* @method CcScheduleQuery groupByDbCueOut() Group by the cue_out column
|
||||
* @method CcScheduleQuery groupByDbScheduleGroupPlayed() Group by the schedule_group_played column
|
||||
* @method CcScheduleQuery groupByDbMediaItemPlayed() Group by the media_item_played column
|
||||
* @method CcScheduleQuery groupByDbInstanceId() Group by the instance_id column
|
||||
*
|
||||
|
@ -52,32 +46,26 @@
|
|||
* @method CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method CcSchedule findOneByDbId(int $id) Return the first CcSchedule filtered by the id column
|
||||
* @method CcSchedule findOneByDbPlaylistId(int $playlist_id) Return the first CcSchedule filtered by the playlist_id column
|
||||
* @method CcSchedule findOneByDbStarts(string $starts) Return the first CcSchedule filtered by the starts column
|
||||
* @method CcSchedule findOneByDbEnds(string $ends) Return the first CcSchedule filtered by the ends column
|
||||
* @method CcSchedule findOneByDbGroupId(int $group_id) Return the first CcSchedule filtered by the group_id column
|
||||
* @method CcSchedule findOneByDbFileId(int $file_id) Return the first CcSchedule filtered by the file_id column
|
||||
* @method CcSchedule findOneByDbClipLength(string $clip_length) Return the first CcSchedule filtered by the clip_length column
|
||||
* @method CcSchedule findOneByDbFadeIn(string $fade_in) Return the first CcSchedule filtered by the fade_in column
|
||||
* @method CcSchedule findOneByDbFadeOut(string $fade_out) Return the first CcSchedule filtered by the fade_out column
|
||||
* @method CcSchedule findOneByDbCueIn(string $cue_in) Return the first CcSchedule filtered by the cue_in column
|
||||
* @method CcSchedule findOneByDbCueOut(string $cue_out) Return the first CcSchedule filtered by the cue_out column
|
||||
* @method CcSchedule findOneByDbScheduleGroupPlayed(boolean $schedule_group_played) Return the first CcSchedule filtered by the schedule_group_played column
|
||||
* @method CcSchedule findOneByDbMediaItemPlayed(boolean $media_item_played) Return the first CcSchedule filtered by the media_item_played column
|
||||
* @method CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column
|
||||
*
|
||||
* @method array findByDbId(int $id) Return CcSchedule objects filtered by the id column
|
||||
* @method array findByDbPlaylistId(int $playlist_id) Return CcSchedule objects filtered by the playlist_id column
|
||||
* @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column
|
||||
* @method array findByDbEnds(string $ends) Return CcSchedule objects filtered by the ends column
|
||||
* @method array findByDbGroupId(int $group_id) Return CcSchedule objects filtered by the group_id column
|
||||
* @method array findByDbFileId(int $file_id) Return CcSchedule objects filtered by the file_id column
|
||||
* @method array findByDbClipLength(string $clip_length) Return CcSchedule objects filtered by the clip_length column
|
||||
* @method array findByDbFadeIn(string $fade_in) Return CcSchedule objects filtered by the fade_in column
|
||||
* @method array findByDbFadeOut(string $fade_out) Return CcSchedule objects filtered by the fade_out column
|
||||
* @method array findByDbCueIn(string $cue_in) Return CcSchedule objects filtered by the cue_in column
|
||||
* @method array findByDbCueOut(string $cue_out) Return CcSchedule objects filtered by the cue_out column
|
||||
* @method array findByDbScheduleGroupPlayed(boolean $schedule_group_played) Return CcSchedule objects filtered by the schedule_group_played column
|
||||
* @method array findByDbMediaItemPlayed(boolean $media_item_played) Return CcSchedule objects filtered by the media_item_played column
|
||||
* @method array findByDbInstanceId(int $instance_id) Return CcSchedule objects filtered by the instance_id column
|
||||
*
|
||||
|
@ -206,37 +194,6 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
|
|||
return $this->addUsingAlias(CcSchedulePeer::ID, $dbId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the playlist_id column
|
||||
*
|
||||
* @param int|array $dbPlaylistId The value to use as filter.
|
||||
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcScheduleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbPlaylistId($dbPlaylistId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($dbPlaylistId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($dbPlaylistId['min'])) {
|
||||
$this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($dbPlaylistId['max'])) {
|
||||
$this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the starts column
|
||||
*
|
||||
|
@ -299,37 +256,6 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
|
|||
return $this->addUsingAlias(CcSchedulePeer::ENDS, $dbEnds, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the group_id column
|
||||
*
|
||||
* @param int|array $dbGroupId The value to use as filter.
|
||||
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcScheduleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbGroupId($dbGroupId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($dbGroupId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($dbGroupId['min'])) {
|
||||
$this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($dbGroupId['max'])) {
|
||||
$this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the file_id column
|
||||
*
|
||||
|
@ -516,23 +442,6 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
|
|||
return $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the schedule_group_played column
|
||||
*
|
||||
* @param boolean|string $dbScheduleGroupPlayed The value to use as filter.
|
||||
* Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcScheduleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbScheduleGroupPlayed($dbScheduleGroupPlayed = null, $comparison = null)
|
||||
{
|
||||
if (is_string($dbScheduleGroupPlayed)) {
|
||||
$schedule_group_played = in_array(strtolower($dbScheduleGroupPlayed), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
|
||||
}
|
||||
return $this->addUsingAlias(CcSchedulePeer::SCHEDULE_GROUP_PLAYED, $dbScheduleGroupPlayed, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the media_item_played column
|
||||
*
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
class BitrateFormatter {
|
||||
|
||||
/**
|
||||
* @string length
|
||||
*/
|
||||
private $_bitrate;
|
||||
|
||||
/*
|
||||
* @param string $bitrate (bits per second)
|
||||
*/
|
||||
public function __construct($bitrate)
|
||||
{
|
||||
$this->_bitrate = $bitrate;
|
||||
}
|
||||
|
||||
public function format()
|
||||
{
|
||||
$Kbps = bcdiv($this->_bitrate, 1000, 0);
|
||||
|
||||
return "{$Kbps} Kbps";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
class LengthFormatter {
|
||||
|
||||
/**
|
||||
* @string length
|
||||
*/
|
||||
private $_length;
|
||||
|
||||
/*
|
||||
* @param string $length formatted H:i:s.u (can be > 24 hours)
|
||||
*/
|
||||
public function __construct($length)
|
||||
{
|
||||
$this->_length = $length;
|
||||
}
|
||||
|
||||
public function format() {
|
||||
|
||||
$pieces = explode(":", $this->_length);
|
||||
|
||||
$seconds = round($pieces[2], 1);
|
||||
$seconds = number_format($seconds, 1);
|
||||
list($seconds, $milliStr) = explode(".", $seconds);
|
||||
|
||||
if (intval($pieces[0]) !== 0) {
|
||||
$hours = ltrim($pieces[0], "0");
|
||||
}
|
||||
|
||||
$minutes = $pieces[1];
|
||||
//length is less than 1 hour
|
||||
if (!isset($hours)) {
|
||||
|
||||
if (intval($minutes) !== 0) {
|
||||
$minutes = ltrim($minutes, "0");
|
||||
}
|
||||
//length is less than 1 minute
|
||||
else {
|
||||
unset($minutes);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($hours) && isset($minutes) && isset($seconds)) {
|
||||
$time = sprintf("%d:%02d:%02d.%s", $hours, $minutes, $seconds, $milliStr);
|
||||
}
|
||||
else if (isset($minutes) && isset($seconds)) {
|
||||
$time = sprintf("%d:%02d.%s", $minutes, $seconds, $milliStr);
|
||||
}
|
||||
else {
|
||||
$time = sprintf("%d.%s", $seconds, $milliStr);
|
||||
}
|
||||
|
||||
return $time;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
class SamplerateFormatter {
|
||||
|
||||
/**
|
||||
* @string sample rate
|
||||
*/
|
||||
private $_samplerate;
|
||||
|
||||
/*
|
||||
* @param string $samplerate Hz
|
||||
*/
|
||||
public function __construct($samplerate)
|
||||
{
|
||||
$this->_samplerate = $samplerate;
|
||||
}
|
||||
|
||||
public function format()
|
||||
{
|
||||
$kHz = bcdiv($this->_samplerate, 1000, 1);
|
||||
|
||||
return "{$kHz} kHz";
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
<?php
|
||||
header ("location: html/");
|
||||
exit;
|
Loading…
Add table
Add a link
Reference in a new issue