diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2021-11-09 11:05:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-09 11:05:35 +0100 |
commit | e1ab52d7ec7370a6f9f5937192d6003206af1ac0 (patch) | |
tree | aecc8b696b0021e073fd205dd6e126fb4f178e8f /scripts/regenerate-thumbnails.ts | |
parent | c49c366ac320fe5ac3dc08f5891fe5898c1b34e3 (diff) | |
download | PeerTube-e1ab52d7ec7370a6f9f5937192d6003206af1ac0.tar.gz PeerTube-e1ab52d7ec7370a6f9f5937192d6003206af1ac0.tar.zst PeerTube-e1ab52d7ec7370a6f9f5937192d6003206af1ac0.zip |
Add migrate-to-object-storage script (#4481)
* add migrate-to-object-storage-script
closes #4467
* add migrate-to-unique-playlist-filenames script
* fix(migrate-to-unique-playlist-filenames): update master/segments256
run updateMasterHLSPlaylist and updateSha256VODSegments after
file rename.
* Improve move to object storage scripts
* PR remarks
Co-authored-by: Chocobozzz <me@florianbigard.com>
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 | ||