Merge branch 'cc-1799-put-airtime-storage-into-a-human-readable-file-naming-convention' into devel
Conflicts: airtime_mvc/application/controllers/PreferenceController.php airtime_mvc/application/models/Preference.php airtime_mvc/application/views/scripts/form/preferences.phtml airtime_mvc/public/js/airtime/preferences/preferences.js
This commit is contained in:
commit
253eb811c7
42 changed files with 3966 additions and 499 deletions
|
@ -39,7 +39,6 @@ class StoredFile {
|
|||
"bit_rate" => "DbBitRate",
|
||||
"sample_rate" => "DbSampleRate",
|
||||
"mime" => "DbMime",
|
||||
"filepath" => "DbFilepath",
|
||||
"md5" => "DbMd5",
|
||||
"ftype" => "DbFtype"
|
||||
);
|
||||
|
@ -119,9 +118,11 @@ class StoredFile {
|
|||
if($dbColumn == "track_title" && (is_null($mdValue) || $mdValue == "")) {
|
||||
continue;
|
||||
}
|
||||
$propelColumn = $this->_dbMD[$dbColumn];
|
||||
$method = "set$propelColumn";
|
||||
$this->_file->$method($mdValue);
|
||||
if (isset($this->_dbMD[$dbColumn])) {
|
||||
$propelColumn = $this->_dbMD[$dbColumn];
|
||||
$method = "set$propelColumn";
|
||||
$this->_file->$method($mdValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,10 +156,12 @@ class StoredFile {
|
|||
if($p_category == "track_title" && (is_null($p_value) || $p_value == "")) {
|
||||
return;
|
||||
}
|
||||
$propelColumn = $this->_dbMD[$p_category];
|
||||
$method = "set$propelColumn";
|
||||
$this->_file->$method($p_value);
|
||||
$this->_file->save();
|
||||
if (isset($this->_dbMD[$dbColumn])) {
|
||||
$propelColumn = $this->_dbMD[$p_category];
|
||||
$method = "set$propelColumn";
|
||||
$this->_file->$method($p_value);
|
||||
$this->_file->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -409,7 +412,28 @@ class StoredFile {
|
|||
*/
|
||||
public function getFilePath()
|
||||
{
|
||||
return $this->_file->getDbFilepath();
|
||||
$music_dir = MusicDir::getDirByPK($this->_file->getDbDirectory());
|
||||
$filepath = $this->_file->getDbFilepath();
|
||||
|
||||
return $music_dir->getDirectory()."/".$filepath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set real filename of raw media data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function setFilePath($p_filepath)
|
||||
{
|
||||
$path_info = MusicDir::splitFilePath($p_filepath);
|
||||
if (is_null($path_info)) {
|
||||
return -1;
|
||||
}
|
||||
$musicDir = MusicDir::getDirByPath($path_info[0]);
|
||||
|
||||
$this->_file->setDbDirectory($musicDir->getId());
|
||||
$this->_file->setDbFilepath($path_info[1]);
|
||||
$this->_file->save();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -425,11 +449,20 @@ class StoredFile {
|
|||
{
|
||||
$file = new CcFiles();
|
||||
$file->setDbGunid(md5(uniqid("", true)));
|
||||
$file->save();
|
||||
|
||||
$storedFile = new StoredFile();
|
||||
$storedFile->_file = $file;
|
||||
|
||||
if(isset($md['MDATA_KEY_FILEPATH'])) {
|
||||
$res = $storedFile->setFilePath($md['MDATA_KEY_FILEPATH']);
|
||||
if ($res === -1) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(isset($md)) {
|
||||
$storedFile->setMetadata($md);
|
||||
}
|
||||
|
@ -467,8 +500,15 @@ class StoredFile {
|
|||
->findOne();
|
||||
}
|
||||
else if (isset($p_filepath)) {
|
||||
$path_info = MusicDir::splitFilePath($p_filepath);
|
||||
if (is_null($path_info)) {
|
||||
return null;
|
||||
}
|
||||
$musicDir = MusicDir::getDirByPath($path_info[0]);
|
||||
|
||||
$file = CcFilesQuery::create()
|
||||
->filterByDbFilepath($p_filepath)
|
||||
->filterByDbDirectory($music_dir->getId())
|
||||
->filterByDbFilepath($path_info[1])
|
||||
->findOne();
|
||||
}
|
||||
else {
|
||||
|
@ -766,8 +806,9 @@ class StoredFile {
|
|||
}
|
||||
else {
|
||||
|
||||
global $CC_CONFIG;
|
||||
$stor = $CC_CONFIG["storageDir"];
|
||||
$storDir = MusicDir::getStorDir();
|
||||
$stor = $storDir->getDirectory();
|
||||
|
||||
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
$md = array();
|
||||
|
@ -776,7 +817,6 @@ class StoredFile {
|
|||
$md['MDATA_KEY_TITLE'] = $fileName;
|
||||
|
||||
StoredFile::Insert($md);
|
||||
$r = @chmod($audio_file, 0666);
|
||||
$r = @rename($audio_file, $audio_stor);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue