Optimised scanning and importing

This commit is contained in:
Deon George
2018-01-11 23:59:53 +11:00
parent 96fadc5080
commit cfc9bf5d9a
26 changed files with 1542 additions and 759 deletions

View File

@@ -0,0 +1,80 @@
@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'],
'Is Duplicate'=>['duplicate','duplicatetext'],
'Flagged'=>['flag','flagtext'],
'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">
Permanently Delete 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)
@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">Confirm Delete</button>
{{ csrf_field() }}
</form>
@else
NONE!
@endif
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -1,78 +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',
'Duplicates'=>'duplicates',
'Is Duplicate'=>'duplicate',
'Flagged'=>'flag',
'Delete'=>'remove',
];?>
<div class="container">
<div class="row">
<div class="col-md-11 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-heading">
Permanently Delete Photos
</div>
<div class="text-center">{{ $photos->links() }}</div>
<div class="panel-body">
@if ($photos->count())
<form action="{{ url('/p/deletes') }}" method="POST">
<table class="table table-striped table-condensed table-hover">
@foreach ($data as $k=>$v)
<tr>
<th>{{ $k }}</th>
@foreach ($photos as $o)
<?php
switch ($v) :
case 'id': $x=$o->id; $y=sprintf('<input type="hidden" name="photo[]" value="%s"><a href="%s">%s</a>',$o->id,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':
case 'height':
case 'orientation':
case 'make':
case 'model': $y=$o->{$v}; break;
case 'duplicates': $x=$y='';foreach($o->list_duplicate() as $id) $y.=($y ? '|' : '').sprintf('<a href="%s">%s</a>',url('/p/info/'.$id),$id); break;
case 'flag':
case 'remove':
case 'duplicate': $y=sprintf('<input type="checkbox" name="%s[%s]" value="1"%s>',$v,$o->id,$o->{$v} ? ' checked="checked"' : ''); break;
endswitch ?>
<td><?php echo $y; ?></td>
@endforeach {{-- photo --}}
</tr>
@endforeach {{-- data --}}
</table>
<input type="hidden" name="pagenext" value="{{ $photos->hasMorePages() ? $photos->currentPage()+1 : NULL }}">
<button class="btn btn-default">Confirm Delete</button>
{{ csrf_field() }}
</form>
@else
NONE!
@endif
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -33,6 +33,7 @@
<dt>Date Taken</dt><dd>{{ $photo->date_taken() }}<dd>
<dt>Camera</dt><dd>{{ $photo->make }}<dd>
<dt>Model</dt><dd>{{ $photo->model }}<dd>
<dt>Software</dt><dd>{{ $photo->software }}<dd>
<br/>
<dt>Location</dt><dd>
<?php if ($photo->gps() == 'UNKNOWN') : ?>

View File

@@ -1,75 +0,0 @@
@extends('layouts.app')
@section('content')
<?php $data = [
'ID'=>'id',
'Signature'=>'signature',
'Date Created'=>'datecreated',
'File Created'=>'created',
'File Modified'=>'modified',
'Filename'=>'filepath',
'Filesize'=>'filesize',
'Width'=>'width',
'Height'=>'height',
'Make'=>'make',
'Model'=>'model',
'Duplicates'=>'duplicates',
'Is Duplicate'=>'duplicate',
'Flagged'=>'flag',
'Delete'=>'remove',
];?>
<div class="container">
<div class="row">
<div class="col-md-11 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-heading">
Permanently Delete Photos
</div>
<div class="text-center">{{ $videos->links() }}</div>
<div class="panel-body">
@if ($videos->count())
<form action="{{ url('/v/deletes') }}" method="POST">
<table class="table table-striped table-condensed table-hover">
@foreach ($data as $k=>$v)
<tr>
<th>{{ $k }}</th>
@foreach ($videos as $o)
<?php
switch ($v) :
case 'id': $x=$o->id; $y=sprintf('<input type="hidden" name="video[]" value="%s"><a href="%s">%s</a>',$o->id,url('/v/info/'.$o->id),$o->id); break;
case 'signature': $x=$y=$o->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':
case 'height':
case 'orientation':
case 'make':
case 'model': $y=$o->{$v}; break;
case 'duplicates': $x=$y='';foreach($o->list_duplicate() as $id) $y.=($y ? '|' : '').sprintf('<a href="%s">%s</a>',url('/v/info/'.$id),$id); break;
case 'flag':
case 'remove':
case 'duplicate': $y=sprintf('<input type="checkbox" name="%s[%s]" value="1"%s>',$v,$o->id,$o->{$v} ? ' checked="checked"' : ''); break;
endswitch ?>
<td><?php echo $y; ?></td>
@endforeach {{-- video --}}
</tr>
@endforeach {{-- data --}}
</table>
<input type="hidden" name="pagenext" value="{{ $videos->hasMorePages() ? $videos->currentPage()+1 : NULL }}">
<button class="btn btn-default">Confirm Delete</button>
{{ csrf_field() }}
</form>
@else
NONE!
@endif
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -5,6 +5,7 @@
'ID'=>'id',
'Video'=>'video',
'Signature'=>'signature',
'File Signature'=>'file_signature',
'Length'=>'length',
'Date Created'=>'datecreated',
'File Created'=>'created',
@@ -58,6 +59,7 @@ case 'id': $x=$id; $y=sprintf('<a href="%s">%s</a>',url('/v/info/'.$o->id),$o->i
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;

View File

@@ -6,7 +6,7 @@
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-heading">
Video {{ $video->id }}<?php if ($video->remove) : ?> - <strong>PENDING DELETE</strong><?php endif?>
Video {{ $video->id }}<?php if ($video->remove) : ?> - <strong>PENDING DELETE</strong><?php endif?><?php if ($video->duplicate) : ?> - <strong>DUPLICATE</strong><?php endif?>
</div>
<div class="panel-body">
@@ -39,6 +39,8 @@
<dt>Date Taken</dt><dd>{{ $video->date_taken() }}<dd>
<dt>Camera</dt><dd>{{ $video->make }}<dd>
<dt>Model</dt><dd>{{ $video->model }}<dd>
<dt>Software</dt><dd>{{ $video->software }}<dd>
<dt>Identifier</dt><dd>{{ $video->identifier }}<dd>
<br/>
<dt>Location</dt><dd>
<?php if ($video->gps() == 'UNKNOWN') : ?>
@@ -60,6 +62,14 @@
</script>
<?php endif ?>
</dd>
@if($x = $video->list_duplicate())
<dt>Duplicates</dt><dd>
@php
$y=''; foreach($video->list_duplicate() as $id) $y.=($y ? '|' : '').sprintf('<a href="%s">%s</a>',url('/v/info/'.$id),$id);
echo($y);
@endphp
</dd>
@endif
</div>
</div>