mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-03-29 14:27:46 +01:00
Add file size addition during uploading
This commit is contained in:
parent
7fd13632eb
commit
f5987db735
1 changed files with 16 additions and 9 deletions
|
@ -143,18 +143,25 @@ class UploadTrackCommand extends CommandBase
|
||||||
}
|
}
|
||||||
$track->trackFiles()->save($trackFile);
|
$track->trackFiles()->save($trackFile);
|
||||||
|
|
||||||
if ($trackFile->is_cacheable == false) {
|
// Encode track file
|
||||||
$target = $destination . '/' . $trackFile->getFilename();
|
$target = $destination . '/' . $trackFile->getFilename();
|
||||||
|
|
||||||
$command = $format['command'];
|
$command = $format['command'];
|
||||||
$command = str_replace('{$source}', '"' . $source . '"', $command);
|
$command = str_replace('{$source}', '"' . $source . '"', $command);
|
||||||
$command = str_replace('{$target}', '"' . $target . '"', $command);
|
$command = str_replace('{$target}', '"' . $target . '"', $command);
|
||||||
|
|
||||||
Log::info('Encoding ' . $track->id . ' into ' . $target);
|
Log::info('Encoding ' . $track->id . ' into ' . $target);
|
||||||
$this->notify('Encoding ' . $name, $index / count(Track::$Formats) * 100);
|
$this->notify('Encoding ' . $name, $index / count(Track::$Formats) * 100);
|
||||||
|
|
||||||
$process = new Process($command);
|
$process = new Process($command);
|
||||||
$process->mustRun();
|
$process->mustRun();
|
||||||
|
|
||||||
|
// Update file size for track file
|
||||||
|
$trackFile->updateFilesize();
|
||||||
|
|
||||||
|
// Delete track file if it is cacheable
|
||||||
|
if ($trackFile->is_cacheable == true) {
|
||||||
|
\Illuminate\Support\Facades\File::delete($trackFile->getFile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue