Photo scan and move implemented, and remove redundant files

This commit is contained in:
2024-09-02 22:51:19 +10:00
parent 431ceec69f
commit a3013078e0
13 changed files with 131 additions and 479 deletions

View File

@@ -2,13 +2,11 @@
namespace App\Providers;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\Bus\DispatchesJobs;
use App\Models\{Photo,Video};
use App\Jobs\{PhotoMove,VideoMove};
class AppServiceProvider extends ServiceProvider
{
@@ -32,23 +30,6 @@ class AppServiceProvider extends ServiceProvider
public function boot(): void
{
Route::model('po',Photo::class);
// Any photo saved, queue it to be moved.
Photo::saved(function($photo) {
if ($photo->scanned && (! $photo->duplicate) && (! $photo->remove) && ($x=$photo->moveable()) === TRUE) {
Log::info(sprintf('%s: Need to Move [%s]',__METHOD__,$photo->id.'|'.serialize($x)));
PhotoMove::dispatch($photo)->onQueue('move');
}
});
// Any video saved, queue it to be moved.
Video::saved(function($video) {
if ($video->scanned AND ! $video->duplicate AND ! $video->remove AND ($x=$video->moveable()) === TRUE) {
Log::info(sprintf('%s: Need to Move [%s]',__METHOD__,$video->id.'|'.serialize($x)));
$this->dispatch((new VideoMove($video))->onQueue('move'));
}
});
Route::model('vo',Video::class);
}
}