CC-4090: Make code style PSR compliant - part 4
-models dir
This commit is contained in:
parent
699a49a103
commit
4848717d4d
17 changed files with 439 additions and 404 deletions
|
@ -259,6 +259,7 @@ EOT;
|
||||||
} else {
|
} else {
|
||||||
$length = $this->getDynamicBlockLength();
|
$length = $this->getDynamicBlockLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $length;
|
return $length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,6 +277,7 @@ EOT;
|
||||||
}
|
}
|
||||||
$formatter = new LengthFormatter($length);
|
$formatter = new LengthFormatter($length);
|
||||||
$length = $prepend.$formatter->format();
|
$length = $prepend.$formatter->format();
|
||||||
|
|
||||||
return $length;
|
return $length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,6 +306,7 @@ EOT;
|
||||||
$value = str_pad($value, 2, "0", STR_PAD_LEFT);
|
$value = str_pad($value, 2, "0", STR_PAD_LEFT);
|
||||||
$length = $hour.":".$value.":00";
|
$length = $hour.":".$value.":00";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $length;
|
return $length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,14 +316,17 @@ EOT;
|
||||||
->filterByDbCriteria('limit')->findOne();
|
->filterByDbCriteria('limit')->findOne();
|
||||||
$modifier = $result->getDbModifier();
|
$modifier = $result->getDbModifier();
|
||||||
$value = $result->getDbValue();
|
$value = $result->getDbValue();
|
||||||
|
|
||||||
return array($value, $modifier);
|
return array($value, $modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function returns sum of all track length under this block.
|
// this function returns sum of all track length under this block.
|
||||||
public function getStaticLength(){
|
public function getStaticLength()
|
||||||
|
{
|
||||||
$sql = "SELECT SUM(cliplength) as length FROM cc_blockcontents WHERE block_id={$this->id}";
|
$sql = "SELECT SUM(cliplength) as length FROM cc_blockcontents WHERE block_id={$this->id}";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
$result = $r->fetchAll(PDO::FETCH_NUM);
|
$result = $r->fetchAll(PDO::FETCH_NUM);
|
||||||
|
|
||||||
return $result[0][0];
|
return $result[0][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +369,8 @@ EOT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isStatic(){
|
public function isStatic()
|
||||||
|
{
|
||||||
if ($this->block->getDbType() == "static") {
|
if ($this->block->getDbType() == "static") {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -592,6 +599,7 @@ EOT;
|
||||||
#Propel returns values in form 00.000000 format which is for only seconds.
|
#Propel returns values in form 00.000000 format which is for only seconds.
|
||||||
$fadeIn = $row->getDbFadein();
|
$fadeIn = $row->getDbFadein();
|
||||||
$fadeOut = $row->getDbFadeout();
|
$fadeOut = $row->getDbFadeout();
|
||||||
|
|
||||||
return array($fadeIn, $fadeOut);
|
return array($fadeIn, $fadeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -914,6 +922,7 @@ EOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
$leftOvers = array_diff($selectedPls, $ownedPls);
|
$leftOvers = array_diff($selectedPls, $ownedPls);
|
||||||
|
|
||||||
return $leftOvers;
|
return $leftOvers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -927,7 +936,8 @@ EOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// smart block functions start
|
// smart block functions start
|
||||||
public function shuffleSmartBlock(){
|
public function shuffleSmartBlock()
|
||||||
|
{
|
||||||
// if it here that means it's static pl
|
// if it here that means it's static pl
|
||||||
$this->saveType("static");
|
$this->saveType("static");
|
||||||
$contents = CcBlockcontentsQuery::create()
|
$contents = CcBlockcontentsQuery::create()
|
||||||
|
@ -940,6 +950,7 @@ EOT;
|
||||||
$item->setDbPosition(array_shift($shuffledPos));
|
$item->setDbPosition(array_shift($shuffledPos));
|
||||||
$item->save();
|
$item->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
return array("result"=>0);
|
return array("result"=>0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1045,6 +1056,7 @@ EOT;
|
||||||
$this->addAudioClips(array_keys($insertList));
|
$this->addAudioClips(array_keys($insertList));
|
||||||
// update length in playlist contents.
|
// update length in playlist contents.
|
||||||
$this->updateBlockLengthInAllPlaylist();
|
$this->updateBlockLengthInAllPlaylist();
|
||||||
|
|
||||||
return array("result"=>0);
|
return array("result"=>0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1091,6 +1103,7 @@ EOT;
|
||||||
|
|
||||||
$iterator->next();
|
$iterator->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $insertList;
|
return $insertList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1254,6 +1267,7 @@ EOT;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
|
$out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
|
||||||
|
|
||||||
return array("files"=>$out, "limit"=>$limits, "count"=>$out->count());
|
return array("files"=>$out, "limit"=>$limits, "count"=>$out->count());
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Logging::info($e);
|
Logging::info($e);
|
||||||
|
|
|
@ -33,6 +33,7 @@ class Application_Model_Datatables
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode(" AND ", $where);
|
return implode(" AND ", $where);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -277,7 +277,8 @@ SQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true/false and ids of dynamic blocks
|
// returns true/false and ids of dynamic blocks
|
||||||
public function hasDynamicBlock(){
|
public function hasDynamicBlock()
|
||||||
|
{
|
||||||
$ids = $this->getIdsOfDynamicBlocks();
|
$ids = $this->getIdsOfDynamicBlocks();
|
||||||
if (count($ids) > 0) {
|
if (count($ids) > 0) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -286,12 +287,14 @@ SQL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIdsOfDynamicBlocks() {
|
public function getIdsOfDynamicBlocks()
|
||||||
|
{
|
||||||
$sql = "SELECT bl.id FROM cc_playlistcontents as pc
|
$sql = "SELECT bl.id FROM cc_playlistcontents as pc
|
||||||
JOIN cc_block as bl ON pc.type=2 AND pc.block_id=bl.id AND bl.type='dynamic'
|
JOIN cc_block as bl ON pc.type=2 AND pc.block_id=bl.id AND bl.type='dynamic'
|
||||||
WHERE playlist_id={$this->id} AND pc.type=2";
|
WHERE playlist_id={$this->id} AND pc.type=2";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
$result = $r->fetchAll(PDO::FETCH_ASSOC);
|
$result = $r->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,6 +311,7 @@ SQL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$formatter = new LengthFormatter($length);
|
$formatter = new LengthFormatter($length);
|
||||||
|
|
||||||
return "~".$formatter->format();
|
return "~".$formatter->format();
|
||||||
} else {
|
} else {
|
||||||
return $this->pl->getDbLength();
|
return $this->pl->getDbLength();
|
||||||
|
@ -369,6 +373,7 @@ SQL;
|
||||||
$entry["cueout"] = $obj->getDbLength();
|
$entry["cueout"] = $obj->getDbLength();
|
||||||
$entry["ftype"] = $objType;
|
$entry["ftype"] = $objType;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $entry;
|
return $entry;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("trying to add a object that does not exist.");
|
throw new Exception("trying to add a object that does not exist.");
|
||||||
|
@ -582,6 +587,7 @@ SQL;
|
||||||
#Propel returns values in form 00.000000 format which is for only seconds.
|
#Propel returns values in form 00.000000 format which is for only seconds.
|
||||||
$fadeIn = $row->getDbFadein();
|
$fadeIn = $row->getDbFadein();
|
||||||
$fadeOut = $row->getDbFadeout();
|
$fadeOut = $row->getDbFadeout();
|
||||||
|
|
||||||
return array($fadeIn, $fadeOut);
|
return array($fadeIn, $fadeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -891,7 +897,8 @@ SQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function returns that are not owen by $p_user_id among $p_ids
|
// This function returns that are not owen by $p_user_id among $p_ids
|
||||||
private static function playlistsNotOwnedByUser($p_ids, $p_userId){
|
private static function playlistsNotOwnedByUser($p_ids, $p_userId)
|
||||||
|
{
|
||||||
$ownedByUser = CcPlaylistQuery::create()->filterByDbCreatorId($p_userId)->find()->getData();
|
$ownedByUser = CcPlaylistQuery::create()->filterByDbCreatorId($p_userId)->find()->getData();
|
||||||
$selectedPls = $p_ids;
|
$selectedPls = $p_ids;
|
||||||
$ownedPls = array();
|
$ownedPls = array();
|
||||||
|
@ -902,6 +909,7 @@ SQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$leftOvers = array_diff($selectedPls, $ownedPls);
|
$leftOvers = array_diff($selectedPls, $ownedPls);
|
||||||
|
|
||||||
return $leftOvers;
|
return $leftOvers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1110,7 +1110,8 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCurrentLibraryTableSetting(){
|
public static function getCurrentLibraryTableSetting()
|
||||||
|
{
|
||||||
return unserialize(self::getValue("library_datatable"));
|
return unserialize(self::getValue("library_datatable"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ class Application_Model_Schedule
|
||||||
if (!is_int($p_prev) || !is_int($p_next)) {
|
if (!is_int($p_prev) || !is_int($p_next)) {
|
||||||
//must enter integers to specify ranges
|
//must enter integers to specify ranges
|
||||||
Logging::info("Invalid range parameters: $p_prev or $p_next");
|
Logging::info("Invalid range parameters: $p_prev or $p_next");
|
||||||
|
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +126,6 @@ class Application_Model_Schedule
|
||||||
$rows[$i]['ends'] = $rows[$i]["show_ends"];
|
$rows[$i]['ends'] = $rows[$i]["show_ends"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis) && (strtotime($rows[$i]['ends']) >= $timeNowAsMillis)) {
|
if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis) && (strtotime($rows[$i]['ends']) >= $timeNowAsMillis)) {
|
||||||
if ($i - 1 >= 0) {
|
if ($i - 1 >= 0) {
|
||||||
$results['previous'] = array("name"=>$rows[$i-1]["artist_name"]." - ".$rows[$i-1]["track_title"],
|
$results['previous'] = array("name"=>$rows[$i-1]["artist_name"]." - ".$rows[$i-1]["track_title"],
|
||||||
|
@ -192,7 +192,6 @@ class Application_Model_Schedule
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function GetCurrentScheduleItem($p_timeNow, $p_instanceId)
|
public static function GetCurrentScheduleItem($p_timeNow, $p_instanceId)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
@ -348,6 +347,7 @@ ORDER BY si_starts,
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1098,6 +1098,7 @@ SQL;
|
||||||
public static function GetFileId($p_scheduleId)
|
public static function GetFileId($p_scheduleId)
|
||||||
{
|
{
|
||||||
$scheduledItem = CcScheduleQuery::create()->findPK($p_scheduleId);
|
$scheduledItem = CcScheduleQuery::create()->findPK($p_scheduleId);
|
||||||
|
|
||||||
return $scheduledItem->getDbFileId();
|
return $scheduledItem->getDbFileId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,6 +252,7 @@ class Application_Model_Scheduler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $files;
|
return $files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ class Application_Model_ServiceRegister
|
||||||
} else {
|
} else {
|
||||||
$ip=$_SERVER['REMOTE_ADDR'];
|
$ip=$_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ip;
|
return $ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1583,6 +1583,7 @@ class Application_Model_Show
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $con->query($sql)->fetchAll();
|
$result = $con->query($sql)->fetchAll();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1806,6 +1807,7 @@ class Application_Model_Show
|
||||||
|
|
||||||
// Convert back to local timezone
|
// Convert back to local timezone
|
||||||
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1949,6 +1951,7 @@ class Application_Model_Show
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,8 +172,7 @@ class Application_Model_StoredFile
|
||||||
}
|
}
|
||||||
if ($owner) {
|
if ($owner) {
|
||||||
$this->_file->setDbOwnerId( $owner->getDbId() );
|
$this->_file->setDbOwnerId( $owner->getDbId() );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Logging::info("Could not find suitable owner for file
|
Logging::info("Could not find suitable owner for file
|
||||||
'".$p_md['MDATA_KEY_FILEPATH']."'");
|
'".$p_md['MDATA_KEY_FILEPATH']."'");
|
||||||
}
|
}
|
||||||
|
@ -415,6 +414,7 @@ class Application_Model_StoredFile
|
||||||
_file->getDbDirectory());
|
_file->getDbDirectory());
|
||||||
$directory = $music_dir->getDirectory();
|
$directory = $music_dir->getDirectory();
|
||||||
$filepath = $this->_file->getDbFilepath();
|
$filepath = $this->_file->getDbFilepath();
|
||||||
|
|
||||||
return Application_Common_OsPath::join($directory, $filepath);
|
return Application_Common_OsPath::join($directory, $filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,6 +515,7 @@ class Application_Model_StoredFile
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$storedFile->setMetadata($md);
|
$storedFile->setMetadata($md);
|
||||||
|
|
||||||
return $storedFile;
|
return $storedFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,6 +918,7 @@ class Application_Model_StoredFile
|
||||||
// Check if we have enough space before copying
|
// Check if we have enough space before copying
|
||||||
if (!self::isEnoughDiskSpaceToCopy($stor, $audio_file)) {
|
if (!self::isEnoughDiskSpaceToCopy($stor, $audio_file)) {
|
||||||
$freeSpace = disk_free_space($stor);
|
$freeSpace = disk_free_space($stor);
|
||||||
|
|
||||||
return array("code" => 107,
|
return array("code" => 107,
|
||||||
"message" => "The file was not uploaded, there is
|
"message" => "The file was not uploaded, there is
|
||||||
".$freeSpace."MB of disk space left and the file you are
|
".$freeSpace."MB of disk space left and the file you are
|
||||||
|
@ -958,6 +960,7 @@ class Application_Model_StoredFile
|
||||||
//warn the user that the file wasn't uploaded and they should check if there is enough disk space.
|
//warn the user that the file wasn't uploaded and they should check if there is enough disk space.
|
||||||
unlink($audio_file); //remove the file after failed rename
|
unlink($audio_file); //remove the file after failed rename
|
||||||
unlink($id_file); // Also remove the identifier file
|
unlink($id_file); // Also remove the identifier file
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
"code" => 108,
|
"code" => 108,
|
||||||
"message" => "
|
"message" => "
|
||||||
|
@ -1046,6 +1049,7 @@ class Application_Model_StoredFile
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = $con->query($sql, PDO::FETCH_ASSOC)->fetchAll();
|
$rows = $con->query($sql, PDO::FETCH_ASSOC)->fetchAll();
|
||||||
|
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ class Application_Model_User
|
||||||
public function isHostOfShow($showId)
|
public function isHostOfShow($showId)
|
||||||
{
|
{
|
||||||
$userId = $this->_userInstance->getDbId();
|
$userId = $this->_userInstance->getDbId();
|
||||||
|
|
||||||
return CcShowHostsQuery::create()
|
return CcShowHostsQuery::create()
|
||||||
->filterByDbShow($showId)
|
->filterByDbShow($showId)
|
||||||
->filterByDbHost($userId)->count() > 0;
|
->filterByDbHost($userId)->count() > 0;
|
||||||
|
@ -238,15 +239,19 @@ class Application_Model_User
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUsersOfType($type) {
|
public static function getUsersOfType($type)
|
||||||
|
{
|
||||||
return CcSubjsQuery::create()->filterByDbType($type)->find();
|
return CcSubjsQuery::create()->filterByDbType($type)->find();
|
||||||
}
|
}
|
||||||
public static function getFirstAdminId() {
|
public static function getFirstAdminId()
|
||||||
|
{
|
||||||
$admins = Application_Model_User::getUsersOfType('A');
|
$admins = Application_Model_User::getUsersOfType('A');
|
||||||
if (count($admins) > 0) { // found admin => pick first one
|
if (count($admins) > 0) { // found admin => pick first one
|
||||||
|
|
||||||
return $admins[0]->getDbId();
|
return $admins[0]->getDbId();
|
||||||
} else {
|
} else {
|
||||||
Logging::warn("Warning. no admins found in database");
|
Logging::warn("Warning. no admins found in database");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,6 +365,7 @@ class Application_Model_User
|
||||||
//we get here if $userinfo->id is defined, but doesn't exist
|
//we get here if $userinfo->id is defined, but doesn't exist
|
||||||
//in the database anymore.
|
//in the database anymore.
|
||||||
Zend_Auth::getInstance()->clearIdentity();
|
Zend_Auth::getInstance()->clearIdentity();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,10 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
if (count($arr) == 3) {
|
if (count($arr) == 3) {
|
||||||
list($hours, $min, $sec) = $arr;
|
list($hours, $min, $sec) = $arr;
|
||||||
$di = new DateInterval("PT{$hours}H{$min}M{$sec}S");
|
$di = new DateInterval("PT{$hours}H{$min}M{$sec}S");
|
||||||
|
|
||||||
return $di->format("%Hh %Im");
|
return $di->format("%Hh %Im");
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +71,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
$subjs = CcSubjsQuery::create()->findPK($this->webstream->getDbCreatorId());
|
$subjs = CcSubjsQuery::create()->findPK($this->webstream->getDbCreatorId());
|
||||||
|
|
||||||
$username = $subjs->getDbLogin();
|
$username = $subjs->getDbLogin();
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
"name" => $this->webstream->getDbName(),
|
"name" => $this->webstream->getDbName(),
|
||||||
"length" => $this->webstream->getDbLength(),
|
"length" => $this->webstream->getDbLength(),
|
||||||
|
@ -100,6 +103,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
}
|
}
|
||||||
|
|
||||||
$leftOvers = array_diff($p_ids, $ownedStreams);
|
$leftOvers = array_diff($p_ids, $ownedStreams);
|
||||||
|
|
||||||
return $leftOvers;
|
return $leftOvers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +128,6 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
$invalid_date_interval = true;
|
$invalid_date_interval = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!$invalid_date_interval) {
|
if (!$invalid_date_interval) {
|
||||||
|
|
||||||
//Due to the way our Regular Expression is set up, we could have $minutes or $hours
|
//Due to the way our Regular Expression is set up, we could have $minutes or $hours
|
||||||
|
@ -137,14 +139,12 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
$minutes = 0;
|
$minutes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//minutes cannot be over 59. Need to convert anything > 59 minutes into hours.
|
//minutes cannot be over 59. Need to convert anything > 59 minutes into hours.
|
||||||
$hours += intval($minutes/60);
|
$hours += intval($minutes/60);
|
||||||
$minutes = $minutes%60;
|
$minutes = $minutes%60;
|
||||||
|
|
||||||
$di = new DateInterval("PT{$hours}H{$minutes}M");
|
$di = new DateInterval("PT{$hours}H{$minutes}M");
|
||||||
|
|
||||||
|
|
||||||
$totalMinutes = $di->h * 60 + $di->i;
|
$totalMinutes = $di->h * 60 + $di->i;
|
||||||
|
|
||||||
if ($totalMinutes == 0) {
|
if ($totalMinutes == 0) {
|
||||||
|
@ -157,7 +157,6 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
$valid['length'][1] = 'Length should be of form "00h 00m"';
|
$valid['length'][1] = 'Length should be of form "00h 00m"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$url = $parameters["url"];
|
$url = $parameters["url"];
|
||||||
//simple validator that checks to make sure that the url starts with
|
//simple validator that checks to make sure that the url starts with
|
||||||
//http(s),
|
//http(s),
|
||||||
|
@ -215,11 +214,9 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function setName($name)
|
public function setName($name)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function getXspfUrl($url)
|
private static function getXspfUrl($url)
|
||||||
|
@ -319,7 +316,6 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return array($mime, $content_length_found);
|
return array($mime, $content_length_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class BitrateFormatter {
|
class BitrateFormatter
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @string length
|
* @string length
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class LengthFormatter {
|
class LengthFormatter
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @string length
|
* @string length
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,8 @@ class LengthFormatter {
|
||||||
$this->_length = $length;
|
$this->_length = $length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function format() {
|
public function format()
|
||||||
|
{
|
||||||
if (!preg_match("/^[0-9]{2}:[0-9]{2}:[0-9]{2}/", $this->_length)) {
|
if (!preg_match("/^[0-9]{2}:[0-9]{2}:[0-9]{2}/", $this->_length)) {
|
||||||
return $this->_length;
|
return $this->_length;
|
||||||
}
|
}
|
||||||
|
@ -45,11 +46,9 @@ class LengthFormatter {
|
||||||
|
|
||||||
if (isset($hours) && isset($minutes) && isset($seconds)) {
|
if (isset($hours) && isset($minutes) && isset($seconds)) {
|
||||||
$time = sprintf("%d:%02d:%02d.%s", $hours, $minutes, $seconds, $milliStr);
|
$time = sprintf("%d:%02d:%02d.%s", $hours, $minutes, $seconds, $milliStr);
|
||||||
}
|
} elseif (isset($minutes) && isset($seconds)) {
|
||||||
else if (isset($minutes) && isset($seconds)) {
|
|
||||||
$time = sprintf("%d:%02d.%s", $minutes, $seconds, $milliStr);
|
$time = sprintf("%d:%02d.%s", $minutes, $seconds, $milliStr);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$time = sprintf("%d.%s", $seconds, $milliStr);
|
$time = sprintf("%d.%s", $seconds, $milliStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class SamplerateFormatter {
|
class SamplerateFormatter
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @string sample rate
|
* @string sample rate
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class TimeFilledFormatter {
|
class TimeFilledFormatter
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @string seconds
|
* @string seconds
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue