diff options
Diffstat (limited to 'server/lib/video-file.ts')
-rw-r--r-- | server/lib/video-file.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/server/lib/video-file.ts b/server/lib/video-file.ts index 88d48c945..46af67ccd 100644 --- a/server/lib/video-file.ts +++ b/server/lib/video-file.ts | |||
@@ -7,7 +7,7 @@ import { getFileSize } from '@shared/extra-utils' | |||
7 | import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, isAudioFile } from '@shared/ffmpeg' | 7 | import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, isAudioFile } from '@shared/ffmpeg' |
8 | import { VideoFileMetadata, VideoResolution } from '@shared/models' | 8 | import { VideoFileMetadata, VideoResolution } from '@shared/models' |
9 | import { lTags } from './object-storage/shared' | 9 | import { lTags } from './object-storage/shared' |
10 | import { generateHLSVideoFilename, generateWebTorrentVideoFilename } from './paths' | 10 | import { generateHLSVideoFilename, generateWebVideoFilename } from './paths' |
11 | import { VideoPathManager } from './video-path-manager' | 11 | import { VideoPathManager } from './video-path-manager' |
12 | 12 | ||
13 | async function buildNewFile (options: { | 13 | async function buildNewFile (options: { |
@@ -33,7 +33,7 @@ async function buildNewFile (options: { | |||
33 | } | 33 | } |
34 | 34 | ||
35 | videoFile.filename = mode === 'web-video' | 35 | videoFile.filename = mode === 'web-video' |
36 | ? generateWebTorrentVideoFilename(videoFile.resolution, videoFile.extname) | 36 | ? generateWebVideoFilename(videoFile.resolution, videoFile.extname) |
37 | : generateHLSVideoFilename(videoFile.resolution) | 37 | : generateHLSVideoFilename(videoFile.resolution) |
38 | 38 | ||
39 | return videoFile | 39 | return videoFile |
@@ -85,12 +85,12 @@ async function removeHLSFile (video: MVideoWithAllFiles, fileToDeleteId: number) | |||
85 | 85 | ||
86 | // --------------------------------------------------------------------------- | 86 | // --------------------------------------------------------------------------- |
87 | 87 | ||
88 | async function removeAllWebTorrentFiles (video: MVideoWithAllFiles) { | 88 | async function removeAllWebVideoFiles (video: MVideoWithAllFiles) { |
89 | const videoFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) | 89 | const videoFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) |
90 | 90 | ||
91 | try { | 91 | try { |
92 | for (const file of video.VideoFiles) { | 92 | for (const file of video.VideoFiles) { |
93 | await video.removeWebTorrentFile(file) | 93 | await video.removeWebVideoFile(file) |
94 | await file.destroy() | 94 | await file.destroy() |
95 | } | 95 | } |
96 | 96 | ||
@@ -102,17 +102,17 @@ async function removeAllWebTorrentFiles (video: MVideoWithAllFiles) { | |||
102 | return video | 102 | return video |
103 | } | 103 | } |
104 | 104 | ||
105 | async function removeWebTorrentFile (video: MVideoWithAllFiles, fileToDeleteId: number) { | 105 | async function removeWebVideoFile (video: MVideoWithAllFiles, fileToDeleteId: number) { |
106 | const files = video.VideoFiles | 106 | const files = video.VideoFiles |
107 | 107 | ||
108 | if (files.length === 1) { | 108 | if (files.length === 1) { |
109 | return removeAllWebTorrentFiles(video) | 109 | return removeAllWebVideoFiles(video) |
110 | } | 110 | } |
111 | 111 | ||
112 | const videoFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) | 112 | const videoFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) |
113 | try { | 113 | try { |
114 | const toDelete = files.find(f => f.id === fileToDeleteId) | 114 | const toDelete = files.find(f => f.id === fileToDeleteId) |
115 | await video.removeWebTorrentFile(toDelete) | 115 | await video.removeWebVideoFile(toDelete) |
116 | await toDelete.destroy() | 116 | await toDelete.destroy() |
117 | 117 | ||
118 | video.VideoFiles = files.filter(f => f.id !== toDelete.id) | 118 | video.VideoFiles = files.filter(f => f.id !== toDelete.id) |
@@ -138,8 +138,8 @@ export { | |||
138 | 138 | ||
139 | removeHLSPlaylist, | 139 | removeHLSPlaylist, |
140 | removeHLSFile, | 140 | removeHLSFile, |
141 | removeAllWebTorrentFiles, | 141 | removeAllWebVideoFiles, |
142 | removeWebTorrentFile, | 142 | removeWebVideoFile, |
143 | 143 | ||
144 | buildFileMetadata | 144 | buildFileMetadata |
145 | } | 145 | } |