mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 04:58:01 +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);
|
||||
|
||||
if ($trackFile->is_cacheable == false) {
|
||||
$target = $destination . '/' . $trackFile->getFilename();
|
||||
// Encode track file
|
||||
$target = $destination . '/' . $trackFile->getFilename();
|
||||
|
||||
$command = $format['command'];
|
||||
$command = str_replace('{$source}', '"' . $source . '"', $command);
|
||||
$command = str_replace('{$target}', '"' . $target . '"', $command);
|
||||
$command = $format['command'];
|
||||
$command = str_replace('{$source}', '"' . $source . '"', $command);
|
||||
$command = str_replace('{$target}', '"' . $target . '"', $command);
|
||||
|
||||
Log::info('Encoding ' . $track->id . ' into ' . $target);
|
||||
$this->notify('Encoding ' . $name, $index / count(Track::$Formats) * 100);
|
||||
Log::info('Encoding ' . $track->id . ' into ' . $target);
|
||||
$this->notify('Encoding ' . $name, $index / count(Track::$Formats) * 100);
|
||||
|
||||
$process = new Process($command);
|
||||
$process->mustRun();
|
||||
$process = new Process($command);
|
||||
$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…
Reference in a new issue