1 import { readFileSync, writeFileSync } from 'fs'
2 import { join } from 'path'
3 import * as parseTorrent from 'parse-torrent'
5 import { CONFIG, STATIC_PATHS } from '../server/initializers/constants'
6 import { database as db } from '../server/initializers/database'
7 import { hasFriends } from '../server/lib/friends'
13 .then(itHasFriends => {
14 if (itHasFriends === true) {
15 console.log('Cannot update host because you have friends!')
19 console.log('Updating torrent files.')
20 return db.Video.list()
23 videos.forEach(video => {
24 video.VideoFiles.forEach(file => {
25 video.createTorrentAndSetInfoHash(file)