diff options
Diffstat (limited to 'scripts/regenerate-thumbnails.ts')
-rw-r--r-- | scripts/regenerate-thumbnails.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/scripts/regenerate-thumbnails.ts b/scripts/regenerate-thumbnails.ts index 8075f90ba..50d06f6fd 100644 --- a/scripts/regenerate-thumbnails.ts +++ b/scripts/regenerate-thumbnails.ts | |||
@@ -7,7 +7,6 @@ import { pathExists, remove } from 'fs-extra' | |||
7 | import { generateImageFilename, processImage } from '@server/helpers/image-utils' | 7 | import { generateImageFilename, processImage } from '@server/helpers/image-utils' |
8 | import { THUMBNAILS_SIZE } from '@server/initializers/constants' | 8 | import { THUMBNAILS_SIZE } from '@server/initializers/constants' |
9 | import { VideoModel } from '@server/models/video/video' | 9 | import { VideoModel } from '@server/models/video/video' |
10 | import { MVideo } from '@server/types/models' | ||
11 | import { initDatabaseModels } from '@server/initializers/database' | 10 | import { initDatabaseModels } from '@server/initializers/database' |
12 | 11 | ||
13 | program | 12 | program |
@@ -21,16 +20,16 @@ run() | |||
21 | async function run () { | 20 | async function run () { |
22 | await initDatabaseModels(true) | 21 | await initDatabaseModels(true) |
23 | 22 | ||
24 | const videos = await VideoModel.listLocal() | 23 | const ids = await VideoModel.listLocalIds() |
25 | 24 | ||
26 | await map(videos, v => { | 25 | await map(ids, id => { |
27 | return processVideo(v) | 26 | return processVideo(id) |
28 | .catch(err => console.error('Cannot process video %s.', v.url, err)) | 27 | .catch(err => console.error('Cannot process video %d.', id, err)) |
29 | }, { concurrency: 20 }) | 28 | }, { concurrency: 20 }) |
30 | } | 29 | } |
31 | 30 | ||
32 | async function processVideo (videoArg: MVideo) { | 31 | async function processVideo (id: number) { |
33 | const video = await VideoModel.loadWithFiles(videoArg.id) | 32 | const video = await VideoModel.loadWithFiles(id) |
34 | 33 | ||
35 | console.log('Processing video %s.', video.name) | 34 | console.log('Processing video %s.', video.name) |
36 | 35 | ||