Added handling of created_manual, revert some file_path()
This commit is contained in:
parent
0b6b3021fd
commit
270f63144b
@ -81,8 +81,10 @@ class CatalogScan extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the file signature changed, abort the update.
|
// If the file signature changed, abort the update.
|
||||||
if ($o->getOriginal('file_signature') AND $o->getDirty('file_signature'))
|
if ($o->getOriginal('file_signature') AND $o->wasChanged('file_signature')) {
|
||||||
|
dump(['old'=>$o->getOriginal('file_signature'),'new'=>$o->file_signature]);
|
||||||
abort(500,'File Signature Changed?');
|
abort(500,'File Signature Changed?');
|
||||||
|
}
|
||||||
|
|
||||||
$o->save();
|
$o->save();
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,6 @@ class VideoController extends Controller
|
|||||||
public function view(Video $o)
|
public function view(Video $o)
|
||||||
{
|
{
|
||||||
if ($o->isReadable())
|
if ($o->isReadable())
|
||||||
(new VideoStream($o->filename))->start();
|
(new VideoStream($o->file_path()))->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -97,7 +97,21 @@ abstract class Catalog extends Model
|
|||||||
->orWhere(function($q) {
|
->orWhere(function($q) {
|
||||||
// Or they have the same time taken with the same camera
|
// Or they have the same time taken with the same camera
|
||||||
if ($this->attributes['created'] AND $this->software_id) {
|
if ($this->attributes['created'] AND $this->software_id) {
|
||||||
$q->where('created','=',$this->attributes['created'] ?: NULL);
|
$q->where(function ($q) {
|
||||||
|
$q->where('created','=',$this->attributes['created'])
|
||||||
|
->orWhere('created_manual','=',$this->attributes['created']);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (static::$includeSubSecTime)
|
||||||
|
$q->where('subsectime','=',Arr::get($this->attributes,'subsectime'));
|
||||||
|
|
||||||
|
$q->where('software_id','=',$this->attributes['software_id']);
|
||||||
|
|
||||||
|
} elseif ($this->attributes['created_manual'] AND $this->software_id) {
|
||||||
|
$q->where(function ($q) {
|
||||||
|
$q->where('created','=',$this->attributes['created_manual'])
|
||||||
|
->orWhere('created_manual','=',$this->attributes['created_manual']);
|
||||||
|
});
|
||||||
|
|
||||||
if (static::$includeSubSecTime)
|
if (static::$includeSubSecTime)
|
||||||
$q->where('subsectime','=',Arr::get($this->attributes,'subsectime'));
|
$q->where('subsectime','=',Arr::get($this->attributes,'subsectime'));
|
||||||
@ -272,6 +286,11 @@ abstract class Catalog extends Model
|
|||||||
return (! is_readable($this->file_path())) ? NULL : filesize($this->file_path());
|
return (! is_readable($this->file_path())) ? NULL : filesize($this->file_path());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCreatedAttribute(): Carbon
|
||||||
|
{
|
||||||
|
return $this->created_manual ?: $this->asDateTime($this->attributes['created']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return item dimensions
|
* Return item dimensions
|
||||||
*/
|
*/
|
||||||
@ -314,10 +333,6 @@ abstract class Catalog extends Model
|
|||||||
return $this->HTMLCheckbox('ignore_duplicate',$this->id,$this->ignore_duplicate);
|
return $this->HTMLCheckbox('ignore_duplicate',$this->id,$this->ignore_duplicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDateCreatedAttribute() {
|
|
||||||
return $this->attributes['date_created'] ? Carbon::createFromTimestamp($this->attributes['date_created']) : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@ -8,6 +8,7 @@ class Video extends Abstracted\Catalog
|
|||||||
{
|
{
|
||||||
// ID3 Object
|
// ID3 Object
|
||||||
private $_o = NULL;
|
private $_o = NULL;
|
||||||
|
protected $dates = ['created','created_manual'];
|
||||||
|
|
||||||
public function getIDLinkAttribute()
|
public function getIDLinkAttribute()
|
||||||
{
|
{
|
||||||
@ -124,6 +125,11 @@ class Video extends Abstracted\Catalog
|
|||||||
return isset($data[$key]) ? $data[$key] : NULL;
|
return isset($data[$key]) ? $data[$key] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setDateCreated()
|
||||||
|
{
|
||||||
|
$this->created = strtotime($this->property('creationdate'));
|
||||||
|
}
|
||||||
|
|
||||||
public function setLocation()
|
public function setLocation()
|
||||||
{
|
{
|
||||||
$this->gps_lat = $this->property('gps_lat');
|
$this->gps_lat = $this->property('gps_lat');
|
||||||
|
Loading…
Reference in New Issue
Block a user