+ logger.info('Duplicating %s - %d in videos redundancy with "%s" strategy.', video.url, file.resolution, redundancy.strategy)
+
+ const { baseUrlHttp, baseUrlWs } = video.getBaseUrls()
+ const magnetUri = generateMagnetUri(video, file, baseUrlHttp, baseUrlWs)
+
+ const tmpPath = await downloadWebTorrentVideo({ magnetUri }, VIDEO_IMPORT_TIMEOUT)
+
+ const destPath = join(CONFIG.STORAGE.REDUNDANCY_DIR, getVideoFilename(video, file))
+ await move(tmpPath, destPath, { overwrite: true })
+
+ const createdModel: MVideoRedundancyFileVideo = await VideoRedundancyModel.create({
+ expiresOn: this.buildNewExpiration(redundancy.minLifetime),
+ url: getVideoCacheFileActivityPubUrl(file),
+ fileUrl: video.getVideoRedundancyUrl(file, WEBSERVER.URL),
+ strategy: redundancy.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)