<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Services\FfmpegService;
|
|
use App\Services\QueuedFfmpegService;
|
|
use Illuminate\Console\Command;
|
|
|
|
class QueueFfmpegCommand extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'queue:ffmpeg {opt} {path}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Command description';
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
$command = $this->argument("opt");
|
|
$path = $this->argument("path");
|
|
|
|
$queuedFfmpegService = new QueuedFfmpegService();
|
|
if ($command == "add") {
|
|
$queuedFfmpegService->processDir($path);
|
|
} else {
|
|
$queuedFfmpegService->setDestinationDirectory("/mnt/e/rec_encode/");
|
|
$queuedFfmpegService->processQueue();
|
|
// $ffmpeg = new FfmpegService();
|
|
// $ffmpeg->setNeedRemoveExistFiles(false);
|
|
// $ffmpeg->setNeedRemoveAfterEncode(true);
|
|
// $ffmpeg->processDirWithQueue($path, "file_to_encode");
|
|
}
|
|
}
|
|
}
|