From 9c0a02c4252ec96556bbf62e8c813f1742608bb4 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 5 Jan 2020 09:37:50 +1100 Subject: [PATCH] Fix newfilename calculation --- app/Jobs/PhotoMove.php | 6 +++--- app/Jobs/VideoMove.php | 6 +++--- app/Models/Abstracted/Catalog.php | 12 ++++++++---- app/Models/Jobs.php | 12 ++++++++++++ 4 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 app/Models/Jobs.php diff --git a/app/Jobs/PhotoMove.php b/app/Jobs/PhotoMove.php index a8913a8..ae60be1 100644 --- a/app/Jobs/PhotoMove.php +++ b/app/Jobs/PhotoMove.php @@ -14,16 +14,16 @@ class PhotoMove extends Job implements ShouldQueue { use InteractsWithQueue,SerializesModels; - private $photo; + public $photo; /** * Create a new job instance. * * @return void */ - public function __construct(Photo $photo) + public function __construct(Photo $o) { - $this->photo = $photo; + $this->photo = $o; } /** diff --git a/app/Jobs/VideoMove.php b/app/Jobs/VideoMove.php index 8864618..76e94fa 100644 --- a/app/Jobs/VideoMove.php +++ b/app/Jobs/VideoMove.php @@ -14,16 +14,16 @@ class VideoMove extends Job implements ShouldQueue { use InteractsWithQueue,SerializesModels; - private $video; + public $video; /** * Create a new job instance. * * @return void */ - public function __construct(Video $video) + public function __construct(Video $o) { - $this->video = $video; + $this->video = $o; } /** diff --git a/app/Models/Abstracted/Catalog.php b/app/Models/Abstracted/Catalog.php index 08a9a00..2396614 100644 --- a/app/Models/Abstracted/Catalog.php +++ b/app/Models/Abstracted/Catalog.php @@ -15,6 +15,10 @@ abstract class Catalog extends Model protected static $includeSubSecTime = FALSE; protected $dates = ['created']; + protected $casts = [ + 'subsectime' => 'int', + ]; + /** * People in Multimedia Object * @@ -220,10 +224,10 @@ abstract class Catalog extends Model // If the date created is not set, the file name will be based on the ID of the file. $file = sprintf('%s.%s',(is_null($this->created) ? sprintf('UNKNOWN/%07s',$this->file_path_id()) - : $this->created->format('Y/m/d-His').((! is_null($this->subsectime)) ? sprintf('.%03d',$this->subsectime) : '' ). - ((! static::$includeSubSecTime OR ! is_null($this->subsectime)) ? '' : sprintf('-%05s',$this->id)). - ($this->ignore_duplicate ? sprintf('-%06d',$this->id) : '') - ),$this->type() + : $this->created->format('Y/m/d-His'). + ((! is_null($this->subsectime)) ? sprintf('_%03d',$this->subsectime) : '' ). + sprintf('-%05s',$this->id)) + ,$this->type() ); return (($short OR preg_match('/^\//',$file)) ? '' : config($this->type.'.dir').DIRECTORY_SEPARATOR).$file; diff --git a/app/Models/Jobs.php b/app/Models/Jobs.php new file mode 100644 index 0000000..538e603 --- /dev/null +++ b/app/Models/Jobs.php @@ -0,0 +1,12 @@ + 'array', + ]; +} \ No newline at end of file