]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/job-queue/handlers/video-import.ts
Update embed URL query doc
[github/Chocobozzz/PeerTube.git] / server / lib / job-queue / handlers / video-import.ts
index b6e05d8f572096b32e1cdb2e50e794f0b143bf95..d59a1b12f6a6f5041c038017051d0b1bfb1ac438 100644 (file)
@@ -25,7 +25,7 @@ import {
   VideoResolution,
   VideoState
 } from '@shared/models'
-import { ffprobePromise, getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils'
+import { ffprobePromise, getVideoStreamDuration, getVideoStreamFPS, getVideoStreamDimensionsInfo } from '../../../helpers/ffmpeg'
 import { logger } from '../../../helpers/logger'
 import { getSecureTorrentName } from '../../../helpers/utils'
 import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent'
@@ -121,10 +121,10 @@ async function processFile (downloader: () => Promise<string>, videoImport: MVid
 
     const { resolution } = await isAudioFile(tempVideoPath, probe)
       ? { resolution: VideoResolution.H_NOVIDEO }
-      : await getVideoFileResolution(tempVideoPath)
+      : await getVideoStreamDimensionsInfo(tempVideoPath)
 
-    const fps = await getVideoFileFPS(tempVideoPath, probe)
-    const duration = await getDurationFromVideoFile(tempVideoPath, probe)
+    const fps = await getVideoStreamFPS(tempVideoPath, probe)
+    const duration = await getVideoStreamDuration(tempVideoPath, probe)
 
     // Prepare video file object for creation in database
     const fileExt = getLowercaseExtension(tempVideoPath)
@@ -254,12 +254,12 @@ async function processFile (downloader: () => Promise<string>, videoImport: MVid
     }
 
     if (video.state === VideoState.TO_MOVE_TO_EXTERNAL_STORAGE) {
-      return addMoveToObjectStorageJob(videoImportUpdated.Video)
+      return addMoveToObjectStorageJob({ video: videoImportUpdated.Video, previousVideoState: VideoState.TO_IMPORT })
     }
 
     // Create transcoding jobs?
     if (video.state === VideoState.TO_TRANSCODE) {
-      await addOptimizeOrMergeAudioJob(videoImportUpdated.Video, videoFile, videoImport.User)
+      await addOptimizeOrMergeAudioJob({ video: videoImportUpdated.Video, videoFile, user: videoImport.User })
     }
 
   } catch (err) {