diff options
-rwxr-xr-x | scripts/update-host.ts | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/scripts/update-host.ts b/scripts/update-host.ts index 3fb5f1972..ed8b999a9 100755 --- a/scripts/update-host.ts +++ b/scripts/update-host.ts | |||
@@ -22,18 +22,13 @@ initDatabaseModels(true) | |||
22 | console.log('Updating torrent files.') | 22 | console.log('Updating torrent files.') |
23 | return VideoModel.list() | 23 | return VideoModel.list() |
24 | }) | 24 | }) |
25 | .then(videos => { | 25 | .then(async videos => { |
26 | const tasks: Promise<any>[] = [] | 26 | for (const video of videos) { |
27 | 27 | for (const file of video.VideoFiles) { | |
28 | videos.forEach(video => { | 28 | await video.createTorrentAndSetInfoHash(file) |
29 | console.log('Updating video ' + video.uuid) | 29 | console.log('Updated video ' + video.uuid) |
30 | 30 | } | |
31 | video.VideoFiles.forEach(file => { | 31 | } |
32 | tasks.push(video.createTorrentAndSetInfoHash(file)) | ||
33 | }) | ||
34 | }) | ||
35 | |||
36 | return Promise.all(tasks) | ||
37 | }) | 32 | }) |
38 | .then(() => { | 33 | .then(() => { |
39 | process.exit(0) | 34 | process.exit(0) |