import * as Bull from 'bull'
-import { logger } from '../../../helpers/logger'
-import { VideoModel } from '../../../models/video/video'
-import { publishNewResolutionIfNeeded } from './video-transcoding'
-import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils'
import { copy, stat } from 'fs-extra'
-import { VideoFileModel } from '../../../models/video/video-file'
import { extname } from 'path'
-import { MVideoFile, MVideoWithFile } from '@server/types/models'
import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
import { getVideoFilePath } from '@server/lib/video-paths'
+import { UserModel } from '@server/models/account/user'
+import { MVideoFile, MVideoWithFile } from '@server/types/models'
import { VideoFileImportPayload } from '@shared/models'
+import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils'
+import { logger } from '../../../helpers/logger'
+import { VideoModel } from '../../../models/video/video'
+import { VideoFileModel } from '../../../models/video/video-file'
+import { onNewWebTorrentFileResolution } from './video-transcoding'
async function processVideoFileImport (job: Bull.Job) {
const payload = job.data as VideoFileImportPayload
return undefined
}
+ const data = await getVideoFileResolution(payload.filePath)
+
await updateVideoFile(video, payload.filePath)
- await publishNewResolutionIfNeeded(video)
+ const user = await UserModel.loadByChannelActorId(video.VideoChannel.actorId)
+
+ const newResolutionPayload = {
+ type: 'new-resolution-to-webtorrent' as 'new-resolution-to-webtorrent',
+ videoUUID: video.uuid,
+ resolution: data.videoFileResolution,
+ isPortraitMode: data.isPortraitMode,
+ copyCodecs: false,
+ isNewVideo: false
+ }
+ await onNewWebTorrentFileResolution(video, user, newResolutionPayload)
+
return video
}