-async function buildNewFile (video: MVideoId, path: string) {
- const videoFile = new VideoFileModel({
- extname: getLowercaseExtension(path),
- size: await getFileSize(path),
- metadata: await buildFileMetadata(path),
- videoStreamingPlaylistId: null,
- videoId: video.id
- })
-
- const probe = await ffprobePromise(path)
-
- videoFile.fps = await getVideoStreamFPS(path, probe)
- videoFile.resolution = (await getVideoStreamDimensionsInfo(path, probe)).resolution
-
- videoFile.filename = generateWebTorrentVideoFilename(videoFile.resolution, videoFile.extname)
-
- return videoFile
-}
-
-async function removeAllFiles (video: MVideoWithAllFiles, webTorrentFileException: MVideoFile) {
- await removeHLSPlaylist(video)
-
- for (const file of video.VideoFiles) {
- if (file.id === webTorrentFileException.id) continue
-
- await removeWebTorrentFile(video, file.id)
- }
-}
-