]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/job-queue/handlers/activitypub-refresher.ts
Use random names for VOD HLS playlists
[github/Chocobozzz/PeerTube.git] / server / lib / job-queue / handlers / activitypub-refresher.ts
index 29483f310a721949425c553dccd3d933d13da1b5..d97e50ebc4b3acf3a7c9638dab2aa02d168d8181 100644 (file)
@@ -1,9 +1,9 @@
 import * as Bull from 'bull'
 import { refreshVideoPlaylistIfNeeded } from '@server/lib/activitypub/playlists'
 import { refreshVideoIfNeeded } from '@server/lib/activitypub/videos'
+import { loadVideoByUrl } from '@server/lib/model-loaders'
 import { RefreshPayload } from '@shared/models'
 import { logger } from '../../../helpers/logger'
-import { fetchVideoByUrl } from '../../../helpers/video'
 import { ActorModel } from '../../../models/actor/actor'
 import { VideoPlaylistModel } from '../../../models/video/video-playlist'
 import { refreshActorIfNeeded } from '../../activitypub/actors'
@@ -30,7 +30,7 @@ async function refreshVideo (videoUrl: string) {
   const fetchType = 'all' as 'all'
   const syncParam = { likes: true, dislikes: true, shares: true, comments: true, thumbnail: true }
 
-  const videoFromDatabase = await fetchVideoByUrl(videoUrl, fetchType)
+  const videoFromDatabase = await loadVideoByUrl(videoUrl, fetchType)
   if (videoFromDatabase) {
     const refreshOptions = {
       video: videoFromDatabase,
@@ -47,7 +47,7 @@ async function refreshActor (actorUrl: string) {
   const actor = await ActorModel.loadByUrlAndPopulateAccountAndChannel(actorUrl)
 
   if (actor) {
-    await refreshActorIfNeeded(actor, fetchType)
+    await refreshActorIfNeeded({ actor, fetchedType: fetchType })
   }
 }