]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/job-queue/handlers/video-file-import.ts
Cache refresh actor promise
[github/Chocobozzz/PeerTube.git] / server / lib / job-queue / handlers / video-file-import.ts
index 8399163069e2c7b5dd2ef678223793afacd83354..187cb652e0119a1b7a693b5f77b70ca21ccf3bda 100644 (file)
@@ -1,9 +1,9 @@
 import * as Bull from 'bull'
 import { copy, stat } from 'fs-extra'
-import { extname } from 'path'
+import { getLowercaseExtension } from '@server/helpers/core-utils'
 import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
 import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
-import { UserModel } from '@server/models/account/user'
+import { UserModel } from '@server/models/user/user'
 import { MVideoFullLight } from '@server/types/models'
 import { VideoFileImportPayload } from '@shared/models'
 import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils'
@@ -55,7 +55,7 @@ async function updateVideoFile (video: MVideoFullLight, inputFilePath: string) {
   const { size } = await stat(inputFilePath)
   const fps = await getVideoFileFPS(inputFilePath)
 
-  const fileExt = extname(inputFilePath)
+  const fileExt = getLowercaseExtension(inputFilePath)
 
   const currentVideoFile = video.VideoFiles.find(videoFile => videoFile.resolution === videoFileResolution)
 
@@ -82,7 +82,7 @@ async function updateVideoFile (video: MVideoFullLight, inputFilePath: string) {
   await copy(inputFilePath, outputPath)
 
   video.VideoFiles.push(newVideoFile)
-  await createTorrentAndSetInfoHash(video, video, newVideoFile)
+  await createTorrentAndSetInfoHash(video, newVideoFile)
 
   await newVideoFile.save()
 }