import { map } from 'bluebird'
import { program } from 'commander'
import { pathExists, remove } from 'fs-extra'
import { generateImageFilename, processImage } from '@server/helpers/image-utils'
import { THUMBNAILS_SIZE } from '@server/initializers/constants'
import { map } from 'bluebird'
import { program } from 'commander'
import { pathExists, remove } from 'fs-extra'
import { generateImageFilename, processImage } from '@server/helpers/image-utils'
import { THUMBNAILS_SIZE } from '@server/initializers/constants'
- await map(videos, v => {
- return processVideo(v)
- .catch(err => console.error('Cannot process video %s.', v.url, err))
+ await map(ids, id => {
+ return processVideo(id)
+ .catch(err => console.error('Cannot process video %d.', id, err))
-async function processVideo (videoArg: MVideo) {
- const video = await VideoModel.loadWithFiles(videoArg.id)
+async function processVideo (id: number) {
+ const video = await VideoModel.loadWithFiles(id)
- await processImage(previewPath, thumbnailPath, size, true)
+ await processImage({ path: previewPath, destination: thumbnailPath, newSize: size, keepOriginal: true })