Old updates

This commit is contained in:
Deon George 2019-11-08 21:43:36 +11:00
parent cfc9bf5d9a
commit c723807b3f
8 changed files with 119 additions and 222 deletions

View File

@ -58,9 +58,6 @@ class CatalogScan extends Command
$break = FALSE; $break = FALSE;
foreach ($x as $oo) { foreach ($x as $oo) {
// If this photo siganture matches another.
if ($o->signature == $oo->signature)
{
// And that photo is not marked as a duplicate // And that photo is not marked as a duplicate
if (! $oo->duplicate) if (! $oo->duplicate)
{ {
@ -78,7 +75,6 @@ class CatalogScan extends Command
} }
} }
} }
}
$o->scanned = '1'; $o->scanned = '1';

View File

@ -102,8 +102,11 @@ class VideoMove extends Command
} }
else 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)); $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));
}
} }
} }

View File

@ -36,7 +36,7 @@ class PhotoController extends Controller
public function deletes($id=NULL) 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) public function deletesUpdate(Request $request)
@ -54,12 +54,12 @@ class PhotoController extends Controller
public function duplicates($id=NULL) 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) public function duplicatesUpdate(Request $request)
{ {
foreach ($request->input('photo') as $id) foreach ($request->input('items') as $id)
{ {
$po = Photo::findOrFail($id); $po = Photo::findOrFail($id);

View File

@ -37,7 +37,7 @@ class VideoController extends Controller
public function deletes($id=NULL) 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) public function deletesUpdate(Request $request)
@ -55,12 +55,12 @@ class VideoController extends Controller
public function duplicates($id=NULL) 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) public function duplicatesUpdate(Request $request)
{ {
foreach ($request->input('video') as $id) foreach ($request->input('items') as $id)
{ {
$po = Video::findOrFail($id); $po = Video::findOrFail($id);

View File

@ -156,6 +156,22 @@ abstract class Catalog extends Model
return $this->TextTrueFalse($this->flag); 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 * Return HTML Checkbox for flagged
*/ */

View File

@ -0,0 +1,82 @@
@extends('layouts.app')
<?php $data = [
'ID'=>['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')
<div class="container">
<div class="row">
<div class="col-md-11 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-heading">
Review Duplicate Items
</div>
<div class="text-center">{{ $catalog->links() }}</div>
<div class="panel-body">
@if ($catalog->count())
<form action="{{ $return }}" method="POST">
<table class="table table-striped table-condensed table-hover">
<tr>
<th>Source</th>
<th>Remove</th>
</tr>
@foreach ($catalog as $o)
<tr>
@php
$d=$o->list_duplicates(TRUE); $src=[];
@endphp
<td>
@if($d->where('duplicate',null)->count() > 1)
More than 1 source?
@elseif($d->count())
@php($src = $d->first())
{!! $src->view() !!}
<table class="table table-striped table-condensed table-hover small">
@foreach($data as $k=>$v)
<tr><th>{{$k}}</th><td>{!! $src->{$v[1]} !!}</td></tr>
@endforeach
</table>
@endif
</td>
@foreach($d as $item)
<input type="hidden" name="items[]" value="{{ $item->id }}">
@if($src AND $item->id == $src->id) @continue @endif
@php($diff=collect($src)->diffAssoc($item))
<td>
{!! $item->view() !!}
<table class="table table-striped table-condensed table-hover small">
@foreach($data as $k=>$v)
<tr class="@if($diff->has($v[0])) danger @endif"><th>{{$k}}</th><td>{!! $item->{$v[1]} !!}</td></tr>
@endforeach
</table>
</td>
@endforeach
</tr>
@endforeach
</table>
<input type="hidden" name="pagenext" value="{{ $catalog->hasMorePages() ? $catalog->currentPage()+1 : NULL }}">
<button class="btn btn-default">Update</button>
{{ csrf_field() }}
</form>
@else
NONE!
@endif
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -1,100 +0,0 @@
@extends('layouts.app')
@section('content')
<?php $data = [
'ID'=>'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)
<?php $duplicates = $photo->list_duplicate(TRUE); ?>
<div class="container">
<div class="row">
<div class="col-md-11 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-heading">
Duplicate Photo {{ $photo->id }}
</div>
<div class="text-center">{{ $photos->links() }}</div>
<div class="panel-body">
<form action="{{ url('/p/duplicates') }}" method="POST">
<table class="table table-striped table-condensed table-hover">
@foreach ($data as $k=>$v)
<tr>
<th>{{ $k }}</th>
@foreach ($duplicates as $id)
<?php
$o = (new \App\Model\Photo())->where('id',$id)->first();
switch ($v) :
case 'id': $x=$id; $y=sprintf('<a href="%s">%s</a>',url('/p/info/'.$o->id),$o->id); break;
case 'thumbnail': $x=md5($o->thumbnail); $y=sprintf('<a href="%s"><img src="%s" width="200px"></a>',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='<table class="table table-striped table-condensed">'; foreach ($o->properties() as $a => $b) $y.=sprintf('<tr class="%s"><th>%s<><td>%s<td></tr>',(changed($a,$b,1) ? '' : 'warning'),$a,$b); $y.='</table>';$x=md5($y); break;
endswitch ?>
<td class="{{ changed($v,$x) ? '' : 'danger' }}"><?php echo $y; ?></td>
@endforeach {{-- photo --}}
</tr>
@endforeach {{-- data --}}
@foreach ($form as $v)
<tr>
<th>{{ $v }}</th>
@foreach ($duplicates as $id)
<?php $o = (new \App\Model\Photo())->where('id',$id)->first(); ?>
<td><input type="checkbox" name="{{ sprintf('%s[%s]',$v,$o->id) }}" value="1" {{ $o->$v==1 ? 'checked="checked"' : '' }}></td>
@endforeach {{-- photo --}}
</tr>
@endforeach {{-- form --}}
</table>
@foreach ($duplicates as $id)
<input type="hidden" name="photo[]" value="{{ $id }}">
@endforeach {{-- photo --}}
<input type="hidden" name="page" value="{{ $photos->currentPage() }}">
<button class="btn btn-default">Update</button>
{{ csrf_field() }}
</form>
</div>
</div>
</div>
</div>
</div>
@endforeach
@endsection

View File

@ -1,100 +0,0 @@
@extends('layouts.app')
@section('content')
<?php $data = [
'ID'=>'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)
<?php $duplicates = $video->list_duplicate(TRUE); ?>
<div class="container">
<div class="row">
<div class="col-md-11 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-heading">
Duplicate Video {{ $video->id }}
</div>
<div class="text-center">{{ $videos->links() }}</div>
<div class="panel-body">
<form action="{{ url('/v/duplicates') }}" method="POST">
<table class="table table-striped table-condensed table-hover">
@foreach ($data as $k=>$v)
<tr>
<th>{{ $k }}</th>
@foreach ($duplicates as $id)
<?php
$o = (new \App\Model\Video())->where('id',$id)->first();
switch ($v) :
case 'id': $x=$id; $y=sprintf('<a href="%s">%s</a>',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 ?>
<td class="{{ changed($v,$x) ? '' : 'danger' }}"><?php echo $y; ?></td>
@endforeach {{-- video --}}
</tr>
@endforeach {{-- data --}}
@foreach ($form as $v)
<tr>
<th>{{ $v }}</th>
@foreach ($duplicates as $id)
<?php $o = (new \App\Model\Video())->where('id',$id)->first(); ?>
<td><input type="checkbox" name="{{ sprintf('%s[%s]',$v,$o->id) }}" value="1" {{ $o->$v==1 ? 'checked="checked"' : '' }}></td>
@endforeach {{-- video --}}
</tr>
@endforeach {{-- form --}}
</table>
@foreach ($duplicates as $id)
<input type="hidden" name="video[]" value="{{ $id }}">
@endforeach {{-- video --}}
<input type="hidden" name="page" value="{{ $videos->currentPage() }}">
<button class="btn btn-default">Update</button>
{{ csrf_field() }}
</form>
</div>
</div>
</div>
</div>
</div>
@endforeach
@endsection