CC-3975: Media Library: Try to download files from watched folder, the filename will be "true"
-fixed
This commit is contained in:
parent
b0e93005e5
commit
186b8ef1c2
|
@ -125,11 +125,18 @@ class ApiController extends Zend_Controller_Action
|
||||||
$media = Application_Model_StoredFile::RecallByGunid($file_id);
|
$media = Application_Model_StoredFile::RecallByGunid($file_id);
|
||||||
if ( $media != null )
|
if ( $media != null )
|
||||||
{
|
{
|
||||||
|
$dir = Application_Model_MusicDir::getDirByPK($media->getDirectory());
|
||||||
|
|
||||||
$filepath = $media->getFilePath();
|
$filepath = $media->getFilePath();
|
||||||
if(is_file($filepath)){
|
if(is_file($filepath)){
|
||||||
$full_path = $media->getPropelOrm()->getDbFilepath();
|
$full_path = $media->getPropelOrm()->getDbFilepath();
|
||||||
$file_base_name = strrchr($full_path, '/');
|
|
||||||
$file_base_name = substr($file_base_name, 1);
|
if (strcmp($dir->getType(), 'watched') != 0) {
|
||||||
|
$file_base_name = strrchr($full_path, '/');
|
||||||
|
$file_base_name = substr($file_base_name, 1);
|
||||||
|
} else {
|
||||||
|
$file_base_name = $full_path;
|
||||||
|
}
|
||||||
// possibly use fileinfo module here in the future.
|
// possibly use fileinfo module here in the future.
|
||||||
// http://www.php.net/manual/en/book.fileinfo.php
|
// http://www.php.net/manual/en/book.fileinfo.php
|
||||||
$ext = pathinfo($fileID, PATHINFO_EXTENSION);
|
$ext = pathinfo($fileID, PATHINFO_EXTENSION);
|
||||||
|
|
|
@ -391,7 +391,7 @@ class Application_Model_StoredFile {
|
||||||
|
|
||||||
return $directory.$filepath;
|
return $directory.$filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set real filename of raw media data
|
* Set real filename of raw media data
|
||||||
*
|
*
|
||||||
|
@ -887,8 +887,9 @@ Logging::log("getting media! - 2");
|
||||||
|
|
||||||
// Check if file is playable
|
// Check if file is playable
|
||||||
$command = sprintf("/usr/bin/airtime-liquidsoap -c 'output.dummy(audio_to_stereo(single(\"%s\")))' 2>&1", $audio_file);
|
$command = sprintf("/usr/bin/airtime-liquidsoap -c 'output.dummy(audio_to_stereo(single(\"%s\")))' 2>&1", $audio_file);
|
||||||
|
|
||||||
exec($command, $output, $rv);
|
exec($command, $output, $rv);
|
||||||
if ($rv != 0 || count($output) != 0) {
|
if ($rv != 0 || $output[0] == 'TagLib: MPEG::Properties::read() -- Could not find a valid last MPEG frame in the stream.') {
|
||||||
$result = array("code" => 110, "message" => "This file appears to be corrupted and will not be added to media library.");
|
$result = array("code" => 110, "message" => "This file appears to be corrupted and will not be added to media library.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1011,6 +1012,10 @@ Logging::log("getting media! - 2");
|
||||||
public function getSoundCloudErrorMsg(){
|
public function getSoundCloudErrorMsg(){
|
||||||
return $this->_file->getDbSoundCloudErrorMsg();
|
return $this->_file->getDbSoundCloudErrorMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDirectory(){
|
||||||
|
return $this->_file->getDbDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
public function setFileExistsFlag($flag){
|
public function setFileExistsFlag($flag){
|
||||||
$this->_file->setDbFileExists($flag)
|
$this->_file->setDbFileExists($flag)
|
||||||
|
|
Loading…
Reference in New Issue