]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/create-transcoding-job.ts
Fix french translations in signup page
[github/Chocobozzz/PeerTube.git] / scripts / create-transcoding-job.ts
index 7e5b687bbc2c22520fa5969d79ea29d2c71e5b32..67a270a8660ba88f5d5769a9fa24a0e616ac9bf5 100755 (executable)
@@ -1,7 +1,11 @@
+import { registerTSPaths } from '../server/helpers/register-ts-paths'
+registerTSPaths()
+
 import * as program from 'commander'
 import { VideoModel } from '../server/models/video/video'
 import { initDatabaseModels } from '../server/initializers'
 import { JobQueue } from '../server/lib/job-queue'
+import { VideoTranscodingPayload } from '../server/lib/job-queue/handlers/video-transcoding'
 
 program
   .option('-v, --video [videoUUID]', 'Video UUID')
@@ -28,20 +32,14 @@ run()
 async function run () {
   await initDatabaseModels(true)
 
-  const video = await VideoModel.loadByUUIDWithFile(program['video'])
+  const video = await VideoModel.loadByUUID(program['video'])
   if (!video) throw new Error('Video not found.')
 
-  const dataInput = {
-    videoUUID: video.uuid,
-    isNewVideo: false,
-    resolution: undefined
-  }
-
-  if (program.resolution !== undefined) {
-    dataInput.resolution = program.resolution
-  }
+  const dataInput: VideoTranscodingPayload = program.resolution !== undefined
+   ? { type: 'new-resolution' as 'new-resolution', videoUUID: video.uuid, isNewVideo: false, resolution: program.resolution }
+   : { type: 'optimize' as 'optimize', videoUUID: video.uuid, isNewVideo: false }
 
   await JobQueue.Instance.init()
-  await JobQueue.Instance.createJob({ type: 'video-file', payload: dataInput })
+  await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput })
   console.log('Transcoding job for video %s created.', video.uuid)
 }