]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/create-transcoding-job.ts
refactor(types): create dedicated folder for types package src
[github/Chocobozzz/PeerTube.git] / scripts / create-transcoding-job.ts
index 29c398822404b4780b8d136aef74aa0e5b171e3e..244c38fcdd21d0a95f59b98733865abc6b4ae391 100755 (executable)
@@ -5,7 +5,7 @@ import { program } from 'commander'
 import { VideoModel } from '../server/models/video/video'
 import { initDatabaseModels } from '../server/initializers/database'
 import { JobQueue } from '../server/lib/job-queue'
-import { computeResolutionsToTranscode } from '@server/helpers/ffprobe-utils'
+import { computeLowerResolutionsToTranscode } from '@server/helpers/ffprobe-utils'
 import { VideoState, VideoTranscodingPayload } from '@shared/models'
 import { CONFIG } from '@server/initializers/config'
 import { isUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc'
@@ -50,13 +50,13 @@ async function run () {
   if (!video) throw new Error('Video not found.')
 
   const dataInput: VideoTranscodingPayload[] = []
-  const resolution = video.getMaxQualityFile().resolution
+  const maxResolution = video.getMaxQualityFile().resolution
 
   // Generate HLS files
   if (options.generateHls || CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) {
     const resolutionsEnabled = options.resolution
       ? [ parseInt(options.resolution) ]
-      : computeResolutionsToTranscode(resolution, 'vod').concat([ resolution ])
+      : computeLowerResolutionsToTranscode(maxResolution, 'vod').concat([ maxResolution ])
 
     for (const resolution of resolutionsEnabled) {
       dataInput.push({
@@ -66,7 +66,8 @@ async function run () {
         isPortraitMode: false,
         copyCodecs: false,
         isNewVideo: false,
-        isMaxQuality: false
+        isMaxQuality: maxResolution === resolution,
+        autoDeleteWebTorrentIfNeeded: false
       })
     }
   } else {