+ liveSession.replayVideoId = replayVideo.id
+ await liveSession.save()
+
+ // If live is blacklisted, also blacklist the replay
+ const blacklist = await VideoBlacklistModel.loadByVideoId(liveVideo.id)
+ if (blacklist) {
+ await VideoBlacklistModel.create({
+ videoId: replayVideo.id,
+ unfederated: blacklist.unfederated,
+ reason: blacklist.reason,
+ type: blacklist.type
+ })
+ }
+
+ await assignReplayFilesToVideo({ video: replayVideo, replayDirectory })
+
+ await remove(replayDirectory)
+
+ for (const type of [ ThumbnailType.MINIATURE, ThumbnailType.PREVIEW ]) {
+ const image = await generateVideoMiniature({ video: replayVideo, videoFile: replayVideo.getMaxQualityFile(), type })
+ await replayVideo.addAndSaveThumbnail(image)