diff --git a/app/Console/Commands/CatalogScan.php b/app/Console/Commands/CatalogScan.php index 5fa9dc8..ada08f5 100644 --- a/app/Console/Commands/CatalogScan.php +++ b/app/Console/Commands/CatalogScan.php @@ -58,24 +58,20 @@ class CatalogScan extends Command $break = FALSE; foreach ($x as $oo) { - // If this photo siganture matches another. - if ($o->signature == $oo->signature) + // And that photo is not marked as a duplicate + if (! $oo->duplicate) { - // And that photo is not marked as a duplicate - if (! $oo->duplicate) + $o->duplicate = '1'; + $this->warn(sprintf('Image [%s] marked as a duplicate',$o->file_path())); + + // If the file signature also matches, we'll mark it for deletion + if ($oo->file_signature AND $o->file_signature == $oo->file_signature) { - $o->duplicate = '1'; - $this->warn(sprintf('Image [%s] marked as a duplicate',$o->file_path())); - - // If the file signature also matches, we'll mark it for deletion - if ($oo->file_signature AND $o->file_signature == $oo->file_signature) - { - $this->warn(sprintf('Image [%s] marked for deletion',$o->file_path())); - $o->remove = '1'; - } - - break; + $this->warn(sprintf('Image [%s] marked for deletion',$o->file_path())); + $o->remove = '1'; } + + break; } } } diff --git a/app/Console/Commands/VideoMove.php b/app/Console/Commands/VideoMove.php index 57b34a1..8908dbc 100644 --- a/app/Console/Commands/VideoMove.php +++ b/app/Console/Commands/VideoMove.php @@ -102,8 +102,11 @@ class VideoMove extends Command } else { - if ($x > 0) + if ($x > 0) { $this->warn(sprintf('Unable to move (%s) [%s] to [%s], moveable returned (%s)',$o->id,$o->file_path(),$o->file_path(FALSE,TRUE),$x)); + if ($x == 1 AND $v = Video::where('filename',$o->file_path(TRUE,TRUE))->first()) + $this->warn(sprintf('File is id (%s) [%s]',$v->file_path(),$v->id)); + } } } diff --git a/app/Http/Controllers/PhotoController.php b/app/Http/Controllers/PhotoController.php index 5ef2f3b..a1b61a0 100644 --- a/app/Http/Controllers/PhotoController.php +++ b/app/Http/Controllers/PhotoController.php @@ -36,7 +36,7 @@ class PhotoController extends Controller public function deletes($id=NULL) { - return view('catalog.deletereview',['return'=>url('/p/deletes'),'catalog'=>is_null($id) ? Photo::where('remove',1)->paginate(50) : Photo::where('id',$id)]); + return view('catalog.deletereview',['return'=>url('/p/deletes'),'catalog'=>is_null($id) ? Photo::where('remove',1)->paginate(50) : Photo::where('id',$id)->paginate(1)]); } public function deletesUpdate(Request $request) @@ -54,12 +54,12 @@ class PhotoController extends Controller public function duplicates($id=NULL) { - return view('photo.duplicates',['photos'=>is_null($id) ? Photo::notRemove()->where('duplicate',1)->paginate(1) : Photo::where('id',$id)->paginate(1)]); + return view('catalog.duplicatereview',['return'=>url('/p/duplicates'),'catalog'=>is_null($id) ? Photo::notRemove()->where('duplicate',1)->paginate(50) : Photo::where('id',$id)->paginate(1)]); } public function duplicatesUpdate(Request $request) { - foreach ($request->input('photo') as $id) + foreach ($request->input('items') as $id) { $po = Photo::findOrFail($id); diff --git a/app/Http/Controllers/VideoController.php b/app/Http/Controllers/VideoController.php index ffdd4ed..1c48f36 100644 --- a/app/Http/Controllers/VideoController.php +++ b/app/Http/Controllers/VideoController.php @@ -37,7 +37,7 @@ class VideoController extends Controller public function deletes($id=NULL) { - return view('catalog.deletereview',['return'=>url('v/deletes'),'catalog'=>is_null($id) ? Video::where('remove',1)->paginate(10) : Video::where('id',$id)->paginate(1)]); + return view('catalog.deletereview',['return'=>url('v/deletes'),'catalog'=>is_null($id) ? Video::where('remove',1)->paginate(50) : Video::where('id',$id)->paginate(1)]); } public function deletesUpdate(Request $request) @@ -55,12 +55,12 @@ class VideoController extends Controller public function duplicates($id=NULL) { - return view('video.duplicates',['videos'=>is_null($id) ? Video::notRemove()->where('duplicate',1)->paginate(1) : Video::where('id',$id)->paginate(1)]); + return view('catalog.duplicatereview',['return'=>url('/v/duplicates'),'catalog'=>is_null($id) ? Video::notRemove()->where('duplicate',1)->paginate(50) : Video::where('id',$id)->paginate(1)]); } public function duplicatesUpdate(Request $request) { - foreach ($request->input('video') as $id) + foreach ($request->input('items') as $id) { $po = Video::findOrFail($id); diff --git a/app/Model/Abstracted/Catalog.php b/app/Model/Abstracted/Catalog.php index 44ae42a..fe45f25 100644 --- a/app/Model/Abstracted/Catalog.php +++ b/app/Model/Abstracted/Catalog.php @@ -156,6 +156,22 @@ abstract class Catalog extends Model return $this->TextTrueFalse($this->flag); } + /** + * Return item dimensions + */ + public function getDimensionsAttribute() + { + return $this->width.'x'.$this->height; + } + + /** + * Return HTML Checkbox for duplicate + */ + public function getDuplicateCheckboxAttribute() + { + return $this->HTMLCheckbox('duplicate',$this->id,$this->duplicate); + } + /** * Return HTML Checkbox for flagged */ diff --git a/resources/views/catalog/duplicatereview.blade.php b/resources/views/catalog/duplicatereview.blade.php new file mode 100644 index 0000000..ec2f90f --- /dev/null +++ b/resources/views/catalog/duplicatereview.blade.php @@ -0,0 +1,82 @@ +@extends('layouts.app') + +['id','idlink'], + 'Signature'=>['signature','signature'], + 'File Signature'=>['file_signature','file_signature'], + 'Date Created'=>['date_created','datecreatedtext'], + 'Filename'=>['filename','filename'], + 'Filesize'=>['filesize','filesize'], + 'Dimensions'=>['height','dimensions'], + 'Duplicate'=>['duplicate','duplicatecheckbox'], + 'Flagged'=>['flag','flagcheckbox'], + 'Delete'=>['remove','removecheckbox'], +];?> + +@section('content') +
+
+
+
+
+ Review Duplicate Items +
+ +
{{ $catalog->links() }}
+ +
+ @if ($catalog->count()) +
+ + + + + + + @foreach ($catalog as $o) + + @php + $d=$o->list_duplicates(TRUE); $src=[]; + @endphp + + @foreach($d as $item) + + @if($src AND $item->id == $src->id) @continue @endif + @php($diff=collect($src)->diffAssoc($item)) + + @endforeach + + @endforeach +
SourceRemove
+ @if($d->where('duplicate',null)->count() > 1) + More than 1 source? + @elseif($d->count()) + @php($src = $d->first()) + {!! $src->view() !!} + + @foreach($data as $k=>$v) + + @endforeach +
{{$k}}{!! $src->{$v[1]} !!}
+ @endif +
+ {!! $item->view() !!} + + @foreach($data as $k=>$v) + + @endforeach +
{{$k}}{!! $item->{$v[1]} !!}
+
+ + + {{ csrf_field() }} +
+ @else + NONE! + @endif +
+
+
+
+
+@endsection diff --git a/resources/views/photo/duplicates.blade.php b/resources/views/photo/duplicates.blade.php deleted file mode 100644 index f18a92e..0000000 --- a/resources/views/photo/duplicates.blade.php +++ /dev/null @@ -1,100 +0,0 @@ -@extends('layouts.app') - -@section('content') -'id', - 'Thumbnail'=>'thumbnail', - 'Signature'=>'signature', - 'Date Taken'=>'datetaken', - 'File Created'=>'created', - 'File Modified'=>'modified', - 'Filename'=>'filepath', - 'Filesize'=>'filesize', - 'Width'=>'width', - 'Height'=>'height', - 'Orientation'=>'orientation', - 'Make'=>'make', - 'Model'=>'model', - 'Exif Diff'=>'exif', -]; - -$form = [ -'duplicate', -'flag', -'remove', -]; - -function changed($k,$v,$l=0) -{ - static $changed = []; - - if (! isset($changed[$l][$k])) - $changed[$l][$k] = $v; - - return $changed[$l][$k] === $v; -} ?> - -@foreach ($photos as $photo) -list_duplicate(TRUE); ?> -
-
-
-
-
- Duplicate Photo {{ $photo->id }} -
- -
{{ $photos->links() }}
-
-
- - @foreach ($data as $k=>$v) - - - @foreach ($duplicates as $id) -where('id',$id)->first(); -switch ($v) : -case 'id': $x=$id; $y=sprintf('%s',url('/p/info/'.$o->id),$o->id); break; -case 'thumbnail': $x=md5($o->thumbnail); $y=sprintf('',url('/p/view/'.$o->id),url('/p/thumbnail/'.$o->id)); break; -case 'signature': $x=$y=$o->signature(TRUE); break; -case 'datetaken': $x=$y=$o->date_taken(); break; -case 'created': $x=$y=$o->file_date('c',TRUE); break; -case 'modified': $x=$y=$o->file_date('m',TRUE); break; -case 'filepath': $x=$y=$o->file_path(TRUE); break; -case 'filesize': $x=$y=$o->file_size(); break; -case 'width': $x=$y=$o->width; break; -case 'height': $x=$y=$o->height; break; -case 'orientation': $x=$y=$o->orientation; break; -case 'make': $x=$y=$o->make; break; -case 'model': $x=$y=$o->model; break; -case 'exif': $y='
{{ $k }}
'; foreach ($o->properties() as $a => $b) $y.=sprintf('',(changed($a,$b,1) ? '' : 'warning'),$a,$b); $y.='
%s<>%s
';$x=md5($y); break; -endswitch ?> - - @endforeach {{-- photo --}} - - @endforeach {{-- data --}} - @foreach ($form as $v) - - {{ $v }} - @foreach ($duplicates as $id) - where('id',$id)->first(); ?> - $v==1 ? 'checked="checked"' : '' }}> - @endforeach {{-- photo --}} - - @endforeach {{-- form --}} - - @foreach ($duplicates as $id) - - @endforeach {{-- photo --}} - - - {{ csrf_field() }} -
-
-
-
-
-
-@endforeach -@endsection diff --git a/resources/views/video/duplicates.blade.php b/resources/views/video/duplicates.blade.php deleted file mode 100644 index 030fb19..0000000 --- a/resources/views/video/duplicates.blade.php +++ /dev/null @@ -1,100 +0,0 @@ -@extends('layouts.app') - -@section('content') -'id', - 'Video'=>'video', - 'Signature'=>'signature', - 'File Signature'=>'file_signature', - 'Length'=>'length', - 'Date Created'=>'datecreated', - 'File Created'=>'created', - 'File Modified'=>'modified', - 'Filename'=>'filepath', - 'Filesize'=>'filesize', - 'Width'=>'width', - 'Height'=>'height', - 'Make'=>'make', - 'Model'=>'model', -]; - -$form = [ -'duplicate', -'flag', -'remove', -]; - -function changed($k,$v,$l=0) -{ - static $changed = []; - - if (! isset($changed[$l][$k])) - $changed[$l][$k] = $v; - - return $changed[$l][$k] === $v; -} ?> - -@foreach ($videos as $video) -list_duplicate(TRUE); ?> -
-
-
-
-
- Duplicate Video {{ $video->id }} -
- -
{{ $videos->links() }}
-
-
- - @foreach ($data as $k=>$v) - - - @foreach ($duplicates as $id) -where('id',$id)->first(); -switch ($v) : -case 'id': $x=$id; $y=sprintf('%s',url('/v/info/'.$o->id),$o->id); break; -case 'video': $x=$o->signature(TRUE);$y=$o->view();; break; -case 'length': $x=$y=$o->length; break; -case 'signature': $x=$y=$o->signature(TRUE); break; -case 'file_signature': $x=$y=$o->file_signature(TRUE); break; -case 'datecreated': $x=$y=$o->date_taken(); break; -case 'created': $x=$y=$o->file_date('c',TRUE); break; -case 'modified': $x=$y=$o->file_date('m',TRUE); break; -case 'filepath': $x=$y=$o->file_path(TRUE); break; -case 'filesize': $x=$y=$o->file_size(); break; -case 'width': $x=$y=$o->width; break; -case 'height': $x=$y=$o->height; break; -case 'make': $x=$y=$o->make; break; -case 'model': $x=$y=$o->model; break; -endswitch ?> - - @endforeach {{-- video --}} - - @endforeach {{-- data --}} - @foreach ($form as $v) - - - @foreach ($duplicates as $id) - where('id',$id)->first(); ?> - - @endforeach {{-- video --}} - - @endforeach {{-- form --}} -
{{ $k }}
{{ $v }}$v==1 ? 'checked="checked"' : '' }}>
- @foreach ($duplicates as $id) - - @endforeach {{-- video --}} - - - {{ csrf_field() }} -
-
-
-
-
-
-@endforeach -@endsection