Change logging and saved() function for Video/Photo
This commit is contained in:
parent
59925f3af9
commit
f136360e5c
@ -51,7 +51,7 @@ class CatalogScan implements ShouldQueue, ShouldBeUnique
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
Log::info(sprintf('%s: Scanning [%s|%s]',__METHOD__,$this->o->objecttype(),$this->o->id));
|
Log::info(sprintf('Scanning [%s] (%d)',$this->o->file_name(FALSE),$this->o->id));
|
||||||
|
|
||||||
if (! $this->o->isReadable()) {
|
if (! $this->o->isReadable()) {
|
||||||
Log::alert(sprintf('Ignoring [%s], it is not readable',$this->o->file_name(FALSE)));
|
Log::alert(sprintf('Ignoring [%s], it is not readable',$this->o->file_name(FALSE)));
|
||||||
|
@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
use App\Casts\PostgresBytea;
|
use App\Casts\PostgresBytea;
|
||||||
|
use App\Jobs\CatalogMove;
|
||||||
use App\Models\{Make,Person,Software,Tag};
|
use App\Models\{Make,Person,Software,Tag};
|
||||||
|
|
||||||
abstract class Catalog extends Model
|
abstract class Catalog extends Model
|
||||||
@ -30,6 +31,21 @@ abstract class Catalog extends Model
|
|||||||
|
|
||||||
/* STATIC */
|
/* STATIC */
|
||||||
|
|
||||||
|
public static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
// Any video saved, queue it to be moved.
|
||||||
|
self::saved(function($item) {
|
||||||
|
if ($item->scanned && (! $item->duplicate) && (! $item->remove) && ($item->shouldMove() === TRUE)) {
|
||||||
|
Log::info(sprintf('Need to Move [%s] to [%s]',$item->file_name_rel(),$item->file_name_rel(FALSE)));
|
||||||
|
|
||||||
|
CatalogMove::dispatch($item)
|
||||||
|
->onQueue('move');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the prefix for the file path - dependant on the object
|
* Return the prefix for the file path - dependant on the object
|
||||||
*
|
*
|
||||||
|
@ -41,21 +41,6 @@ class Photo extends Abstracted\Catalog
|
|||||||
8 => -90,
|
8 => -90,
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function boot()
|
|
||||||
{
|
|
||||||
parent::boot();
|
|
||||||
|
|
||||||
// Any photo saved, queue it to be moved.
|
|
||||||
self::saved(function($item) {
|
|
||||||
if ($item->scanned && (! $item->duplicate) && (! $item->remove) && ($x=$item->shouldMove()) === TRUE) {
|
|
||||||
Log::info(sprintf('%s: Need to Move [%s]','Photo',$item->id.'|'.serialize($x)));
|
|
||||||
|
|
||||||
CatalogMove::dispatch($item)
|
|
||||||
->onQueue('move');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the GPS coordinates
|
* Calculate the GPS coordinates
|
||||||
*/
|
*/
|
||||||
|
@ -25,21 +25,6 @@ class Video extends Abstracted\Catalog
|
|||||||
'software',
|
'software',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function boot()
|
|
||||||
{
|
|
||||||
parent::boot();
|
|
||||||
|
|
||||||
// Any video saved, queue it to be moved.
|
|
||||||
self::saved(function($item) {
|
|
||||||
if ($item->scanned && (! $item->duplicate) && (! $item->remove) && ($x=$item->shouldMove()) === TRUE) {
|
|
||||||
Log::info(sprintf('%s: Need to Move [%s]',__METHOD__,$item->id.'|'.serialize($x)));
|
|
||||||
|
|
||||||
CatalogMove::dispatch($item)
|
|
||||||
->onQueue('move');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __get($key): mixed
|
public function __get($key): mixed
|
||||||
{
|
{
|
||||||
if ($key === 'o') {
|
if ($key === 'o') {
|
||||||
|
Loading…
Reference in New Issue
Block a user