Improve update host script
This commit is contained in:
parent
07aa93a8f2
commit
c91de74372
|
@ -22,18 +22,13 @@ initDatabaseModels(true)
|
||||||
console.log('Updating torrent files.')
|
console.log('Updating torrent files.')
|
||||||
return VideoModel.list()
|
return VideoModel.list()
|
||||||
})
|
})
|
||||||
.then(videos => {
|
.then(async videos => {
|
||||||
const tasks: Promise<any>[] = []
|
for (const video of videos) {
|
||||||
|
for (const file of video.VideoFiles) {
|
||||||
videos.forEach(video => {
|
await video.createTorrentAndSetInfoHash(file)
|
||||||
console.log('Updating video ' + video.uuid)
|
console.log('Updated video ' + video.uuid)
|
||||||
|
}
|
||||||
video.VideoFiles.forEach(file => {
|
}
|
||||||
tasks.push(video.createTorrentAndSetInfoHash(file))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
return Promise.all(tasks)
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
|
|
Loading…
Reference in New Issue