Minor fixes

This commit is contained in:
Deon George 2019-12-27 13:32:42 +11:00
parent 8c453d7b0e
commit fe155525a3
6 changed files with 23 additions and 10 deletions

View File

@ -45,8 +45,9 @@ class CatalogMove extends Command
continue; continue;
} }
$x = NULL;
if (! $o->scanned OR $o->duplicate OR $o->remove OR ($x=$o->moveable()) !== TRUE) { if (! $o->scanned OR $o->duplicate OR $o->remove OR ($x=$o->moveable()) !== TRUE) {
$this->warn(sprintf('Ignoring [%s]...',$o->file_path())); $this->warn(sprintf('Ignoring (%s)[%s]... [%s]',$o->id,$o->file_path(),$x));
continue; continue;
} }

View File

@ -48,7 +48,7 @@ class CatalogScan extends Command
$o->setThumbnail(); $o->setThumbnail();
// If this is a duplicate // If this is a duplicate
$x = $class::whereIN('id',$o->list_duplicate())->get(); $x = $o->duplicates()->get();
if (count($x)) { if (count($x)) {
foreach ($x as $oo) { foreach ($x as $oo) {
// And that photo is not marked as a duplicate // And that photo is not marked as a duplicate

View File

@ -49,6 +49,11 @@ class VideoController extends Controller
if ($o->remove AND $request->input('remove.'.$id)) if ($o->remove AND $request->input('remove.'.$id))
$this->dispatch((new VideoDelete($o))->onQueue('delete')); $this->dispatch((new VideoDelete($o))->onQueue('delete'));
elseif (! $o->remove) {
$o->remove = TRUE;
$o->save();
}
} }
return redirect()->action('VideoController@deletes',$request->input('pagenext') ? '?page='.$request->input('pagenext') : NULL); return redirect()->action('VideoController@deletes',$request->input('pagenext') ? '?page='.$request->input('pagenext') : NULL);

View File

@ -263,6 +263,7 @@ abstract class Catalog extends Model
/** /**
* Return the object type * Return the object type
* @return string * @return string
* @deprecated Use objecttype()
*/ */
public function getTypeAttribute(): string public function getTypeAttribute(): string
{ {

View File

@ -181,13 +181,16 @@ class Photo extends Abstracted\Catalog
public function setMakeModel() public function setMakeModel()
{ {
$ma = Make::firstOrCreate([ $ma = NULL;
'name'=>$this->property('exif:Make') ?: NULL,
]); if ($this->property('exif:Make'))
$ma = Make::firstOrCreate([
'name'=>$this->property('exif:Make'),
]);
$mo = Model::firstOrCreate([ $mo = Model::firstOrCreate([
'name'=>$this->property('exif:Model') ?: NULL, 'name'=>$this->property('exif:Model') ?: NULL,
'make_id'=>$ma->id, 'make_id'=>$ma ? $ma->id : NULL,
]); ]);
$so = Software::firstOrCreate([ $so = Software::firstOrCreate([

View File

@ -143,13 +143,16 @@ class Video extends Abstracted\Catalog
public function setMakeModel() public function setMakeModel()
{ {
$ma = Make::firstOrCreate([ $ma = NULL;
'name'=>$this->property('make') ?: NULL,
]); if ($this->property('make'))
$ma = Make::firstOrCreate([
'name'=>$this->property('make'),
]);
$mo = Model::firstOrCreate([ $mo = Model::firstOrCreate([
'name'=>$this->property('model') ?: NULL, 'name'=>$this->property('model') ?: NULL,
'make_id'=>$ma->id, 'make_id'=>$ma ? $ma->id : NULL,
]); ]);
$so = Software::firstOrCreate([ $so = Software::firstOrCreate([