diff --git a/app/Console/Commands/CatalogScanAll.php b/app/Console/Commands/CatalogScanAll.php index 52e87fb..2daf5d2 100644 --- a/app/Console/Commands/CatalogScanAll.php +++ b/app/Console/Commands/CatalogScanAll.php @@ -6,12 +6,12 @@ use Illuminate\Console\Command; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Support\Facades\Log; -use App\Models\Photo; use App\Jobs\CatalogScan; +use App\Traits\Type; class CatalogScanAll extends Command { - use DispatchesJobs; + use DispatchesJobs,Type; /** * The name and signature of the console command. @@ -49,19 +49,20 @@ class CatalogScanAll extends Command $class = $this->getModelType($this->argument('type')); 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) { Log::warning(sprintf('Not scanning [%s], marked for removal',$item->id)); return; } - Log::info(sprintf('%s: Rescanning [%s]',$item->type,$item->id)); $this->dispatch((new CatalogScan($item))->onQueue('scan')); }); - Log::info(sprintf('Processed [%s]',$o->count())); + Log::info(sprintf('Processed [%s]',$c)); } } \ No newline at end of file diff --git a/app/Models/Photo.php b/app/Models/Photo.php index 1d2b849..527ec85 100644 --- a/app/Models/Photo.php +++ b/app/Models/Photo.php @@ -215,6 +215,9 @@ class Photo extends Abstracted\Catalog // In case of an error. if ($this->subsectime > 32767) $this->subsectime = 32767; + + if ($this->subsectime === FALSE) + $this->subsectime = 0; } public function setThumbnail()