1 import { database as db } from '../server/initializers/database'
2 // import { hasFriends } from '../server/lib/friends'
6 // FIXME: check if has following
10 .then(itHasFriends => {
11 if (itHasFriends === true) {
12 console.log('Cannot update host because you have friends!')
16 console.log('Updating torrent files.')
17 return db.Video.list()
20 const tasks: Promise<any>[] = []
22 videos.forEach(video => {
23 console.log('Updating video ' + video.uuid)
25 video.VideoFiles.forEach(file => {
26 tasks.push(video.createTorrentAndSetInfoHash(file))
30 return Promise.all(tasks)