also looking at this
meemalabs/laravel-media-converter
feat: add support for tagging
#17
4 files
+20
-5
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Facade; | ||
| 11 | 11 | * @method static \Meema\MediaConverter\Converters\MediaConvert withThumbnails(int $framerateNumerator, int $framerateDenominator, int $maxCaptures, $width = null, $nameModifier = null, $imageQuality = 80) |
| 12 | 12 | * @method static \Aws\Result saveTo(string $s3Path, $s3bucket = null) |
| 13 | 13 | * @method static \Aws\Result cancelJob(string $id) |
| 14 | * @method static \Aws\Result createJob(array $settings, array $metaData = [], int $priority = 0) | |
| 14 | * @method static \Aws\Result createJob(array $settings, array $metaData = [], array $tags = [], int $priority = 0) | |
| 15 | 15 | * @method static \Aws\Result getJob(string $id) |
| 16 | 16 | * @method static \Aws\Result listJobs(array $options) |
| 17 | 17 | */ |
| @@ -13,27 +13,36 @@ class CreateVideoConversion implements ShouldQueue | ||
| 13 | 13 | { |
| 14 | 14 | use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
| 15 | 15 | |
| 16 | /** | |
| 17 | * @var array | |
| 18 | */ | |
| 16 | 19 | private array $jobSettings; |
| 17 | 20 | |
| 21 | /** | |
| 22 | * @var int | |
| 23 | */ | |
| 18 | 24 | private int $mediaId; |
| 19 | 25 | |
| 26 | /** | |
| 27 | * @var array | |
| 28 | */ | |
| 29 | private array $tags; | |
| 30 | ||
| 20 | 31 | /** |
| 21 | 32 | * Create a new job instance. |
| 22 | 33 | * |
| 23 | 34 | * @param $jobSettings |
| 35 | * @param $tags | |
| 24 | 36 | * @param $mediaId |
| 25 | 37 | */ |
| 26 | public function __construct($jobSettings, $mediaId = null, $teamId = null) | |
| 38 | public function __construct($jobSettings, $tags, $mediaId = null) | |
| 27 | 39 | { |
| 28 | 40 | $this->jobSettings = $jobSettings; |
| 41 | $this->tags = $tags; | |
| 29 | 42 | |
| 30 | 43 | if ($mediaId) { |
| 31 | 44 | $this->mediaId = $mediaId; |
| 32 | 45 | } |
| 33 | ||
| 34 | if ($teamId) { | |
| 35 | $this->teamId = $teamId; | |
| 36 | } | |
| 37 | 46 | } |
| 38 | 47 | |
| 39 | 48 | /** |
| @@ -44,16 +53,12 @@ class CreateVideoConversion implements ShouldQueue | ||
| 44 | 53 | public function handle() |
| 45 | 54 | { |
| 46 | 55 | $metaData = []; |
| 47 | $tags = []; | |
| 56 | $tags = $this->tags; | |
| 48 | 57 | |
| 49 | 58 | if ($this->mediaId) { |
| 50 | 59 | $metaData = ['model_id' => $this->mediaId]; |
| 51 | 60 | } |
| 52 | 61 | |
| 53 | if ($this->teamId) { | |
| 54 | $tags = ['team_id' => $this->teamId]; | |
| 55 | } | |
| 56 | ||
| 57 | 62 | MediaConvert::createJob($this->jobSettings, $metaData, $tags); |
| 58 | 63 | } |
| 59 | 64 | } |