- await video.$set('Tags', tagInstances, { transaction })
- video.Tags = tagInstances
+ const internalTags = tags || []
+ const tagInstances = await TagModel.findOrCreateTags(internalTags, transaction)
+
+ await video.$set('Tags', tagInstances, { transaction })
+ video.Tags = tagInstances
+}
+
+async function addOptimizeOrMergeAudioJob (video: MVideoUUID, videoFile: MVideoFile, user: MUserId) {
+ let dataInput: VideoTranscodingPayload
+
+ if (videoFile.isAudio()) {
+ dataInput = {
+ type: 'merge-audio-to-webtorrent',
+ resolution: DEFAULT_AUDIO_RESOLUTION,
+ videoUUID: video.uuid,
+ isNewVideo: true
+ }