+ 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)
+ }
+
+ private async createStreamingPlaylistRedundancy (
+ redundancy: VideosRedundancyStrategy,
+ video: MVideoAccountLight,
+ playlistArg: MStreamingPlaylist
+ ) {
+ let strategy = 'manual'
+ let expiresOn: Date = null
+
+ if (redundancy) {
+ strategy = redundancy.strategy
+ expiresOn = this.buildNewExpiration(redundancy.minLifetime)