1 import { database as db } from '../server/initializers/database'
2 import { getServerAccount } from '../server/helpers/utils'
6 return getServerAccount()
8 .then(serverAccount => {
9 return db.AccountFollow.listAcceptedFollowingUrlsForApi([ serverAccount.id ], undefined)
14 .then(hasFollowing => {
15 if (hasFollowing === true) {
16 console.log('Cannot update host because you follow other servers!')
20 console.log('Updating torrent files.')
21 return db.Video.list()
24 const tasks: Promise<any>[] = []
26 videos.forEach(video => {
27 console.log('Updating video ' + video.uuid)
29 video.VideoFiles.forEach(file => {
30 tasks.push(video.createTorrentAndSetInfoHash(file))
34 return Promise.all(tasks)