aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/regenerate-thumbnails.ts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/regenerate-thumbnails.ts')
-rw-r--r--scripts/regenerate-thumbnails.ts13
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'
7import { generateImageFilename, processImage } from '@server/helpers/image-utils' 7import { generateImageFilename, processImage } from '@server/helpers/image-utils'
8import { THUMBNAILS_SIZE } from '@server/initializers/constants' 8import { THUMBNAILS_SIZE } from '@server/initializers/constants'
9import { VideoModel } from '@server/models/video/video' 9import { VideoModel } from '@server/models/video/video'
10import { MVideo } from '@server/types/models'
11import { initDatabaseModels } from '@server/initializers/database' 10import { initDatabaseModels } from '@server/initializers/database'
12 11
13program 12program
@@ -21,16 +20,16 @@ run()
21async function run () { 20async 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
32async function processVideo (videoArg: MVideo) { 31async 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