Minor fixes

This commit is contained in:
Deon George 2019-12-21 22:57:34 +11:00
parent bcdbc1715e
commit 4adf66c318
7 changed files with 40 additions and 39 deletions

View File

@ -13,12 +13,12 @@ class VideoImport extends Command
use DispatchesJobs;
use Files;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'video:import
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'video:import
{--dir= : Directory to Parse}
{--file= : File to Import}
{--ignoredupe : Ignore duplicate files}
@ -27,28 +27,28 @@ class VideoImport extends Command
{--people= : People to reference in video}
{--tags= : Add tag to video}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Import videos into the database';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Import videos into the database';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$files = $this->getFiles([
@ -139,11 +139,11 @@ class VideoImport extends Command
$this->dispatch((new \App\Jobs\CatalogScan($o))->onQueue('scan'));
if ($this->option('dumpid3'))
dd($o->dump());
dd($o->properties());
}
$bar->finish();
return $this->info(sprintf('Videos processed: %s',$c));
}
}
}

View File

@ -19,7 +19,7 @@ class VideoScanAll extends Command
* @var string
*/
protected $signature = 'video:scanall'.
'{--scanned : Rescan Scanned Videos}';
' {--scanned : Rescan Scanned Videos}';
/**
* The console command description.

View File

@ -155,7 +155,6 @@ abstract class Catalog extends Model
/**
* Determine the new name for the image
* @todo Make Generic for Photo and Video
*/
public function file_path($short=FALSE,$new=FALSE)
{
@ -229,7 +228,7 @@ abstract class Catalog extends Model
}
public function getDateCreatedAttribute() {
return Carbon::createFromTimestamp($this->attributes['date_created']);
return $this->attributes['date_created'] ? Carbon::createFromTimestamp($this->attributes['date_created']) : NULL;
}
/**

View File

@ -42,7 +42,6 @@ class Photo extends Abstracted\Catalog
/**
* Determine the new name for the image
* @todo Implement in Parent
*/
public function file_path($short=FALSE,$new=FALSE)
{

View File

@ -2,7 +2,6 @@
namespace App\Models;
use DB;
use Illuminate\Support\Arr;
class Video extends Abstracted\Catalog
@ -31,6 +30,11 @@ class Video extends Abstracted\Catalog
if (is_null($this->_o))
{
/*
* @todo There is a bug with getID3, where the second iteration yields different results
* this is problematic when video:scanall is run from a queue and there is more than 1 job.
* It also appears that only 1.9.18 gets date/gps data, a later version doesnt get gps data.
*/
$this->_o = new \getID3;
$this->_o->analyze($this->file_path());
$this->_o->getHashdata('sha1');
@ -122,8 +126,7 @@ class Video extends Abstracted\Catalog
public function setDateCreated()
{
if ($this->property('creationdate'))
$this->date_created = $this->property('creationdate');
$this->date_created = $this->property('creationdate');
}
public function setDateCreatedAttribute($value)
@ -145,7 +148,7 @@ class Video extends Abstracted\Catalog
$this->model = $this->property('model');
$this->software = $this->property('software');
$this->type = $this->property('type');
$this->length = $this->property('length');
$this->length = round($this->property('length'),2);
$this->codec = $this->property('codec');
$this->audiochannels = $this->property('audiochannels');
$this->channelmode = $this->property('channelmode');

View File

@ -15,7 +15,7 @@
<div class="card-header">
<div class="user-block">
<i class="float-left fa fa-2x fa-camera"></i><span class="username"><a href="#">#{{ $o->id }} - {{ \Illuminate\Support\Str::limit($o->filename,12).\Illuminate\Support\Str::substr($o->filename,-16) }}</a></span>
<span class="description">{{ $o->date_created->toDateTimeString() }} [{{ $o->device() }}]</span>
<span class="description">{{ $o->date_created ? $o->date_created->toDateTimeString() : '-' }} [{{ $o->device() }}]</span>
</div>
<!-- /.user-block -->
<div class="card-tools">

View File

@ -25,13 +25,13 @@
<nav>
<ul class="pagination">
<li class="page-item @if(! $x=$o->previous())disabled @endif" aria-disabled="@if(! $x)true @else false @endif" aria-label="&laquo; Previous">
<a class="page-link" href="{{ $x ? url('p/info',$x->id) : '#' }}">&lt;&lt;</a>
<a class="page-link" href="{{ $x ? url('v/info',$x->id) : '#' }}">&lt;&lt;</a>
</li>
<li class="page-item active" aria-current="page"><span class="page-link">{{ $o->id }}</span></li>
<li class="page-item @if(! $x=$o->next())disabled @endif" aria-disabled="@if(! $x)true @else false @endif" aria-label="&laquo; Previous">
<a class="page-link" href="{{ $x ? url('p/info',$x->id) : '#' }}">&gt;&gt;</a>
<a class="page-link" href="{{ $x ? url('v/info',$x->id) : '#' }}">&gt;&gt;</a>
</li>
</ul>
</nav>