Fixes for catalog::scanall(), set subsectime to 0 instead of false

This commit is contained in:
Deon George 2020-01-03 08:21:55 +11:00
parent cf7c9317eb
commit 93364ab53a
2 changed files with 10 additions and 6 deletions

View File

@ -6,12 +6,12 @@ use Illuminate\Console\Command;
use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use App\Models\Photo;
use App\Jobs\CatalogScan; use App\Jobs\CatalogScan;
use App\Traits\Type;
class CatalogScanAll extends Command class CatalogScanAll extends Command
{ {
use DispatchesJobs; use DispatchesJobs,Type;
/** /**
* The name and signature of the console command. * The name and signature of the console command.
@ -49,19 +49,20 @@ class CatalogScanAll extends Command
$class = $this->getModelType($this->argument('type')); $class = $this->getModelType($this->argument('type'));
if ($this->option('scanned')) { if ($this->option('scanned')) {
$class::update(['scanned'=>NULL]); $class::whereNotNull('scanned')
->update(['scanned'=>NULL]);
} }
$class::NotScanned()->each(function ($item) { $c = 0;
$class::NotScanned()->each(function ($item) use ($c) {
if ($item->remove) { if ($item->remove) {
Log::warning(sprintf('Not scanning [%s], marked for removal',$item->id)); Log::warning(sprintf('Not scanning [%s], marked for removal',$item->id));
return; return;
} }
Log::info(sprintf('%s: Rescanning [%s]',$item->type,$item->id));
$this->dispatch((new CatalogScan($item))->onQueue('scan')); $this->dispatch((new CatalogScan($item))->onQueue('scan'));
}); });
Log::info(sprintf('Processed [%s]',$o->count())); Log::info(sprintf('Processed [%s]',$c));
} }
} }

View File

@ -215,6 +215,9 @@ class Photo extends Abstracted\Catalog
// In case of an error. // In case of an error.
if ($this->subsectime > 32767) if ($this->subsectime > 32767)
$this->subsectime = 32767; $this->subsectime = 32767;
if ($this->subsectime === FALSE)
$this->subsectime = 0;
} }
public function setThumbnail() public function setThumbnail()