Update VideoScanAll
This commit is contained in:
parent
c176ba9c94
commit
bcdbc1715e
@ -26,7 +26,7 @@ class PhotoScanAll extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Rescan Photos';
|
||||
protected $description = 'Scan Photos';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
|
@ -4,8 +4,9 @@ namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Log;
|
||||
use App\Model\Video;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Models\Video;
|
||||
use App\Jobs\CatalogScan;
|
||||
|
||||
class VideoScanAll extends Command
|
||||
@ -17,14 +18,15 @@ class VideoScanAll extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'video:scanall';
|
||||
protected $signature = 'video:scanall'.
|
||||
'{--scanned : Rescan Scanned Videos}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
protected $description = 'Scan Videos';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
@ -43,16 +45,18 @@ class VideoScanAll extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Video::NotScanned()->chunk(200,function ($data) {
|
||||
foreach ($data as $o)
|
||||
{
|
||||
if ($o->remove) {
|
||||
Log::warning(sprintf('Not scanning [%s], marked for removal',$o->id));
|
||||
continue;
|
||||
$o = ($this->option('scanned') ? Video::NotRemove() : Video::NotScanned());
|
||||
|
||||
$o->each(function ($item) {
|
||||
if ($item->remove) {
|
||||
Log::warning(sprintf('Not scanning [%s], marked for removal',$item->id));
|
||||
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