diff options
Diffstat (limited to 'scripts/create-move-video-storage-job.ts')
-rw-r--r-- | scripts/create-move-video-storage-job.ts | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/scripts/create-move-video-storage-job.ts b/scripts/create-move-video-storage-job.ts index 505bbd61b..7465c1ce0 100644 --- a/scripts/create-move-video-storage-job.ts +++ b/scripts/create-move-video-storage-job.ts | |||
@@ -1,13 +1,10 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import { program } from 'commander' | 1 | import { program } from 'commander' |
5 | import { VideoModel } from '@server/models/video/video' | 2 | import { CONFIG } from '@server/initializers/config' |
6 | import { initDatabaseModels } from '@server/initializers/database' | 3 | import { initDatabaseModels } from '@server/initializers/database' |
7 | import { VideoStorage } from '@shared/models' | ||
8 | import { moveToExternalStorageState } from '@server/lib/video-state' | ||
9 | import { JobQueue } from '@server/lib/job-queue' | 4 | import { JobQueue } from '@server/lib/job-queue' |
10 | import { CONFIG } from '@server/initializers/config' | 5 | import { moveToExternalStorageState } from '@server/lib/video-state' |
6 | import { VideoModel } from '@server/models/video/video' | ||
7 | import { VideoState, VideoStorage } from '@shared/models' | ||
11 | 8 | ||
12 | program | 9 | program |
13 | .description('Move videos to another storage.') | 10 | .description('Move videos to another storage.') |
@@ -57,6 +54,16 @@ async function run () { | |||
57 | process.exit(-1) | 54 | process.exit(-1) |
58 | } | 55 | } |
59 | 56 | ||
57 | if (video.isLive) { | ||
58 | console.error('Cannot process live video') | ||
59 | process.exit(-1) | ||
60 | } | ||
61 | |||
62 | if (video.state === VideoState.TO_MOVE_TO_EXTERNAL_STORAGE) { | ||
63 | console.error('This video is already being moved to external storage') | ||
64 | process.exit(-1) | ||
65 | } | ||
66 | |||
60 | ids.push(video.id) | 67 | ids.push(video.id) |
61 | } else { | 68 | } else { |
62 | ids = await VideoModel.listLocalIds() | 69 | ids = await VideoModel.listLocalIds() |