diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-07 15:27:35 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-07 15:54:34 +0200 |
commit | fdbda9e3d6564ec908733c7019305f6a3c363a9f (patch) | |
tree | c596034156f167e7cfafe41c4a3fc6adda488a0d /scripts/update-host.ts | |
parent | 04de542abd940f9d2ca213fba3c68580c6c9b78a (diff) | |
download | PeerTube-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-x | scripts/update-host.ts | 14 |
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 @@ | |||
1 | import { readFileSync, writeFileSync } from 'fs' | 1 | import * as Promise from 'bluebird' |
2 | import { join } from 'path' | ||
3 | import * as parseTorrent from 'parse-torrent' | ||
4 | 2 | ||
5 | import { CONFIG, STATIC_PATHS } from '../server/initializers/constants' | ||
6 | import { database as db } from '../server/initializers/database' | 3 | import { database as db } from '../server/initializers/database' |
7 | import { hasFriends } from '../server/lib/friends' | 4 | import { 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 | }) |