aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/update-host.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-09-07 15:27:35 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-09-07 15:54:34 +0200
commitfdbda9e3d6564ec908733c7019305f6a3c363a9f (patch)
treec596034156f167e7cfafe41c4a3fc6adda488a0d /scripts/update-host.ts
parent04de542abd940f9d2ca213fba3c68580c6c9b78a (diff)
downloadPeerTube-fdbda9e3d6564ec908733c7019305f6a3c363a9f.tar.gz
PeerTube-fdbda9e3d6564ec908733c7019305f6a3c363a9f.tar.zst
PeerTube-fdbda9e3d6564ec908733c7019305f6a3c363a9f.zip
Add tests for npm run scripts
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 })