Updated VideoMove
This commit is contained in:
53
app/Console/Commands/CatalogMove.php
Normal file
53
app/Console/Commands/CatalogMove.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
|
||||
use App\Jobs\VideoMove;
|
||||
|
||||
class CatalogMove extends Command
|
||||
{
|
||||
use DispatchesJobs;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'catalog:move {type : Photo | Video }';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Trigger Moves';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$class = 'App\Models\\'.$this->argument('type');
|
||||
|
||||
if (! class_exists($class))
|
||||
abort(500,sprintf('No class [%s]',$this->argument('type')));
|
||||
|
||||
foreach ($class::where('filename','LIKE','%INCOMING%')->get() as $o) {
|
||||
if ($o->scanned AND ! $o->duplicate AND ! $o->remove AND ($x=$o->moveable()) === TRUE) {
|
||||
$this->warn(sprintf('Ignoring [%s], it is not readable',$o->file_path()));
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (strtolower($this->argument('type'))) {
|
||||
case 'video':
|
||||
$this->dispatch((new VideoMove($o))->onQueue('move'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user