aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dev/index.sh5
-rwxr-xr-xscripts/update-host.ts16
2 files changed, 10 insertions, 11 deletions
diff --git a/scripts/dev/index.sh b/scripts/dev/index.sh
new file mode 100755
index 000000000..938bf6056
--- /dev/null
+++ b/scripts/dev/index.sh
@@ -0,0 +1,5 @@
1#!/usr/bin/env sh
2
3NODE_ENV=test concurrently -k \
4 "npm run watch:client" \
5 "npm run watch:server"
diff --git a/scripts/update-host.ts b/scripts/update-host.ts
index 23e8d5ef3..5e69e4172 100755
--- a/scripts/update-host.ts
+++ b/scripts/update-host.ts
@@ -1,4 +1,5 @@
1import { readFileSync, writeFileSync } from 'fs' 1import { readFileSync, writeFileSync } from 'fs'
2import { join } from 'path'
2import * as parseTorrent from 'parse-torrent' 3import * as parseTorrent from 'parse-torrent'
3 4
4import { CONFIG, STATIC_PATHS } from '../server/initializers/constants' 5import { CONFIG, STATIC_PATHS } from '../server/initializers/constants'
@@ -19,17 +20,10 @@ db.init(true)
19 return db.Video.list() 20 return db.Video.list()
20 }) 21 })
21 .then(videos => { 22 .then(videos => {
22 videos.forEach(function (video) { 23 videos.forEach(video => {
23 const torrentName = video.id + '.torrent' 24 video.VideoFiles.forEach(file => {
24 const torrentPath = CONFIG.STORAGE.TORRENTS_DIR + torrentName 25 video.createTorrentAndSetInfoHash(file)
25 const filename = video.id + video.extname 26 })
26
27 const parsed = parseTorrent(readFileSync(torrentPath))
28 parsed.announce = [ CONFIG.WEBSERVER.WS + '://' + CONFIG.WEBSERVER.HOST + '/tracker/socket' ]
29 parsed.urlList = [ CONFIG.WEBSERVER.URL + STATIC_PATHS.WEBSEED + filename ]
30
31 const buf = parseTorrent.toTorrentFile(parsed)
32 writeFileSync(torrentPath, buf)
33 }) 27 })
34 28
35 process.exit(0) 29 process.exit(0)