aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-08-25 11:36:23 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-08-25 11:36:23 +0200
commit93e1258c7cbc0d1235ca6d2a1f7c1875985328b8 (patch)
treeb0a1f77af7ab54dc5f58f569fcd1e9d84b04c533 /scripts
parent69f224587e99d56008e1fa129d0641840a486620 (diff)
downloadPeerTube-93e1258c7cbc0d1235ca6d2a1f7c1875985328b8.tar.gz
PeerTube-93e1258c7cbc0d1235ca6d2a1f7c1875985328b8.tar.zst
PeerTube-93e1258c7cbc0d1235ca6d2a1f7c1875985328b8.zip
Move video file metadata in their own table
Will be used for user video quotas and multiple video resolutions
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)