aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/update-host.ts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/update-host.ts')
-rwxr-xr-xscripts/update-host.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/update-host.ts b/scripts/update-host.ts
index 5e69e4172..06d84a658 100755
--- a/scripts/update-host.ts
+++ b/scripts/update-host.ts
@@ -1,8 +1,5 @@
1import { readFileSync, writeFileSync } from 'fs' 1import * as Promise from 'bluebird'
2import { join } from 'path'
3import * as parseTorrent from 'parse-torrent'
4 2
5import { CONFIG, STATIC_PATHS } from '../server/initializers/constants'
6import { database as db } from '../server/initializers/database' 3import { database as db } from '../server/initializers/database'
7import { hasFriends } from '../server/lib/friends' 4import { hasFriends } from '../server/lib/friends'
8 5
@@ -20,11 +17,18 @@ db.init(true)
20 return db.Video.list() 17 return db.Video.list()
21 }) 18 })
22 .then(videos => { 19 .then(videos => {
20 const tasks: Promise<any>[] = []
21
23 videos.forEach(video => { 22 videos.forEach(video => {
23 console.log('Updating video ' + video.uuid)
24
24 video.VideoFiles.forEach(file => { 25 video.VideoFiles.forEach(file => {
25 video.createTorrentAndSetInfoHash(file) 26 tasks.push(video.createTorrentAndSetInfoHash(file))
26 }) 27 })
27 }) 28 })
28 29
30 return Promise.all(tasks)
31 })
32 .then(() => {
29 process.exit(0) 33 process.exit(0)
30 }) 34 })