cleanup of function names
This commit is contained in:
parent
923f4ee180
commit
fd78ad29bf
|
@ -113,7 +113,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
$fileId = $this->_getParam("file");
|
$fileId = $this->_getParam("file");
|
||||||
|
|
||||||
$media = Application_Model_StoredFile::Recall($fileId);
|
$media = Application_Model_StoredFile::RecallById($fileId);
|
||||||
if ($media != null) {
|
if ($media != null) {
|
||||||
|
|
||||||
$filepath = $media->getFilePath();
|
$filepath = $media->getFilePath();
|
||||||
|
@ -387,7 +387,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$file_id = Application_Model_Schedule::GetFileId($media_id);
|
$file_id = Application_Model_Schedule::GetFileId($media_id);
|
||||||
if (!is_null($file_id)) {
|
if (!is_null($file_id)) {
|
||||||
//we are dealing with a file not a stream
|
//we are dealing with a file not a stream
|
||||||
$file = Application_Model_StoredFile::Recall($file_id);
|
$file = Application_Model_StoredFile::RecallById($file_id);
|
||||||
$now = new DateTime("now", new DateTimeZone("UTC"));
|
$now = new DateTime("now", new DateTimeZone("UTC"));
|
||||||
$file->setLastPlayedTime($now);
|
$file->setLastPlayedTime($now);
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
public function uploadRecordedActionParam($show_instance_id, $file_id)
|
public function uploadRecordedActionParam($show_instance_id, $file_id)
|
||||||
{
|
{
|
||||||
$showCanceled = false;
|
$showCanceled = false;
|
||||||
$file = Application_Model_StoredFile::Recall($file_id);
|
$file = Application_Model_StoredFile::RecallById($file_id);
|
||||||
//$show_instance = $this->_getParam('show_instance');
|
//$show_instance = $this->_getParam('show_instance');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -979,7 +979,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
foreach ($data as $pair) {
|
foreach ($data as $pair) {
|
||||||
list($id, $gain) = $pair;
|
list($id, $gain) = $pair;
|
||||||
// TODO : move this code into model -- RG
|
// TODO : move this code into model -- RG
|
||||||
$file = Application_Model_StoredFile::Recall($p_id = $id)->getPropelOrm();
|
$file = Application_Model_StoredFile::RecallById($p_id = $id)->getPropelOrm();
|
||||||
$file->setDbReplayGain($gain);
|
$file->setDbReplayGain($gain);
|
||||||
$file->save();
|
$file->save();
|
||||||
}
|
}
|
||||||
|
@ -1000,7 +1000,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
foreach ($data as $pair) {
|
foreach ($data as $pair) {
|
||||||
list($id, $info) = $pair;
|
list($id, $info) = $pair;
|
||||||
// TODO : move this code into model -- RG
|
// TODO : move this code into model -- RG
|
||||||
$file = Application_Model_StoredFile::Recall($p_id = $id)->getPropelOrm();
|
$file = Application_Model_StoredFile::RecallById($p_id = $id)->getPropelOrm();
|
||||||
|
|
||||||
//What we are doing here is setting a more accurate length that was
|
//What we are doing here is setting a more accurate length that was
|
||||||
//calculated with silan by actually scanning the entire file. This
|
//calculated with silan by actually scanning the entire file. This
|
||||||
|
|
|
@ -47,7 +47,7 @@ class AudiopreviewController extends Zend_Controller_Action
|
||||||
|
|
||||||
if ($type == "audioclip") {
|
if ($type == "audioclip") {
|
||||||
$uri = $baseUrl."api/get-media/file/".$audioFileID;
|
$uri = $baseUrl."api/get-media/file/".$audioFileID;
|
||||||
$media = Application_Model_StoredFile::Recall($audioFileID);
|
$media = Application_Model_StoredFile::RecallById($audioFileID);
|
||||||
$mime = $media->getPropelOrm()->getDbMime();
|
$mime = $media->getPropelOrm()->getDbMime();
|
||||||
} elseif ($type == "stream") {
|
} elseif ($type == "stream") {
|
||||||
$webstream = CcWebstreamQuery::create()->findPk($audioFileID);
|
$webstream = CcWebstreamQuery::create()->findPk($audioFileID);
|
||||||
|
|
|
@ -177,7 +177,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
if ($type === "audioclip") {
|
if ($type === "audioclip") {
|
||||||
|
|
||||||
$file = Application_Model_StoredFile::Recall($id);
|
$file = Application_Model_StoredFile::RecallById($id);
|
||||||
|
|
||||||
$menu["play"]["mime"] = $file->getPropelOrm()->getDbMime();
|
$menu["play"]["mime"] = $file->getPropelOrm()->getDbMime();
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
foreach ($files as $id) {
|
foreach ($files as $id) {
|
||||||
|
|
||||||
$file = Application_Model_StoredFile::Recall($id);
|
$file = Application_Model_StoredFile::RecallById($id);
|
||||||
|
|
||||||
if (isset($file)) {
|
if (isset($file)) {
|
||||||
try {
|
try {
|
||||||
|
@ -407,7 +407,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
$file_id = $this->_getParam('id', null);
|
$file_id = $this->_getParam('id', null);
|
||||||
$file = Application_Model_StoredFile::Recall($file_id);
|
$file = Application_Model_StoredFile::RecallById($file_id);
|
||||||
|
|
||||||
if (!$isAdminOrPM && $file->getFileOwnerId() != $user->getId()) {
|
if (!$isAdminOrPM && $file->getFileOwnerId() != $user->getId()) {
|
||||||
return;
|
return;
|
||||||
|
@ -449,7 +449,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($type == "audioclip") {
|
if ($type == "audioclip") {
|
||||||
$file = Application_Model_StoredFile::Recall($id);
|
$file = Application_Model_StoredFile::RecallById($id);
|
||||||
$this->view->type = $type;
|
$this->view->type = $type;
|
||||||
$md = $file->getMetadata();
|
$md = $file->getMetadata();
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$this->view->error_code = $file->getSoundCloudErrorCode();
|
$this->view->error_code = $file->getSoundCloudErrorCode();
|
||||||
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
||||||
} elseif ($type == "file") {
|
} elseif ($type == "file") {
|
||||||
$file = Application_Model_StoredFile::Recall($id);
|
$file = Application_Model_StoredFile::RecallById($id);
|
||||||
$this->view->sc_id = $file->getSoundCloudId();
|
$this->view->sc_id = $file->getSoundCloudId();
|
||||||
$this->view->error_code = $file->getSoundCloudErrorCode();
|
$this->view->error_code = $file->getSoundCloudErrorCode();
|
||||||
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
||||||
|
|
|
@ -931,7 +931,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
|
|
||||||
$file_id = $this->_getParam('id', null);
|
$file_id = $this->_getParam('id', null);
|
||||||
$file = Application_Model_StoredFile::Recall($file_id);
|
$file = Application_Model_StoredFile::RecallById($file_id);
|
||||||
|
|
||||||
$baseUrl = $this->getRequest()->getBaseUrl();
|
$baseUrl = $this->getRequest()->getBaseUrl();
|
||||||
$url = $file->getRelativeFileUrl($baseUrl).'download/true';
|
$url = $file->getRelativeFileUrl($baseUrl).'download/true';
|
||||||
|
|
|
@ -860,7 +860,7 @@ SQL;
|
||||||
if (!is_null($item['file_id'])) {
|
if (!is_null($item['file_id'])) {
|
||||||
//row is from "file"
|
//row is from "file"
|
||||||
$media_id = $item['file_id'];
|
$media_id = $item['file_id'];
|
||||||
$storedFile = Application_Model_StoredFile::Recall($media_id);
|
$storedFile = Application_Model_StoredFile::RecallById($media_id);
|
||||||
$uri = $storedFile->getFilePath();
|
$uri = $storedFile->getFilePath();
|
||||||
self::createFileScheduleEvent($data, $item, $media_id, $uri);
|
self::createFileScheduleEvent($data, $item, $media_id, $uri);
|
||||||
} elseif (!is_null($item['stream_id'])) {
|
} elseif (!is_null($item['stream_id'])) {
|
||||||
|
|
|
@ -202,8 +202,7 @@ class Application_Model_ShowBuilder
|
||||||
// at the time of creating on show, the recorded file is not in the DB yet.
|
// at the time of creating on show, the recorded file is not in the DB yet.
|
||||||
// therefore, 'si_file_id' is null. So we need to check it.
|
// therefore, 'si_file_id' is null. So we need to check it.
|
||||||
if (Application_Model_Preference::GetUploadToSoundcloudOption() && isset($p_item['si_file_id'])) {
|
if (Application_Model_Preference::GetUploadToSoundcloudOption() && isset($p_item['si_file_id'])) {
|
||||||
$file = Application_Model_StoredFile::Recall(
|
$file = Application_Model_StoredFile::RecallById($p_item['si_file_id']);
|
||||||
$p_item['si_file_id']);
|
|
||||||
if (isset($file)) {
|
if (isset($file)) {
|
||||||
$sid = $file->getSoundCloudId();
|
$sid = $file->getSoundCloudId();
|
||||||
$row['soundcloud_id'] = $sid;
|
$row['soundcloud_id'] = $sid;
|
||||||
|
|
|
@ -113,13 +113,13 @@ SQL;
|
||||||
|
|
||||||
public function setSoundCloudFileId($p_soundcloud_id)
|
public function setSoundCloudFileId($p_soundcloud_id)
|
||||||
{
|
{
|
||||||
$file = Application_Model_StoredFile::Recall($this->_showInstance->getDbRecordedFile());
|
$file = Application_Model_StoredFile::RecallById($this->_showInstance->getDbRecordedFile());
|
||||||
$file->setSoundCloudFileId($p_soundcloud_id);
|
$file->setSoundCloudFileId($p_soundcloud_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSoundCloudFileId()
|
public function getSoundCloudFileId()
|
||||||
{
|
{
|
||||||
$file = Application_Model_StoredFile::Recall($this->_showInstance->getDbRecordedFile());
|
$file = Application_Model_StoredFile::RecallById($this->_showInstance->getDbRecordedFile());
|
||||||
|
|
||||||
return $file->getSoundCloudId();
|
return $file->getSoundCloudId();
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ SQL;
|
||||||
$file_id = $this->_showInstance->getDbRecordedFile();
|
$file_id = $this->_showInstance->getDbRecordedFile();
|
||||||
|
|
||||||
if (isset($file_id)) {
|
if (isset($file_id)) {
|
||||||
$file = Application_Model_StoredFile::Recall($file_id);
|
$file = Application_Model_StoredFile::RecallById($file_id);
|
||||||
|
|
||||||
if (isset($file) && file_exists($file->getFilePath())) {
|
if (isset($file) && file_exists($file->getFilePath())) {
|
||||||
return $file;
|
return $file;
|
||||||
|
|
|
@ -343,7 +343,7 @@ SQL;
|
||||||
|
|
||||||
if (is_array($ids) && count($ids) > 0) {
|
if (is_array($ids) && count($ids) > 0) {
|
||||||
return array_map( function ($id) {
|
return array_map( function ($id) {
|
||||||
return Application_Model_Playlist::Recall($id);
|
return Application_Model_Playlist::RecallById($id);
|
||||||
}, $ids);
|
}, $ids);
|
||||||
} else {
|
} else {
|
||||||
return array();
|
return array();
|
||||||
|
@ -582,8 +582,7 @@ SQL;
|
||||||
return $storedFile;
|
return $storedFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function Recall($p_id=null, $p_gunid=null, $p_md5sum=null,
|
public static function RecallById($p_id=null, $con=null) {
|
||||||
$p_filepath=null, $con=null) {
|
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
if (is_null($con)) {
|
if (is_null($con)) {
|
||||||
|
@ -593,14 +592,8 @@ SQL;
|
||||||
if (isset($p_id)) {
|
if (isset($p_id)) {
|
||||||
$f = CcFilesQuery::create()->findPK(intval($p_id), $con);
|
$f = CcFilesQuery::create()->findPK(intval($p_id), $con);
|
||||||
return is_null($f) ? null : self::createWithFile($f, $con);
|
return is_null($f) ? null : self::createWithFile($f, $con);
|
||||||
} elseif ( isset($p_gunid) ) {
|
|
||||||
throw new Exception("You should never use gunid ($gunid) anymore");
|
|
||||||
} elseif ( isset($p_md5sum) ) {
|
|
||||||
throw new Exception("Searching by md5($p_md5sum) is disabled");
|
|
||||||
} elseif ( isset($p_filepath) ) {
|
|
||||||
return is_null($f) ? null : Application_Model_StoredFile::RecallByFilepath($p_filepath, $con);
|
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("No arguments passed to Recall");
|
throw new Exception("No arguments passed to RecallById");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,7 +816,7 @@ SQL;
|
||||||
$row['bit_rate'] = $formatter->format();
|
$row['bit_rate'] = $formatter->format();
|
||||||
|
|
||||||
//soundcloud status
|
//soundcloud status
|
||||||
$file = Application_Model_StoredFile::Recall($row['id']);
|
$file = Application_Model_StoredFile::RecallById($row['id']);
|
||||||
$row['soundcloud_status'] = $file->getSoundCloudId();
|
$row['soundcloud_status'] = $file->getSoundCloudId();
|
||||||
|
|
||||||
// for audio preview
|
// for audio preview
|
||||||
|
@ -1317,7 +1310,7 @@ SQL;
|
||||||
|
|
||||||
public static function setIsPlaylist($p_playlistItems, $p_type, $p_status) {
|
public static function setIsPlaylist($p_playlistItems, $p_type, $p_status) {
|
||||||
foreach ($p_playlistItems as $item) {
|
foreach ($p_playlistItems as $item) {
|
||||||
$file = self::Recall($item->getDbFileId());
|
$file = self::RecallById($item->getDbFileId());
|
||||||
$fileId = $file->_file->getDbId();
|
$fileId = $file->_file->getDbId();
|
||||||
if ($p_type == 'playlist') {
|
if ($p_type == 'playlist') {
|
||||||
// we have to check if the file is in another playlist before
|
// we have to check if the file is in another playlist before
|
||||||
|
@ -1339,7 +1332,7 @@ SQL;
|
||||||
} else {
|
} else {
|
||||||
$fileId = $p_fileId;
|
$fileId = $p_fileId;
|
||||||
}
|
}
|
||||||
$file = self::Recall($fileId);
|
$file = self::RecallById($fileId);
|
||||||
$updateIsScheduled = false;
|
$updateIsScheduled = false;
|
||||||
|
|
||||||
if (!is_null($fileId) && !in_array($fileId, Application_Model_Schedule::getAllFutureScheduledFiles())) {
|
if (!is_null($fileId) && !in_array($fileId, Application_Model_Schedule::getAllFutureScheduledFiles())) {
|
||||||
|
|
Loading…
Reference in New Issue