Update VideoScanAll
This commit is contained in:
parent
c176ba9c94
commit
bcdbc1715e
@ -26,7 +26,7 @@ class PhotoScanAll extends Command
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $description = 'Rescan Photos';
|
protected $description = 'Scan Photos';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
|
@ -4,55 +4,59 @@ namespace App\Console\Commands;
|
|||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use App\Model\Video;
|
|
||||||
|
use App\Models\Video;
|
||||||
use App\Jobs\CatalogScan;
|
use App\Jobs\CatalogScan;
|
||||||
|
|
||||||
class VideoScanAll extends Command
|
class VideoScanAll extends Command
|
||||||
{
|
{
|
||||||
use DispatchesJobs;
|
use DispatchesJobs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name and signature of the console command.
|
* The name and signature of the console command.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'video:scanall';
|
protected $signature = 'video:scanall'.
|
||||||
|
'{--scanned : Rescan Scanned Videos}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $description = 'Command description';
|
protected $description = 'Scan Videos';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
Video::NotScanned()->chunk(200,function ($data) {
|
$o = ($this->option('scanned') ? Video::NotRemove() : Video::NotScanned());
|
||||||
foreach ($data as $o)
|
|
||||||
{
|
$o->each(function ($item) {
|
||||||
if ($o->remove) {
|
if ($item->remove) {
|
||||||
Log::warning(sprintf('Not scanning [%s], marked for removal',$o->id));
|
Log::warning(sprintf('Not scanning [%s], marked for removal',$item->id));
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->dispatch((new CatalogScan($o))->onQueue('scan'));
|
Log::info(sprintf('%s: Rescanning [%s]',__METHOD__,$item->id));
|
||||||
}
|
$this->dispatch((new CatalogScan($item))->onQueue('scan'));
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
Log::info(sprintf('Processed [%s]',$o->count()));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user