]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/update-host.ts
Import videos in the correct order
[github/Chocobozzz/PeerTube.git] / scripts / update-host.ts
index 759443623ef74950c8cdfcb65cc9eb5b5422b6f8..3fb5f1972dd85b6491fed4d9979533743dbeefe7 100755 (executable)
@@ -1,12 +1,14 @@
-import { database as db } from '../server/initializers/database'
-import { getServerAccount } from '../server/helpers/utils'
+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'
 
-db.init(true)
+initDatabaseModels(true)
   .then(() => {
-    return getServerAccount()
+    return getServerActor()
   })
   .then(serverAccount => {
-    return db.AccountFollow.listAcceptedFollowingUrlsForApi([ serverAccount.id ], undefined)
+    return ActorFollowModel.listAcceptedFollowingUrlsForApi([ serverAccount.id ], undefined)
   })
   .then(res => {
     return res.total > 0
@@ -18,7 +20,7 @@ db.init(true)
     }
 
     console.log('Updating torrent files.')
-    return db.Video.list()
+    return VideoModel.list()
   })
   .then(videos => {
     const tasks: Promise<any>[] = []