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

View File

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

View File

@ -155,7 +155,6 @@ abstract class Catalog extends Model
/** /**
* Determine the new name for the image * Determine the new name for the image
* @todo Make Generic for Photo and Video
*/ */
public function file_path($short=FALSE,$new=FALSE) public function file_path($short=FALSE,$new=FALSE)
{ {
@ -229,7 +228,7 @@ abstract class Catalog extends Model
} }
public function getDateCreatedAttribute() { 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 * Determine the new name for the image
* @todo Implement in Parent
*/ */
public function file_path($short=FALSE,$new=FALSE) public function file_path($short=FALSE,$new=FALSE)
{ {

View File

@ -2,7 +2,6 @@
namespace App\Models; namespace App\Models;
use DB;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
class Video extends Abstracted\Catalog class Video extends Abstracted\Catalog
@ -31,6 +30,11 @@ class Video extends Abstracted\Catalog
if (is_null($this->_o)) 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 = new \getID3;
$this->_o->analyze($this->file_path()); $this->_o->analyze($this->file_path());
$this->_o->getHashdata('sha1'); $this->_o->getHashdata('sha1');
@ -122,8 +126,7 @@ class Video extends Abstracted\Catalog
public function setDateCreated() public function setDateCreated()
{ {
if ($this->property('creationdate')) $this->date_created = $this->property('creationdate');
$this->date_created = $this->property('creationdate');
} }
public function setDateCreatedAttribute($value) public function setDateCreatedAttribute($value)
@ -145,7 +148,7 @@ class Video extends Abstracted\Catalog
$this->model = $this->property('model'); $this->model = $this->property('model');
$this->software = $this->property('software'); $this->software = $this->property('software');
$this->type = $this->property('type'); $this->type = $this->property('type');
$this->length = $this->property('length'); $this->length = round($this->property('length'),2);
$this->codec = $this->property('codec'); $this->codec = $this->property('codec');
$this->audiochannels = $this->property('audiochannels'); $this->audiochannels = $this->property('audiochannels');
$this->channelmode = $this->property('channelmode'); $this->channelmode = $this->property('channelmode');

View File

@ -15,7 +15,7 @@
<div class="card-header"> <div class="card-header">
<div class="user-block"> <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> <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> </div>
<!-- /.user-block --> <!-- /.user-block -->
<div class="card-tools"> <div class="card-tools">

View File

@ -25,13 +25,13 @@
<nav> <nav>
<ul class="pagination"> <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"> <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>
<li class="page-item active" aria-current="page"><span class="page-link">{{ $o->id }}</span></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"> <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> </li>
</ul> </ul>
</nav> </nav>