+ const file = fileArg as MVideoFileVideo
+ file.Video = video
+
+ const serverActor = await getServerActor()
+
+ logger.info('Duplicating %s - %d in videos redundancy with "%s" strategy.', video.url, file.resolution, strategy, lTags(video.uuid))
+
+ const tmpPath = await downloadWebTorrentVideo({ uri: file.torrentUrl }, VIDEO_IMPORT_TIMEOUT)
+
+ const destPath = join(CONFIG.STORAGE.REDUNDANCY_DIR, file.filename)
+ await move(tmpPath, destPath, { overwrite: true })
+
+ const createdModel: MVideoRedundancyFileVideo = await VideoRedundancyModel.create({
+ expiresOn,
+ url: getLocalVideoCacheFileActivityPubUrl(file),
+ fileUrl: generateWebTorrentRedundancyUrl(file),
+ strategy,
+ videoFileId: file.id,
+ actorId: serverActor.id
+ })
+
+ createdModel.VideoFile = file
+
+ await sendCreateCacheFile(serverActor, video, createdModel)
+
+ logger.info('Duplicated %s - %d -> %s.', video.url, file.resolution, createdModel.url, lTags(video.uuid))
+ }
+
+ private async createStreamingPlaylistRedundancy (
+ redundancy: VideosRedundancyStrategy,
+ video: MVideoAccountLight,
+ playlistArg: MStreamingPlaylistFiles
+ ) {
+ let strategy = 'manual'
+ let expiresOn: Date = null
+
+ if (redundancy) {
+ strategy = redundancy.strategy
+ expiresOn = this.buildNewExpiration(redundancy.minLifetime)