From 93e1258c7cbc0d1235ca6d2a1f7c1875985328b8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 25 Aug 2017 11:36:23 +0200 Subject: Move video file metadata in their own table Will be used for user video quotas and multiple video resolutions --- scripts/dev/index.sh | 5 +++++ scripts/update-host.ts | 16 +++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) create mode 100755 scripts/dev/index.sh (limited to 'scripts') 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 @@ +#!/usr/bin/env sh + +NODE_ENV=test concurrently -k \ + "npm run watch:client" \ + "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 @@ import { readFileSync, writeFileSync } from 'fs' +import { join } from 'path' import * as parseTorrent from 'parse-torrent' import { CONFIG, STATIC_PATHS } from '../server/initializers/constants' @@ -19,17 +20,10 @@ db.init(true) return db.Video.list() }) .then(videos => { - videos.forEach(function (video) { - const torrentName = video.id + '.torrent' - const torrentPath = CONFIG.STORAGE.TORRENTS_DIR + torrentName - const filename = video.id + video.extname - - const parsed = parseTorrent(readFileSync(torrentPath)) - parsed.announce = [ CONFIG.WEBSERVER.WS + '://' + CONFIG.WEBSERVER.HOST + '/tracker/socket' ] - parsed.urlList = [ CONFIG.WEBSERVER.URL + STATIC_PATHS.WEBSEED + filename ] - - const buf = parseTorrent.toTorrentFile(parsed) - writeFileSync(torrentPath, buf) + videos.forEach(video => { + video.VideoFiles.forEach(file => { + video.createTorrentAndSetInfoHash(file) + }) }) process.exit(0) -- cgit v1.2.3