]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/create-import-video-file-job.ts
Fix client dev mode
[github/Chocobozzz/PeerTube.git] / scripts / create-import-video-file-job.ts
index a2f4f38f2ffee306fcd99fadb81749ef1a7983c9..37738ca40c896b08448ab30417304c72ede0213e 100644 (file)
@@ -1,3 +1,6 @@
+import { registerTSPaths } from '../server/helpers/register-ts-paths'
+registerTSPaths()
+
 import * as program from 'commander'
 import { resolve } from 'path'
 import { VideoModel } from '../server/models/video/video'
@@ -27,6 +30,7 @@ async function run () {
 
   const video = await VideoModel.loadByUUID(program['video'])
   if (!video) throw new Error('Video not found.')
+  if (video.isOwned() === false) throw new Error('Cannot import files of a non owned video.')
 
   const dataInput = {
     videoUUID: video.uuid,
@@ -34,6 +38,6 @@ async function run () {
   }
 
   await JobQueue.Instance.init()
-  await JobQueue.Instance.createJob({ type: 'video-file-import', payload: dataInput })
+  await JobQueue.Instance.createJobWithPromise({ type: 'video-file-import', payload: dataInput })
   console.log('Import job for video %s created.', video.uuid)
 }