]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/update-host.ts
Rename "my settings" to "my account" in menu
[github/Chocobozzz/PeerTube.git] / scripts / update-host.ts
index 4551a4702aac0243c1fc1badf9319d1ad5794fd6..ed8b999a9f42c8d43a24e2a1b9b0e1425b3a0516 100755 (executable)
@@ -1,4 +1,4 @@
-import { getServerActor } from '../server/helpers'
+import { getServerActor } from '../server/helpers/utils'
 import { initDatabaseModels } from '../server/initializers'
 import { ActorFollowModel } from '../server/models/activitypub/actor-follow'
 import { VideoModel } from '../server/models/video/video'
@@ -22,18 +22,13 @@ initDatabaseModels(true)
     console.log('Updating torrent files.')
     return VideoModel.list()
   })
-  .then(videos => {
-    const tasks: Promise<any>[] = []
-
-    videos.forEach(video => {
-      console.log('Updating video ' + video.uuid)
-
-      video.VideoFiles.forEach(file => {
-        tasks.push(video.createTorrentAndSetInfoHash(file))
-      })
-    })
-
-    return Promise.all(tasks)
+  .then(async videos => {
+    for (const video of videos) {
+      for (const file of video.VideoFiles) {
+        await video.createTorrentAndSetInfoHash(file)
+        console.log('Updated video ' + video.uuid)
+      }
+    }
   })
   .then(() => {
     process.exit(0)