]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/create-move-video-storage-job.ts
Possibility to set custom RTMP/RTMPS hostname (#4811)
[github/Chocobozzz/PeerTube.git] / scripts / create-move-video-storage-job.ts
index 699487f72e7b2a876520e59bb7364ed52356a4f8..7465c1ce0ec42b9a078eca7beeb805ac649b34ec 100644 (file)
@@ -1,13 +1,10 @@
-import { registerTSPaths } from '../server/helpers/register-ts-paths'
-registerTSPaths()
-
 import { program } from 'commander'
-import { VideoModel } from '@server/models/video/video'
+import { CONFIG } from '@server/initializers/config'
 import { initDatabaseModels } from '@server/initializers/database'
-import { VideoStorage } from '@shared/models'
-import { moveToExternalStorageState } from '@server/lib/video-state'
 import { JobQueue } from '@server/lib/job-queue'
-import { CONFIG } from '@server/initializers/config'
+import { moveToExternalStorageState } from '@server/lib/video-state'
+import { VideoModel } from '@server/models/video/video'
+import { VideoState, VideoStorage } from '@shared/models'
 
 program
   .description('Move videos to another storage.')
@@ -62,6 +59,11 @@ async function run () {
       process.exit(-1)
     }
 
+    if (video.state === VideoState.TO_MOVE_TO_EXTERNAL_STORAGE) {
+      console.error('This video is already being moved to external storage')
+      process.exit(-1)
+    }
+
     ids.push(video.id)
   } else {
     ids = await VideoModel.listLocalIds()