Simplified the FTP upload hook

This commit is contained in:
Albert Santoni 2015-03-06 11:06:17 -05:00
parent e9adf1a7ed
commit 6cecb7c239
2 changed files with 4 additions and 14 deletions

View File

@ -90,19 +90,9 @@ class CcFiles extends BaseCcFiles {
* files won't get removed from the organize folder.
*/
//Extract the relative path to the temporary uploaded file on disk.
if (isset($fileArray["full_path"])) {
$fullPath = $fileArray["full_path"];
$basePath = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."/srv/airtime/stor/organize/" : "/srv/airtime/stor/organize/";
//$relativePath is the folder name(if one) + track name, that was uploaded via ftp
$filePathRelativeToOrganize = substr($fullPath, strlen($basePath)-1);
$originalFilename = $filePathRelativeToOrganize;
} else {
//Extract the original filename, which we set as the temporary title for the track
//until it's finished being processed by the analyzer.
$originalFilename = $_FILES["file"]["name"];
}
//Extract the original filename, which we set as the temporary title for the track
//until it's finished being processed by the analyzer.
$originalFilename = $_FILES["file"]["name"];
$tempFilePath = $_FILES['file']['tmp_name'];
try {

View File

@ -35,7 +35,7 @@ post_file() {
# -f is needed to make curl fail if there's an HTTP error code
# -L is needed to follow redirects! (just in case)
until curl -fL --max-time 30 $url -u $api_key":" -X POST -F "file=@${file_path}" -F "full_path=${file_path}"
until curl -fL --max-time 30 $url -u $api_key":" -X POST -F "file=@${file_path}"
do
retry_count=$[$retry_count+1]
if [ $retry_count -ge $max_retry ]; then