aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/danger/clean/cleaner.ts2
-rwxr-xr-xscripts/reset-password.ts2
-rwxr-xr-xscripts/update-host.ts14
3 files changed, 11 insertions, 7 deletions
diff --git a/scripts/danger/clean/cleaner.ts b/scripts/danger/clean/cleaner.ts
index d80b8d323..428333528 100644
--- a/scripts/danger/clean/cleaner.ts
+++ b/scripts/danger/clean/cleaner.ts
@@ -16,7 +16,7 @@ db.init(true)
16 const storageDir = STORAGE[storage] 16 const storageDir = STORAGE[storage]
17 17
18 return new Promise((res, rej) => { 18 return new Promise((res, rej) => {
19 rimraf(storageDir, function (err) { 19 rimraf(storageDir, err => {
20 if (err) return rej(err) 20 if (err) return rej(err)
21 21
22 console.info('%s deleted.', storageDir) 22 console.info('%s deleted.', storageDir)
diff --git a/scripts/reset-password.ts b/scripts/reset-password.ts
index 5ab7d01e5..f0c06a7bf 100755
--- a/scripts/reset-password.ts
+++ b/scripts/reset-password.ts
@@ -18,7 +18,7 @@ db.init(true)
18 .then(user => { 18 .then(user => {
19 if (!user) { 19 if (!user) {
20 console.error('User unknown.') 20 console.error('User unknown.')
21 return 21 process.exit(-1)
22 } 22 }
23 23
24 const readline = require('readline') 24 const readline = require('readline')
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 })