aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/videos/shared/abstract-builder.ts2
-rw-r--r--server/lib/activitypub/videos/shared/creator.ts2
-rw-r--r--server/lib/activitypub/videos/updater.ts2
-rw-r--r--server/lib/job-queue/handlers/move-to-object-storage.ts10
-rw-r--r--server/lib/job-queue/handlers/video-file-import.ts6
-rw-r--r--server/lib/job-queue/handlers/video-import.ts4
-rw-r--r--server/lib/job-queue/handlers/video-transcoding.ts32
-rw-r--r--server/lib/object-storage/keys.ts4
-rw-r--r--server/lib/object-storage/pre-signed-urls.ts8
-rw-r--r--server/lib/object-storage/proxy.ts8
-rw-r--r--server/lib/object-storage/urls.ts8
-rw-r--r--server/lib/object-storage/videos.ts34
-rw-r--r--server/lib/paths.ts4
-rw-r--r--server/lib/plugins/plugin-helpers-builder.ts10
-rw-r--r--server/lib/runners/job-handlers/shared/vod-helpers.ts4
-rw-r--r--server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts2
-rw-r--r--server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts4
-rw-r--r--server/lib/schedulers/videos-redundancy-scheduler.ts4
-rw-r--r--server/lib/transcoding/create-transcoding-job.ts2
-rw-r--r--server/lib/transcoding/shared/job-builders/abstract-job-builder.ts2
-rw-r--r--server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts40
-rw-r--r--server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts4
-rw-r--r--server/lib/transcoding/web-transcoding.ts24
-rw-r--r--server/lib/video-file.ts18
-rw-r--r--server/lib/video-path-manager.ts4
-rw-r--r--server/lib/video-privacy.ts16
-rw-r--r--server/lib/video-studio.ts8
-rw-r--r--server/lib/video-urls.ts4
28 files changed, 137 insertions, 133 deletions
diff --git a/server/lib/activitypub/videos/shared/abstract-builder.ts b/server/lib/activitypub/videos/shared/abstract-builder.ts
index 8b6a7fd75..98c2f58eb 100644
--- a/server/lib/activitypub/videos/shared/abstract-builder.ts
+++ b/server/lib/activitypub/videos/shared/abstract-builder.ts
@@ -126,7 +126,7 @@ export abstract class APVideoAbstractBuilder {
126 video.VideoLive = videoLive 126 video.VideoLive = videoLive
127 } 127 }
128 128
129 protected async setWebTorrentFiles (video: MVideoFullLight, t: Transaction) { 129 protected async setWebVideoFiles (video: MVideoFullLight, t: Transaction) {
130 const videoFileAttributes = getFileAttributesFromUrl(video, this.videoObject.url) 130 const videoFileAttributes = getFileAttributesFromUrl(video, this.videoObject.url)
131 const newVideoFiles = videoFileAttributes.map(a => new VideoFileModel(a)) 131 const newVideoFiles = videoFileAttributes.map(a => new VideoFileModel(a))
132 132
diff --git a/server/lib/activitypub/videos/shared/creator.ts b/server/lib/activitypub/videos/shared/creator.ts
index 3d646ef66..bc139e4fa 100644
--- a/server/lib/activitypub/videos/shared/creator.ts
+++ b/server/lib/activitypub/videos/shared/creator.ts
@@ -33,7 +33,7 @@ export class APVideoCreator extends APVideoAbstractBuilder {
33 33
34 await this.setThumbnail(videoCreated, t) 34 await this.setThumbnail(videoCreated, t)
35 await this.setPreview(videoCreated, t) 35 await this.setPreview(videoCreated, t)
36 await this.setWebTorrentFiles(videoCreated, t) 36 await this.setWebVideoFiles(videoCreated, t)
37 await this.setStreamingPlaylists(videoCreated, t) 37 await this.setStreamingPlaylists(videoCreated, t)
38 await this.setTags(videoCreated, t) 38 await this.setTags(videoCreated, t)
39 await this.setTrackers(videoCreated, t) 39 await this.setTrackers(videoCreated, t)
diff --git a/server/lib/activitypub/videos/updater.ts b/server/lib/activitypub/videos/updater.ts
index c98bce662..522d7b043 100644
--- a/server/lib/activitypub/videos/updater.ts
+++ b/server/lib/activitypub/videos/updater.ts
@@ -50,7 +50,7 @@ export class APVideoUpdater extends APVideoAbstractBuilder {
50 if (thumbnailModel) await videoUpdated.addAndSaveThumbnail(thumbnailModel) 50 if (thumbnailModel) await videoUpdated.addAndSaveThumbnail(thumbnailModel)
51 51
52 await runInReadCommittedTransaction(async t => { 52 await runInReadCommittedTransaction(async t => {
53 await this.setWebTorrentFiles(videoUpdated, t) 53 await this.setWebVideoFiles(videoUpdated, t)
54 await this.setStreamingPlaylists(videoUpdated, t) 54 await this.setStreamingPlaylists(videoUpdated, t)
55 }) 55 })
56 56
diff --git a/server/lib/job-queue/handlers/move-to-object-storage.ts b/server/lib/job-queue/handlers/move-to-object-storage.ts
index 26752ff37..9a99b6722 100644
--- a/server/lib/job-queue/handlers/move-to-object-storage.ts
+++ b/server/lib/job-queue/handlers/move-to-object-storage.ts
@@ -4,7 +4,7 @@ import { join } from 'path'
4import { logger, loggerTagsFactory } from '@server/helpers/logger' 4import { logger, loggerTagsFactory } from '@server/helpers/logger'
5import { updateTorrentMetadata } from '@server/helpers/webtorrent' 5import { updateTorrentMetadata } from '@server/helpers/webtorrent'
6import { P2P_MEDIA_LOADER_PEER_VERSION } from '@server/initializers/constants' 6import { P2P_MEDIA_LOADER_PEER_VERSION } from '@server/initializers/constants'
7import { storeHLSFileFromFilename, storeWebTorrentFile } from '@server/lib/object-storage' 7import { storeHLSFileFromFilename, storeWebVideoFile } from '@server/lib/object-storage'
8import { getHLSDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths' 8import { getHLSDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths'
9import { VideoPathManager } from '@server/lib/video-path-manager' 9import { VideoPathManager } from '@server/lib/video-path-manager'
10import { moveToFailedMoveToObjectStorageState, moveToNextState } from '@server/lib/video-state' 10import { moveToFailedMoveToObjectStorageState, moveToNextState } from '@server/lib/video-state'
@@ -33,9 +33,9 @@ export async function processMoveToObjectStorage (job: Job) {
33 33
34 try { 34 try {
35 if (video.VideoFiles) { 35 if (video.VideoFiles) {
36 logger.debug('Moving %d webtorrent files for video %s.', video.VideoFiles.length, video.uuid, lTags) 36 logger.debug('Moving %d web video files for video %s.', video.VideoFiles.length, video.uuid, lTags)
37 37
38 await moveWebTorrentFiles(video) 38 await moveWebVideoFiles(video)
39 } 39 }
40 40
41 if (video.VideoStreamingPlaylists) { 41 if (video.VideoStreamingPlaylists) {
@@ -75,11 +75,11 @@ export async function onMoveToObjectStorageFailure (job: Job, err: any) {
75 75
76// --------------------------------------------------------------------------- 76// ---------------------------------------------------------------------------
77 77
78async function moveWebTorrentFiles (video: MVideoWithAllFiles) { 78async function moveWebVideoFiles (video: MVideoWithAllFiles) {
79 for (const file of video.VideoFiles) { 79 for (const file of video.VideoFiles) {
80 if (file.storage !== VideoStorage.FILE_SYSTEM) continue 80 if (file.storage !== VideoStorage.FILE_SYSTEM) continue
81 81
82 const fileUrl = await storeWebTorrentFile(video, file) 82 const fileUrl = await storeWebVideoFile(video, file)
83 83
84 const oldPath = VideoPathManager.Instance.getFSVideoFileOutputPath(video, file) 84 const oldPath = VideoPathManager.Instance.getFSVideoFileOutputPath(video, file)
85 await onFileMoved({ videoOrPlaylist: video, file, fileUrl, oldPath }) 85 await onFileMoved({ videoOrPlaylist: video, file, fileUrl, oldPath })
diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.ts
index 9a4550e4d..d221e8968 100644
--- a/server/lib/job-queue/handlers/video-file-import.ts
+++ b/server/lib/job-queue/handlers/video-file-import.ts
@@ -3,7 +3,7 @@ import { copy, stat } from 'fs-extra'
3import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' 3import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
4import { CONFIG } from '@server/initializers/config' 4import { CONFIG } from '@server/initializers/config'
5import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' 5import { federateVideoIfNeeded } from '@server/lib/activitypub/videos'
6import { generateWebTorrentVideoFilename } from '@server/lib/paths' 6import { generateWebVideoFilename } from '@server/lib/paths'
7import { buildMoveToObjectStorageJob } from '@server/lib/video' 7import { buildMoveToObjectStorageJob } from '@server/lib/video'
8import { VideoPathManager } from '@server/lib/video-path-manager' 8import { VideoPathManager } from '@server/lib/video-path-manager'
9import { VideoModel } from '@server/models/video/video' 9import { VideoModel } from '@server/models/video/video'
@@ -56,7 +56,7 @@ async function updateVideoFile (video: MVideoFullLight, inputFilePath: string) {
56 56
57 if (currentVideoFile) { 57 if (currentVideoFile) {
58 // Remove old file and old torrent 58 // Remove old file and old torrent
59 await video.removeWebTorrentFile(currentVideoFile) 59 await video.removeWebVideoFile(currentVideoFile)
60 // Remove the old video file from the array 60 // Remove the old video file from the array
61 video.VideoFiles = video.VideoFiles.filter(f => f !== currentVideoFile) 61 video.VideoFiles = video.VideoFiles.filter(f => f !== currentVideoFile)
62 62
@@ -66,7 +66,7 @@ async function updateVideoFile (video: MVideoFullLight, inputFilePath: string) {
66 const newVideoFile = new VideoFileModel({ 66 const newVideoFile = new VideoFileModel({
67 resolution, 67 resolution,
68 extname: fileExt, 68 extname: fileExt,
69 filename: generateWebTorrentVideoFilename(resolution, fileExt), 69 filename: generateWebVideoFilename(resolution, fileExt),
70 storage: VideoStorage.FILE_SYSTEM, 70 storage: VideoStorage.FILE_SYSTEM,
71 size, 71 size,
72 fps, 72 fps,
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts
index 436bf3175..e5cd258d6 100644
--- a/server/lib/job-queue/handlers/video-import.ts
+++ b/server/lib/job-queue/handlers/video-import.ts
@@ -4,7 +4,7 @@ import { retryTransactionWrapper } from '@server/helpers/database-utils'
4import { YoutubeDLWrapper } from '@server/helpers/youtube-dl' 4import { YoutubeDLWrapper } from '@server/helpers/youtube-dl'
5import { CONFIG } from '@server/initializers/config' 5import { CONFIG } from '@server/initializers/config'
6import { isPostImportVideoAccepted } from '@server/lib/moderation' 6import { isPostImportVideoAccepted } from '@server/lib/moderation'
7import { generateWebTorrentVideoFilename } from '@server/lib/paths' 7import { generateWebVideoFilename } from '@server/lib/paths'
8import { Hooks } from '@server/lib/plugins/hooks' 8import { Hooks } from '@server/lib/plugins/hooks'
9import { ServerConfigManager } from '@server/lib/server-config-manager' 9import { ServerConfigManager } from '@server/lib/server-config-manager'
10import { createOptimizeOrMergeAudioJobs } from '@server/lib/transcoding/create-transcoding-job' 10import { createOptimizeOrMergeAudioJobs } from '@server/lib/transcoding/create-transcoding-job'
@@ -148,7 +148,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: MVid
148 extname: fileExt, 148 extname: fileExt,
149 resolution, 149 resolution,
150 size: stats.size, 150 size: stats.size,
151 filename: generateWebTorrentVideoFilename(resolution, fileExt), 151 filename: generateWebVideoFilename(resolution, fileExt),
152 fps, 152 fps,
153 videoId: videoImport.videoId 153 videoId: videoImport.videoId
154 } 154 }
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts
index f8758f170..1c8f4fd9f 100644
--- a/server/lib/job-queue/handlers/video-transcoding.ts
+++ b/server/lib/job-queue/handlers/video-transcoding.ts
@@ -1,8 +1,8 @@
1import { Job } from 'bullmq' 1import { Job } from 'bullmq'
2import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding' 2import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding'
3import { generateHlsPlaylistResolution } from '@server/lib/transcoding/hls-transcoding' 3import { generateHlsPlaylistResolution } from '@server/lib/transcoding/hls-transcoding'
4import { mergeAudioVideofile, optimizeOriginalVideofile, transcodeNewWebTorrentResolution } from '@server/lib/transcoding/web-transcoding' 4import { mergeAudioVideofile, optimizeOriginalVideofile, transcodeNewWebVideoResolution } from '@server/lib/transcoding/web-transcoding'
5import { removeAllWebTorrentFiles } from '@server/lib/video-file' 5import { removeAllWebVideoFiles } from '@server/lib/video-file'
6import { VideoPathManager } from '@server/lib/video-path-manager' 6import { VideoPathManager } from '@server/lib/video-path-manager'
7import { moveToFailedTranscodingState } from '@server/lib/video-state' 7import { moveToFailedTranscodingState } from '@server/lib/video-state'
8import { UserModel } from '@server/models/user/user' 8import { UserModel } from '@server/models/user/user'
@@ -11,7 +11,7 @@ import { MUser, MUserId, MVideoFullLight } from '@server/types/models'
11import { 11import {
12 HLSTranscodingPayload, 12 HLSTranscodingPayload,
13 MergeAudioTranscodingPayload, 13 MergeAudioTranscodingPayload,
14 NewWebTorrentResolutionTranscodingPayload, 14 NewWebVideoResolutionTranscodingPayload,
15 OptimizeTranscodingPayload, 15 OptimizeTranscodingPayload,
16 VideoTranscodingPayload 16 VideoTranscodingPayload
17} from '@shared/models' 17} from '@shared/models'
@@ -22,9 +22,9 @@ type HandlerFunction = (job: Job, payload: VideoTranscodingPayload, video: MVide
22 22
23const handlers: { [ id in VideoTranscodingPayload['type'] ]: HandlerFunction } = { 23const handlers: { [ id in VideoTranscodingPayload['type'] ]: HandlerFunction } = {
24 'new-resolution-to-hls': handleHLSJob, 24 'new-resolution-to-hls': handleHLSJob,
25 'new-resolution-to-webtorrent': handleNewWebTorrentResolutionJob, 25 'new-resolution-to-web-video': handleNewWebVideoResolutionJob,
26 'merge-audio-to-webtorrent': handleWebTorrentMergeAudioJob, 26 'merge-audio-to-web-video': handleWebVideoMergeAudioJob,
27 'optimize-to-webtorrent': handleWebTorrentOptimizeJob 27 'optimize-to-web-video': handleWebVideoOptimizeJob
28} 28}
29 29
30const lTags = loggerTagsFactory('transcoding') 30const lTags = loggerTagsFactory('transcoding')
@@ -74,7 +74,7 @@ export {
74// Job handlers 74// Job handlers
75// --------------------------------------------------------------------------- 75// ---------------------------------------------------------------------------
76 76
77async function handleWebTorrentMergeAudioJob (job: Job, payload: MergeAudioTranscodingPayload, video: MVideoFullLight, user: MUserId) { 77async function handleWebVideoMergeAudioJob (job: Job, payload: MergeAudioTranscodingPayload, video: MVideoFullLight, user: MUserId) {
78 logger.info('Handling merge audio transcoding job for %s.', video.uuid, lTags(video.uuid), { payload }) 78 logger.info('Handling merge audio transcoding job for %s.', video.uuid, lTags(video.uuid), { payload })
79 79
80 await mergeAudioVideofile({ video, resolution: payload.resolution, fps: payload.fps, job }) 80 await mergeAudioVideofile({ video, resolution: payload.resolution, fps: payload.fps, job })
@@ -84,7 +84,7 @@ async function handleWebTorrentMergeAudioJob (job: Job, payload: MergeAudioTrans
84 await onTranscodingEnded({ isNewVideo: payload.isNewVideo, moveVideoToNextState: !payload.hasChildren, video }) 84 await onTranscodingEnded({ isNewVideo: payload.isNewVideo, moveVideoToNextState: !payload.hasChildren, video })
85} 85}
86 86
87async function handleWebTorrentOptimizeJob (job: Job, payload: OptimizeTranscodingPayload, video: MVideoFullLight, user: MUserId) { 87async function handleWebVideoOptimizeJob (job: Job, payload: OptimizeTranscodingPayload, video: MVideoFullLight, user: MUserId) {
88 logger.info('Handling optimize transcoding job for %s.', video.uuid, lTags(video.uuid), { payload }) 88 logger.info('Handling optimize transcoding job for %s.', video.uuid, lTags(video.uuid), { payload })
89 89
90 await optimizeOriginalVideofile({ video, inputVideoFile: video.getMaxQualityFile(), quickTranscode: payload.quickTranscode, job }) 90 await optimizeOriginalVideofile({ video, inputVideoFile: video.getMaxQualityFile(), quickTranscode: payload.quickTranscode, job })
@@ -96,12 +96,12 @@ async function handleWebTorrentOptimizeJob (job: Job, payload: OptimizeTranscodi
96 96
97// --------------------------------------------------------------------------- 97// ---------------------------------------------------------------------------
98 98
99async function handleNewWebTorrentResolutionJob (job: Job, payload: NewWebTorrentResolutionTranscodingPayload, video: MVideoFullLight) { 99async function handleNewWebVideoResolutionJob (job: Job, payload: NewWebVideoResolutionTranscodingPayload, video: MVideoFullLight) {
100 logger.info('Handling WebTorrent transcoding job for %s.', video.uuid, lTags(video.uuid), { payload }) 100 logger.info('Handling Web Video transcoding job for %s.', video.uuid, lTags(video.uuid), { payload })
101 101
102 await transcodeNewWebTorrentResolution({ video, resolution: payload.resolution, fps: payload.fps, job }) 102 await transcodeNewWebVideoResolution({ video, resolution: payload.resolution, fps: payload.fps, job })
103 103
104 logger.info('WebTorrent transcoding job for %s ended.', video.uuid, lTags(video.uuid), { payload }) 104 logger.info('Web Video transcoding job for %s ended.', video.uuid, lTags(video.uuid), { payload })
105 105
106 await onTranscodingEnded({ isNewVideo: payload.isNewVideo, moveVideoToNextState: true, video }) 106 await onTranscodingEnded({ isNewVideo: payload.isNewVideo, moveVideoToNextState: true, video })
107} 107}
@@ -118,7 +118,7 @@ async function handleHLSJob (job: Job, payload: HLSTranscodingPayload, videoArg:
118 video = await VideoModel.loadFull(videoArg.uuid) 118 video = await VideoModel.loadFull(videoArg.uuid)
119 119
120 const videoFileInput = payload.copyCodecs 120 const videoFileInput = payload.copyCodecs
121 ? video.getWebTorrentFile(payload.resolution) 121 ? video.getWebVideoFile(payload.resolution)
122 : video.getMaxQualityFile() 122 : video.getMaxQualityFile()
123 123
124 const videoOrStreamingPlaylist = videoFileInput.getVideoOrStreamingPlaylist() 124 const videoOrStreamingPlaylist = videoFileInput.getVideoOrStreamingPlaylist()
@@ -140,10 +140,10 @@ async function handleHLSJob (job: Job, payload: HLSTranscodingPayload, videoArg:
140 140
141 logger.info('HLS transcoding job for %s ended.', video.uuid, lTags(video.uuid), { payload }) 141 logger.info('HLS transcoding job for %s ended.', video.uuid, lTags(video.uuid), { payload })
142 142
143 if (payload.deleteWebTorrentFiles === true) { 143 if (payload.deleteWebVideoFiles === true) {
144 logger.info('Removing WebTorrent files of %s now we have a HLS version of it.', video.uuid, lTags(video.uuid)) 144 logger.info('Removing Web Video files of %s now we have a HLS version of it.', video.uuid, lTags(video.uuid))
145 145
146 await removeAllWebTorrentFiles(video) 146 await removeAllWebVideoFiles(video)
147 } 147 }
148 148
149 await onTranscodingEnded({ isNewVideo: payload.isNewVideo, moveVideoToNextState: true, video }) 149 await onTranscodingEnded({ isNewVideo: payload.isNewVideo, moveVideoToNextState: true, video })
diff --git a/server/lib/object-storage/keys.ts b/server/lib/object-storage/keys.ts
index 4f17073f4..6d2098298 100644
--- a/server/lib/object-storage/keys.ts
+++ b/server/lib/object-storage/keys.ts
@@ -9,12 +9,12 @@ function generateHLSObjectBaseStorageKey (playlist: MStreamingPlaylistVideo) {
9 return join(playlist.getStringType(), playlist.Video.uuid) 9 return join(playlist.getStringType(), playlist.Video.uuid)
10} 10}
11 11
12function generateWebTorrentObjectStorageKey (filename: string) { 12function generateWebVideoObjectStorageKey (filename: string) {
13 return filename 13 return filename
14} 14}
15 15
16export { 16export {
17 generateHLSObjectStorageKey, 17 generateHLSObjectStorageKey,
18 generateHLSObjectBaseStorageKey, 18 generateHLSObjectBaseStorageKey,
19 generateWebTorrentObjectStorageKey 19 generateWebVideoObjectStorageKey
20} 20}
diff --git a/server/lib/object-storage/pre-signed-urls.ts b/server/lib/object-storage/pre-signed-urls.ts
index d8473d01e..313654a57 100644
--- a/server/lib/object-storage/pre-signed-urls.ts
+++ b/server/lib/object-storage/pre-signed-urls.ts
@@ -2,9 +2,9 @@ import { GetObjectCommand } from '@aws-sdk/client-s3'
2import { getSignedUrl } from '@aws-sdk/s3-request-presigner' 2import { getSignedUrl } from '@aws-sdk/s3-request-presigner'
3import { CONFIG } from '@server/initializers/config' 3import { CONFIG } from '@server/initializers/config'
4import { MStreamingPlaylistVideo, MVideoFile } from '@server/types/models' 4import { MStreamingPlaylistVideo, MVideoFile } from '@server/types/models'
5import { generateHLSObjectStorageKey, generateWebTorrentObjectStorageKey } from './keys' 5import { generateHLSObjectStorageKey, generateWebVideoObjectStorageKey } from './keys'
6import { buildKey, getClient } from './shared' 6import { buildKey, getClient } from './shared'
7import { getHLSPublicFileUrl, getWebTorrentPublicFileUrl } from './urls' 7import { getHLSPublicFileUrl, getWebVideoPublicFileUrl } from './urls'
8 8
9export async function generateWebVideoPresignedUrl (options: { 9export async function generateWebVideoPresignedUrl (options: {
10 file: MVideoFile 10 file: MVideoFile
@@ -12,7 +12,7 @@ export async function generateWebVideoPresignedUrl (options: {
12}) { 12}) {
13 const { file, downloadFilename } = options 13 const { file, downloadFilename } = options
14 14
15 const key = generateWebTorrentObjectStorageKey(file.filename) 15 const key = generateWebVideoObjectStorageKey(file.filename)
16 16
17 const command = new GetObjectCommand({ 17 const command = new GetObjectCommand({
18 Bucket: CONFIG.OBJECT_STORAGE.VIDEOS.BUCKET_NAME, 18 Bucket: CONFIG.OBJECT_STORAGE.VIDEOS.BUCKET_NAME,
@@ -22,7 +22,7 @@ export async function generateWebVideoPresignedUrl (options: {
22 22
23 const url = await getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 }) 23 const url = await getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 })
24 24
25 return getWebTorrentPublicFileUrl(url) 25 return getWebVideoPublicFileUrl(url)
26} 26}
27 27
28export async function generateHLSFilePresignedUrl (options: { 28export async function generateHLSFilePresignedUrl (options: {
diff --git a/server/lib/object-storage/proxy.ts b/server/lib/object-storage/proxy.ts
index c782a8a25..c09a0d1b0 100644
--- a/server/lib/object-storage/proxy.ts
+++ b/server/lib/object-storage/proxy.ts
@@ -7,19 +7,19 @@ import { StreamReplacer } from '@server/helpers/stream-replacer'
7import { MStreamingPlaylist, MVideo } from '@server/types/models' 7import { MStreamingPlaylist, MVideo } from '@server/types/models'
8import { HttpStatusCode } from '@shared/models' 8import { HttpStatusCode } from '@shared/models'
9import { injectQueryToPlaylistUrls } from '../hls' 9import { injectQueryToPlaylistUrls } from '../hls'
10import { getHLSFileReadStream, getWebTorrentFileReadStream } from './videos' 10import { getHLSFileReadStream, getWebVideoFileReadStream } from './videos'
11 11
12export async function proxifyWebTorrentFile (options: { 12export async function proxifyWebVideoFile (options: {
13 req: express.Request 13 req: express.Request
14 res: express.Response 14 res: express.Response
15 filename: string 15 filename: string
16}) { 16}) {
17 const { req, res, filename } = options 17 const { req, res, filename } = options
18 18
19 logger.debug('Proxifying WebTorrent file %s from object storage.', filename) 19 logger.debug('Proxifying Web Video file %s from object storage.', filename)
20 20
21 try { 21 try {
22 const { response: s3Response, stream } = await getWebTorrentFileReadStream({ 22 const { response: s3Response, stream } = await getWebVideoFileReadStream({
23 filename, 23 filename,
24 rangeHeader: req.header('range') 24 rangeHeader: req.header('range')
25 }) 25 })
diff --git a/server/lib/object-storage/urls.ts b/server/lib/object-storage/urls.ts
index b8ef94559..84bc1f6c0 100644
--- a/server/lib/object-storage/urls.ts
+++ b/server/lib/object-storage/urls.ts
@@ -9,7 +9,7 @@ function getInternalUrl (config: BucketInfo, keyWithoutPrefix: string) {
9 9
10// --------------------------------------------------------------------------- 10// ---------------------------------------------------------------------------
11 11
12function getWebTorrentPublicFileUrl (fileUrl: string) { 12function getWebVideoPublicFileUrl (fileUrl: string) {
13 const baseUrl = CONFIG.OBJECT_STORAGE.VIDEOS.BASE_URL 13 const baseUrl = CONFIG.OBJECT_STORAGE.VIDEOS.BASE_URL
14 if (!baseUrl) return fileUrl 14 if (!baseUrl) return fileUrl
15 15
@@ -29,7 +29,7 @@ function getHLSPrivateFileUrl (video: MVideoUUID, filename: string) {
29 return WEBSERVER.URL + OBJECT_STORAGE_PROXY_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS + video.uuid + `/${filename}` 29 return WEBSERVER.URL + OBJECT_STORAGE_PROXY_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS + video.uuid + `/${filename}`
30} 30}
31 31
32function getWebTorrentPrivateFileUrl (filename: string) { 32function getWebVideoPrivateFileUrl (filename: string) {
33 return WEBSERVER.URL + OBJECT_STORAGE_PROXY_PATHS.PRIVATE_WEBSEED + filename 33 return WEBSERVER.URL + OBJECT_STORAGE_PROXY_PATHS.PRIVATE_WEBSEED + filename
34} 34}
35 35
@@ -38,11 +38,11 @@ function getWebTorrentPrivateFileUrl (filename: string) {
38export { 38export {
39 getInternalUrl, 39 getInternalUrl,
40 40
41 getWebTorrentPublicFileUrl, 41 getWebVideoPublicFileUrl,
42 getHLSPublicFileUrl, 42 getHLSPublicFileUrl,
43 43
44 getHLSPrivateFileUrl, 44 getHLSPrivateFileUrl,
45 getWebTorrentPrivateFileUrl, 45 getWebVideoPrivateFileUrl,
46 46
47 replaceByBaseUrl 47 replaceByBaseUrl
48} 48}
diff --git a/server/lib/object-storage/videos.ts b/server/lib/object-storage/videos.ts
index 9152c5352..300c1f7e1 100644
--- a/server/lib/object-storage/videos.ts
+++ b/server/lib/object-storage/videos.ts
@@ -4,7 +4,7 @@ import { CONFIG } from '@server/initializers/config'
4import { MStreamingPlaylistVideo, MVideo, MVideoFile } from '@server/types/models' 4import { MStreamingPlaylistVideo, MVideo, MVideoFile } from '@server/types/models'
5import { getHLSDirectory } from '../paths' 5import { getHLSDirectory } from '../paths'
6import { VideoPathManager } from '../video-path-manager' 6import { VideoPathManager } from '../video-path-manager'
7import { generateHLSObjectBaseStorageKey, generateHLSObjectStorageKey, generateWebTorrentObjectStorageKey } from './keys' 7import { generateHLSObjectBaseStorageKey, generateHLSObjectStorageKey, generateWebVideoObjectStorageKey } from './keys'
8import { 8import {
9 createObjectReadStream, 9 createObjectReadStream,
10 listKeysOfPrefix, 10 listKeysOfPrefix,
@@ -55,10 +55,10 @@ function storeHLSFileFromContent (playlist: MStreamingPlaylistVideo, path: strin
55 55
56// --------------------------------------------------------------------------- 56// ---------------------------------------------------------------------------
57 57
58function storeWebTorrentFile (video: MVideo, file: MVideoFile) { 58function storeWebVideoFile (video: MVideo, file: MVideoFile) {
59 return storeObject({ 59 return storeObject({
60 inputPath: VideoPathManager.Instance.getFSVideoFileOutputPath(video, file), 60 inputPath: VideoPathManager.Instance.getFSVideoFileOutputPath(video, file),
61 objectStorageKey: generateWebTorrentObjectStorageKey(file.filename), 61 objectStorageKey: generateWebVideoObjectStorageKey(file.filename),
62 bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS, 62 bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS,
63 isPrivate: video.hasPrivateStaticPath() 63 isPrivate: video.hasPrivateStaticPath()
64 }) 64 })
@@ -66,9 +66,9 @@ function storeWebTorrentFile (video: MVideo, file: MVideoFile) {
66 66
67// --------------------------------------------------------------------------- 67// ---------------------------------------------------------------------------
68 68
69async function updateWebTorrentFileACL (video: MVideo, file: MVideoFile) { 69async function updateWebVideoFileACL (video: MVideo, file: MVideoFile) {
70 await updateObjectACL({ 70 await updateObjectACL({
71 objectStorageKey: generateWebTorrentObjectStorageKey(file.filename), 71 objectStorageKey: generateWebVideoObjectStorageKey(file.filename),
72 bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS, 72 bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS,
73 isPrivate: video.hasPrivateStaticPath() 73 isPrivate: video.hasPrivateStaticPath()
74 }) 74 })
@@ -102,8 +102,8 @@ function removeHLSFileObjectStorageByFullKey (key: string) {
102 102
103// --------------------------------------------------------------------------- 103// ---------------------------------------------------------------------------
104 104
105function removeWebTorrentObjectStorage (videoFile: MVideoFile) { 105function removeWebVideoObjectStorage (videoFile: MVideoFile) {
106 return removeObject(generateWebTorrentObjectStorageKey(videoFile.filename), CONFIG.OBJECT_STORAGE.VIDEOS) 106 return removeObject(generateWebVideoObjectStorageKey(videoFile.filename), CONFIG.OBJECT_STORAGE.VIDEOS)
107} 107}
108 108
109// --------------------------------------------------------------------------- 109// ---------------------------------------------------------------------------
@@ -122,10 +122,10 @@ async function makeHLSFileAvailable (playlist: MStreamingPlaylistVideo, filename
122 return destination 122 return destination
123} 123}
124 124
125async function makeWebTorrentFileAvailable (filename: string, destination: string) { 125async function makeWebVideoFileAvailable (filename: string, destination: string) {
126 const key = generateWebTorrentObjectStorageKey(filename) 126 const key = generateWebVideoObjectStorageKey(filename)
127 127
128 logger.info('Fetching WebTorrent file %s from object storage to %s.', key, destination, lTags()) 128 logger.info('Fetching Web Video file %s from object storage to %s.', key, destination, lTags())
129 129
130 await makeAvailable({ 130 await makeAvailable({
131 key, 131 key,
@@ -138,13 +138,13 @@ async function makeWebTorrentFileAvailable (filename: string, destination: strin
138 138
139// --------------------------------------------------------------------------- 139// ---------------------------------------------------------------------------
140 140
141function getWebTorrentFileReadStream (options: { 141function getWebVideoFileReadStream (options: {
142 filename: string 142 filename: string
143 rangeHeader: string 143 rangeHeader: string
144}) { 144}) {
145 const { filename, rangeHeader } = options 145 const { filename, rangeHeader } = options
146 146
147 const key = generateWebTorrentObjectStorageKey(filename) 147 const key = generateWebVideoObjectStorageKey(filename)
148 148
149 return createObjectReadStream({ 149 return createObjectReadStream({
150 key, 150 key,
@@ -174,12 +174,12 @@ function getHLSFileReadStream (options: {
174export { 174export {
175 listHLSFileKeysOf, 175 listHLSFileKeysOf,
176 176
177 storeWebTorrentFile, 177 storeWebVideoFile,
178 storeHLSFileFromFilename, 178 storeHLSFileFromFilename,
179 storeHLSFileFromPath, 179 storeHLSFileFromPath,
180 storeHLSFileFromContent, 180 storeHLSFileFromContent,
181 181
182 updateWebTorrentFileACL, 182 updateWebVideoFileACL,
183 updateHLSFilesACL, 183 updateHLSFilesACL,
184 184
185 removeHLSObjectStorage, 185 removeHLSObjectStorage,
@@ -187,11 +187,11 @@ export {
187 removeHLSFileObjectStorageByPath, 187 removeHLSFileObjectStorageByPath,
188 removeHLSFileObjectStorageByFullKey, 188 removeHLSFileObjectStorageByFullKey,
189 189
190 removeWebTorrentObjectStorage, 190 removeWebVideoObjectStorage,
191 191
192 makeWebTorrentFileAvailable, 192 makeWebVideoFileAvailable,
193 makeHLSFileAvailable, 193 makeHLSFileAvailable,
194 194
195 getWebTorrentFileReadStream, 195 getWebVideoFileReadStream,
196 getHLSFileReadStream 196 getHLSFileReadStream
197} 197}
diff --git a/server/lib/paths.ts b/server/lib/paths.ts
index 470970f55..db1cdede2 100644
--- a/server/lib/paths.ts
+++ b/server/lib/paths.ts
@@ -8,7 +8,7 @@ import { isVideoInPrivateDirectory } from './video-privacy'
8 8
9// ################## Video file name ################## 9// ################## Video file name ##################
10 10
11function generateWebTorrentVideoFilename (resolution: number, extname: string) { 11function generateWebVideoFilename (resolution: number, extname: string) {
12 return buildUUID() + '-' + resolution + extname 12 return buildUUID() + '-' + resolution + extname
13} 13}
14 14
@@ -76,7 +76,7 @@ function getFSTorrentFilePath (videoFile: MVideoFile) {
76 76
77export { 77export {
78 generateHLSVideoFilename, 78 generateHLSVideoFilename,
79 generateWebTorrentVideoFilename, 79 generateWebVideoFilename,
80 80
81 generateTorrentFileName, 81 generateTorrentFileName,
82 getFSTorrentFilePath, 82 getFSTorrentFilePath,
diff --git a/server/lib/plugins/plugin-helpers-builder.ts b/server/lib/plugins/plugin-helpers-builder.ts
index d235f52c0..b4e3eece4 100644
--- a/server/lib/plugins/plugin-helpers-builder.ts
+++ b/server/lib/plugins/plugin-helpers-builder.ts
@@ -104,7 +104,7 @@ function buildVideosHelpers () {
104 const video = await VideoModel.loadFull(id) 104 const video = await VideoModel.loadFull(id)
105 if (!video) return undefined 105 if (!video) return undefined
106 106
107 const webtorrentVideoFiles = (video.VideoFiles || []).map(f => ({ 107 const webVideoFiles = (video.VideoFiles || []).map(f => ({
108 path: f.storage === VideoStorage.FILE_SYSTEM 108 path: f.storage === VideoStorage.FILE_SYSTEM
109 ? VideoPathManager.Instance.getFSVideoFileOutputPath(video, f) 109 ? VideoPathManager.Instance.getFSVideoFileOutputPath(video, f)
110 : null, 110 : null,
@@ -138,8 +138,12 @@ function buildVideosHelpers () {
138 })) 138 }))
139 139
140 return { 140 return {
141 webtorrent: { 141 webtorrent: { // TODO: remove in v7
142 videoFiles: webtorrentVideoFiles 142 videoFiles: webVideoFiles
143 },
144
145 webVideo: {
146 videoFiles: webVideoFiles
143 }, 147 },
144 148
145 hls: { 149 hls: {
diff --git a/server/lib/runners/job-handlers/shared/vod-helpers.ts b/server/lib/runners/job-handlers/shared/vod-helpers.ts
index 93ae89ff8..1a2ad02ca 100644
--- a/server/lib/runners/job-handlers/shared/vod-helpers.ts
+++ b/server/lib/runners/job-handlers/shared/vod-helpers.ts
@@ -2,7 +2,7 @@ import { move } from 'fs-extra'
2import { dirname, join } from 'path' 2import { dirname, join } from 'path'
3import { logger, LoggerTagsFn } from '@server/helpers/logger' 3import { logger, LoggerTagsFn } from '@server/helpers/logger'
4import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding' 4import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding'
5import { onWebTorrentVideoFileTranscoding } from '@server/lib/transcoding/web-transcoding' 5import { onWebVideoFileTranscoding } from '@server/lib/transcoding/web-transcoding'
6import { buildNewFile } from '@server/lib/video-file' 6import { buildNewFile } from '@server/lib/video-file'
7import { VideoModel } from '@server/models/video/video' 7import { VideoModel } from '@server/models/video/video'
8import { MVideoFullLight } from '@server/types/models' 8import { MVideoFullLight } from '@server/types/models'
@@ -22,7 +22,7 @@ export async function onVODWebVideoOrAudioMergeTranscodingJob (options: {
22 const newVideoFilePath = join(dirname(videoFilePath), videoFile.filename) 22 const newVideoFilePath = join(dirname(videoFilePath), videoFile.filename)
23 await move(videoFilePath, newVideoFilePath) 23 await move(videoFilePath, newVideoFilePath)
24 24
25 await onWebTorrentVideoFileTranscoding({ 25 await onWebVideoFileTranscoding({
26 video, 26 video,
27 videoFile, 27 videoFile,
28 videoOutputPath: newVideoFilePath 28 videoOutputPath: newVideoFilePath
diff --git a/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts b/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts
index 5f247d792..905007db9 100644
--- a/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts
+++ b/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts
@@ -83,7 +83,7 @@ export class VODAudioMergeTranscodingJobHandler extends AbstractVODTranscodingJo
83 83
84 // We can remove the old audio file 84 // We can remove the old audio file
85 const oldAudioFile = video.VideoFiles[0] 85 const oldAudioFile = video.VideoFiles[0]
86 await video.removeWebTorrentFile(oldAudioFile) 86 await video.removeWebVideoFile(oldAudioFile)
87 await oldAudioFile.destroy() 87 await oldAudioFile.destroy()
88 video.VideoFiles = [] 88 video.VideoFiles = []
89 89
diff --git a/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts b/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts
index cc94bcbda..02845952c 100644
--- a/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts
+++ b/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts
@@ -5,7 +5,7 @@ import { renameVideoFileInPlaylist } from '@server/lib/hls'
5import { getHlsResolutionPlaylistFilename } from '@server/lib/paths' 5import { getHlsResolutionPlaylistFilename } from '@server/lib/paths'
6import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding' 6import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding'
7import { onHLSVideoFileTranscoding } from '@server/lib/transcoding/hls-transcoding' 7import { onHLSVideoFileTranscoding } from '@server/lib/transcoding/hls-transcoding'
8import { buildNewFile, removeAllWebTorrentFiles } from '@server/lib/video-file' 8import { buildNewFile, removeAllWebVideoFiles } from '@server/lib/video-file'
9import { VideoJobInfoModel } from '@server/models/video/video-job-info' 9import { VideoJobInfoModel } from '@server/models/video/video-job-info'
10import { MVideo } from '@server/types/models' 10import { MVideo } from '@server/types/models'
11import { MRunnerJob } from '@server/types/models/runners' 11import { MRunnerJob } from '@server/types/models/runners'
@@ -106,7 +106,7 @@ export class VODHLSTranscodingJobHandler extends AbstractVODTranscodingJobHandle
106 if (privatePayload.deleteWebVideoFiles === true) { 106 if (privatePayload.deleteWebVideoFiles === true) {
107 logger.info('Removing web video files of %s now we have a HLS version of it.', video.uuid, this.lTags(video.uuid)) 107 logger.info('Removing web video files of %s now we have a HLS version of it.', video.uuid, this.lTags(video.uuid))
108 108
109 await removeAllWebTorrentFiles(video) 109 await removeAllWebVideoFiles(video)
110 } 110 }
111 111
112 logger.info('Runner VOD HLS job %s for %s ended.', runnerJob.uuid, video.uuid, this.lTags(runnerJob.uuid, video.uuid)) 112 logger.info('Runner VOD HLS job %s for %s ended.', runnerJob.uuid, video.uuid, this.lTags(runnerJob.uuid, video.uuid))
diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts
index dc450c338..24d340a73 100644
--- a/server/lib/schedulers/videos-redundancy-scheduler.ts
+++ b/server/lib/schedulers/videos-redundancy-scheduler.ts
@@ -23,7 +23,7 @@ import { getLocalVideoCacheFileActivityPubUrl, getLocalVideoCacheStreamingPlayli
23import { getOrCreateAPVideo } from '../activitypub/videos' 23import { getOrCreateAPVideo } from '../activitypub/videos'
24import { downloadPlaylistSegments } from '../hls' 24import { downloadPlaylistSegments } from '../hls'
25import { removeVideoRedundancy } from '../redundancy' 25import { removeVideoRedundancy } from '../redundancy'
26import { generateHLSRedundancyUrl, generateWebTorrentRedundancyUrl } from '../video-urls' 26import { generateHLSRedundancyUrl, generateWebVideoRedundancyUrl } from '../video-urls'
27import { AbstractScheduler } from './abstract-scheduler' 27import { AbstractScheduler } from './abstract-scheduler'
28 28
29const lTags = loggerTagsFactory('redundancy') 29const lTags = loggerTagsFactory('redundancy')
@@ -244,7 +244,7 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
244 const createdModel: MVideoRedundancyFileVideo = await VideoRedundancyModel.create({ 244 const createdModel: MVideoRedundancyFileVideo = await VideoRedundancyModel.create({
245 expiresOn, 245 expiresOn,
246 url: getLocalVideoCacheFileActivityPubUrl(file), 246 url: getLocalVideoCacheFileActivityPubUrl(file),
247 fileUrl: generateWebTorrentRedundancyUrl(file), 247 fileUrl: generateWebVideoRedundancyUrl(file),
248 strategy, 248 strategy,
249 videoFileId: file.id, 249 videoFileId: file.id,
250 actorId: serverActor.id 250 actorId: serverActor.id
diff --git a/server/lib/transcoding/create-transcoding-job.ts b/server/lib/transcoding/create-transcoding-job.ts
index abe32684d..d78e68b87 100644
--- a/server/lib/transcoding/create-transcoding-job.ts
+++ b/server/lib/transcoding/create-transcoding-job.ts
@@ -15,7 +15,7 @@ export function createOptimizeOrMergeAudioJobs (options: {
15// --------------------------------------------------------------------------- 15// ---------------------------------------------------------------------------
16 16
17export function createTranscodingJobs (options: { 17export function createTranscodingJobs (options: {
18 transcodingType: 'hls' | 'webtorrent' 18 transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
19 video: MVideoFullLight 19 video: MVideoFullLight
20 resolutions: number[] 20 resolutions: number[]
21 isNewVideo: boolean 21 isNewVideo: boolean
diff --git a/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts b/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts
index 80dc05bfb..15fc814ae 100644
--- a/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts
+++ b/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts
@@ -12,7 +12,7 @@ export abstract class AbstractJobBuilder {
12 }): Promise<any> 12 }): Promise<any>
13 13
14 abstract createTranscodingJobs (options: { 14 abstract createTranscodingJobs (options: {
15 transcodingType: 'hls' | 'webtorrent' 15 transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
16 video: MVideoFullLight 16 video: MVideoFullLight
17 resolutions: number[] 17 resolutions: number[]
18 isNewVideo: boolean 18 isNewVideo: boolean
diff --git a/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts b/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts
index 4f802e2a6..2ecd57249 100644
--- a/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts
+++ b/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts
@@ -12,7 +12,7 @@ import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, hasAud
12import { 12import {
13 HLSTranscodingPayload, 13 HLSTranscodingPayload,
14 MergeAudioTranscodingPayload, 14 MergeAudioTranscodingPayload,
15 NewWebTorrentResolutionTranscodingPayload, 15 NewWebVideoResolutionTranscodingPayload,
16 OptimizeTranscodingPayload, 16 OptimizeTranscodingPayload,
17 VideoTranscodingPayload 17 VideoTranscodingPayload
18} from '@shared/models' 18} from '@shared/models'
@@ -33,7 +33,7 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
33 const { video, videoFile, isNewVideo, user, videoFileAlreadyLocked } = options 33 const { video, videoFile, isNewVideo, user, videoFileAlreadyLocked } = options
34 34
35 let mergeOrOptimizePayload: MergeAudioTranscodingPayload | OptimizeTranscodingPayload 35 let mergeOrOptimizePayload: MergeAudioTranscodingPayload | OptimizeTranscodingPayload
36 let nextTranscodingSequentialJobPayloads: (NewWebTorrentResolutionTranscodingPayload | HLSTranscodingPayload)[][] = [] 36 let nextTranscodingSequentialJobPayloads: (NewWebVideoResolutionTranscodingPayload | HLSTranscodingPayload)[][] = []
37 37
38 const mutexReleaser = videoFileAlreadyLocked 38 const mutexReleaser = videoFileAlreadyLocked
39 ? () => {} 39 ? () => {}
@@ -60,7 +60,7 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
60 if (CONFIG.TRANSCODING.HLS.ENABLED === true) { 60 if (CONFIG.TRANSCODING.HLS.ENABLED === true) {
61 nextTranscodingSequentialJobPayloads.push([ 61 nextTranscodingSequentialJobPayloads.push([
62 this.buildHLSJobPayload({ 62 this.buildHLSJobPayload({
63 deleteWebTorrentFiles: CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false, 63 deleteWebVideoFiles: CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false,
64 64
65 // We had some issues with a web video quick transcoded while producing a HLS version of it 65 // We had some issues with a web video quick transcoded while producing a HLS version of it
66 copyCodecs: !quickTranscode, 66 copyCodecs: !quickTranscode,
@@ -116,7 +116,7 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
116 // --------------------------------------------------------------------------- 116 // ---------------------------------------------------------------------------
117 117
118 async createTranscodingJobs (options: { 118 async createTranscodingJobs (options: {
119 transcodingType: 'hls' | 'webtorrent' 119 transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
120 video: MVideoFullLight 120 video: MVideoFullLight
121 resolutions: number[] 121 resolutions: number[]
122 isNewVideo: boolean 122 isNewVideo: boolean
@@ -138,8 +138,8 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
138 return this.buildHLSJobPayload({ videoUUID: video.uuid, resolution, fps, isNewVideo }) 138 return this.buildHLSJobPayload({ videoUUID: video.uuid, resolution, fps, isNewVideo })
139 } 139 }
140 140
141 if (transcodingType === 'webtorrent') { 141 if (transcodingType === 'webtorrent' || transcodingType === 'web-video') {
142 return this.buildWebTorrentJobPayload({ videoUUID: video.uuid, resolution, fps, isNewVideo }) 142 return this.buildWebVideoJobPayload({ videoUUID: video.uuid, resolution, fps, isNewVideo })
143 } 143 }
144 144
145 throw new Error('Unknown transcoding type') 145 throw new Error('Unknown transcoding type')
@@ -149,7 +149,7 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
149 149
150 const parent = transcodingType === 'hls' 150 const parent = transcodingType === 'hls'
151 ? this.buildHLSJobPayload({ videoUUID: video.uuid, resolution: maxResolution, fps, isNewVideo }) 151 ? this.buildHLSJobPayload({ videoUUID: video.uuid, resolution: maxResolution, fps, isNewVideo })
152 : this.buildWebTorrentJobPayload({ videoUUID: video.uuid, resolution: maxResolution, fps, isNewVideo }) 152 : this.buildWebVideoJobPayload({ videoUUID: video.uuid, resolution: maxResolution, fps, isNewVideo })
153 153
154 // Process the last resolution after the other ones to prevent concurrency issue 154 // Process the last resolution after the other ones to prevent concurrency issue
155 // Because low resolutions use the biggest one as ffmpeg input 155 // Because low resolutions use the biggest one as ffmpeg input
@@ -160,8 +160,8 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
160 160
161 private async createTranscodingJobsWithChildren (options: { 161 private async createTranscodingJobsWithChildren (options: {
162 videoUUID: string 162 videoUUID: string
163 parent: (HLSTranscodingPayload | NewWebTorrentResolutionTranscodingPayload) 163 parent: (HLSTranscodingPayload | NewWebVideoResolutionTranscodingPayload)
164 children: (HLSTranscodingPayload | NewWebTorrentResolutionTranscodingPayload)[] 164 children: (HLSTranscodingPayload | NewWebVideoResolutionTranscodingPayload)[]
165 user: MUserId | null 165 user: MUserId | null
166 }) { 166 }) {
167 const { videoUUID, parent, children, user } = options 167 const { videoUUID, parent, children, user } = options
@@ -203,14 +203,14 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
203 options 203 options
204 ) 204 )
205 205
206 const sequentialPayloads: (NewWebTorrentResolutionTranscodingPayload | HLSTranscodingPayload)[][] = [] 206 const sequentialPayloads: (NewWebVideoResolutionTranscodingPayload | HLSTranscodingPayload)[][] = []
207 207
208 for (const resolution of resolutionsEnabled) { 208 for (const resolution of resolutionsEnabled) {
209 const fps = computeOutputFPS({ inputFPS: inputVideoFPS, resolution }) 209 const fps = computeOutputFPS({ inputFPS: inputVideoFPS, resolution })
210 210
211 if (CONFIG.TRANSCODING.WEBTORRENT.ENABLED) { 211 if (CONFIG.TRANSCODING.WEBTORRENT.ENABLED) {
212 const payloads: (NewWebTorrentResolutionTranscodingPayload | HLSTranscodingPayload)[] = [ 212 const payloads: (NewWebVideoResolutionTranscodingPayload | HLSTranscodingPayload)[] = [
213 this.buildWebTorrentJobPayload({ 213 this.buildWebVideoJobPayload({
214 videoUUID: video.uuid, 214 videoUUID: video.uuid,
215 resolution, 215 resolution,
216 fps, 216 fps,
@@ -253,10 +253,10 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
253 resolution: number 253 resolution: number
254 fps: number 254 fps: number
255 isNewVideo: boolean 255 isNewVideo: boolean
256 deleteWebTorrentFiles?: boolean // default false 256 deleteWebVideoFiles?: boolean // default false
257 copyCodecs?: boolean // default false 257 copyCodecs?: boolean // default false
258 }): HLSTranscodingPayload { 258 }): HLSTranscodingPayload {
259 const { videoUUID, resolution, fps, isNewVideo, deleteWebTorrentFiles = false, copyCodecs = false } = options 259 const { videoUUID, resolution, fps, isNewVideo, deleteWebVideoFiles = false, copyCodecs = false } = options
260 260
261 return { 261 return {
262 type: 'new-resolution-to-hls', 262 type: 'new-resolution-to-hls',
@@ -265,20 +265,20 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
265 fps, 265 fps,
266 copyCodecs, 266 copyCodecs,
267 isNewVideo, 267 isNewVideo,
268 deleteWebTorrentFiles 268 deleteWebVideoFiles
269 } 269 }
270 } 270 }
271 271
272 private buildWebTorrentJobPayload (options: { 272 private buildWebVideoJobPayload (options: {
273 videoUUID: string 273 videoUUID: string
274 resolution: number 274 resolution: number
275 fps: number 275 fps: number
276 isNewVideo: boolean 276 isNewVideo: boolean
277 }): NewWebTorrentResolutionTranscodingPayload { 277 }): NewWebVideoResolutionTranscodingPayload {
278 const { videoUUID, resolution, fps, isNewVideo } = options 278 const { videoUUID, resolution, fps, isNewVideo } = options
279 279
280 return { 280 return {
281 type: 'new-resolution-to-webtorrent', 281 type: 'new-resolution-to-web-video',
282 videoUUID, 282 videoUUID,
283 isNewVideo, 283 isNewVideo,
284 resolution, 284 resolution,
@@ -294,7 +294,7 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
294 const { videoUUID, isNewVideo, hasChildren } = options 294 const { videoUUID, isNewVideo, hasChildren } = options
295 295
296 return { 296 return {
297 type: 'merge-audio-to-webtorrent', 297 type: 'merge-audio-to-web-video',
298 resolution: DEFAULT_AUDIO_RESOLUTION, 298 resolution: DEFAULT_AUDIO_RESOLUTION,
299 fps: VIDEO_TRANSCODING_FPS.AUDIO_MERGE, 299 fps: VIDEO_TRANSCODING_FPS.AUDIO_MERGE,
300 videoUUID, 300 videoUUID,
@@ -312,7 +312,7 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
312 const { videoUUID, quickTranscode, isNewVideo, hasChildren } = options 312 const { videoUUID, quickTranscode, isNewVideo, hasChildren } = options
313 313
314 return { 314 return {
315 type: 'optimize-to-webtorrent', 315 type: 'optimize-to-web-video',
316 videoUUID, 316 videoUUID,
317 isNewVideo, 317 isNewVideo,
318 hasChildren, 318 hasChildren,
diff --git a/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts b/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts
index 4b8bc2f3d..b98172c2d 100644
--- a/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts
+++ b/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts
@@ -89,7 +89,7 @@ export class TranscodingRunnerJobBuilder extends AbstractJobBuilder {
89 // --------------------------------------------------------------------------- 89 // ---------------------------------------------------------------------------
90 90
91 async createTranscodingJobs (options: { 91 async createTranscodingJobs (options: {
92 transcodingType: 'hls' | 'webtorrent' 92 transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
93 video: MVideoFullLight 93 video: MVideoFullLight
94 resolutions: number[] 94 resolutions: number[]
95 isNewVideo: boolean 95 isNewVideo: boolean
@@ -130,7 +130,7 @@ export class TranscodingRunnerJobBuilder extends AbstractJobBuilder {
130 continue 130 continue
131 } 131 }
132 132
133 if (transcodingType === 'webtorrent') { 133 if (transcodingType === 'webtorrent' || transcodingType === 'web-video') {
134 await new VODWebVideoTranscodingJobHandler().create({ 134 await new VODWebVideoTranscodingJobHandler().create({
135 video, 135 video,
136 resolution, 136 resolution,
diff --git a/server/lib/transcoding/web-transcoding.ts b/server/lib/transcoding/web-transcoding.ts
index a499db422..f92d457a0 100644
--- a/server/lib/transcoding/web-transcoding.ts
+++ b/server/lib/transcoding/web-transcoding.ts
@@ -10,7 +10,7 @@ import { VideoResolution, VideoStorage } from '@shared/models'
10import { CONFIG } from '../../initializers/config' 10import { CONFIG } from '../../initializers/config'
11import { VideoFileModel } from '../../models/video/video-file' 11import { VideoFileModel } from '../../models/video/video-file'
12import { JobQueue } from '../job-queue' 12import { JobQueue } from '../job-queue'
13import { generateWebTorrentVideoFilename } from '../paths' 13import { generateWebVideoFilename } from '../paths'
14import { buildFileMetadata } from '../video-file' 14import { buildFileMetadata } from '../video-file'
15import { VideoPathManager } from '../video-path-manager' 15import { VideoPathManager } from '../video-path-manager'
16import { buildFFmpegVOD } from './shared' 16import { buildFFmpegVOD } from './shared'
@@ -63,10 +63,10 @@ export async function optimizeOriginalVideofile (options: {
63 // Important to do this before getVideoFilename() to take in account the new filename 63 // Important to do this before getVideoFilename() to take in account the new filename
64 inputVideoFile.resolution = resolution 64 inputVideoFile.resolution = resolution
65 inputVideoFile.extname = newExtname 65 inputVideoFile.extname = newExtname
66 inputVideoFile.filename = generateWebTorrentVideoFilename(resolution, newExtname) 66 inputVideoFile.filename = generateWebVideoFilename(resolution, newExtname)
67 inputVideoFile.storage = VideoStorage.FILE_SYSTEM 67 inputVideoFile.storage = VideoStorage.FILE_SYSTEM
68 68
69 const { videoFile } = await onWebTorrentVideoFileTranscoding({ 69 const { videoFile } = await onWebVideoFileTranscoding({
70 video, 70 video,
71 videoFile: inputVideoFile, 71 videoFile: inputVideoFile,
72 videoOutputPath 72 videoOutputPath
@@ -83,8 +83,8 @@ export async function optimizeOriginalVideofile (options: {
83 } 83 }
84} 84}
85 85
86// Transcode the original video file to a lower resolution compatible with WebTorrent 86// Transcode the original video file to a lower resolution compatible with web browsers
87export async function transcodeNewWebTorrentResolution (options: { 87export async function transcodeNewWebVideoResolution (options: {
88 video: MVideoFullLight 88 video: MVideoFullLight
89 resolution: VideoResolution 89 resolution: VideoResolution
90 fps: number 90 fps: number
@@ -105,7 +105,7 @@ export async function transcodeNewWebTorrentResolution (options: {
105 const newVideoFile = new VideoFileModel({ 105 const newVideoFile = new VideoFileModel({
106 resolution, 106 resolution,
107 extname: newExtname, 107 extname: newExtname,
108 filename: generateWebTorrentVideoFilename(resolution, newExtname), 108 filename: generateWebVideoFilename(resolution, newExtname),
109 size: 0, 109 size: 0,
110 videoId: video.id 110 videoId: video.id
111 }) 111 })
@@ -126,7 +126,7 @@ export async function transcodeNewWebTorrentResolution (options: {
126 126
127 await buildFFmpegVOD(job).transcode(transcodeOptions) 127 await buildFFmpegVOD(job).transcode(transcodeOptions)
128 128
129 return onWebTorrentVideoFileTranscoding({ video, videoFile: newVideoFile, videoOutputPath }) 129 return onWebVideoFileTranscoding({ video, videoFile: newVideoFile, videoOutputPath })
130 }) 130 })
131 131
132 return result 132 return result
@@ -189,14 +189,14 @@ export async function mergeAudioVideofile (options: {
189 // Important to do this before getVideoFilename() to take in account the new file extension 189 // Important to do this before getVideoFilename() to take in account the new file extension
190 inputVideoFile.extname = newExtname 190 inputVideoFile.extname = newExtname
191 inputVideoFile.resolution = resolution 191 inputVideoFile.resolution = resolution
192 inputVideoFile.filename = generateWebTorrentVideoFilename(inputVideoFile.resolution, newExtname) 192 inputVideoFile.filename = generateWebVideoFilename(inputVideoFile.resolution, newExtname)
193 193
194 // ffmpeg generated a new video file, so update the video duration 194 // ffmpeg generated a new video file, so update the video duration
195 // See https://trac.ffmpeg.org/ticket/5456 195 // See https://trac.ffmpeg.org/ticket/5456
196 video.duration = await getVideoStreamDuration(videoOutputPath) 196 video.duration = await getVideoStreamDuration(videoOutputPath)
197 await video.save() 197 await video.save()
198 198
199 return onWebTorrentVideoFileTranscoding({ 199 return onWebVideoFileTranscoding({
200 video, 200 video,
201 videoFile: inputVideoFile, 201 videoFile: inputVideoFile,
202 videoOutputPath, 202 videoOutputPath,
@@ -210,7 +210,7 @@ export async function mergeAudioVideofile (options: {
210 } 210 }
211} 211}
212 212
213export async function onWebTorrentVideoFileTranscoding (options: { 213export async function onWebVideoFileTranscoding (options: {
214 video: MVideoFullLight 214 video: MVideoFullLight
215 videoFile: MVideoFile 215 videoFile: MVideoFile
216 videoOutputPath: string 216 videoOutputPath: string
@@ -239,8 +239,8 @@ export async function onWebTorrentVideoFileTranscoding (options: {
239 239
240 await createTorrentAndSetInfoHash(video, videoFile) 240 await createTorrentAndSetInfoHash(video, videoFile)
241 241
242 const oldFile = await VideoFileModel.loadWebTorrentFile({ videoId: video.id, fps: videoFile.fps, resolution: videoFile.resolution }) 242 const oldFile = await VideoFileModel.loadWebVideoFile({ videoId: video.id, fps: videoFile.fps, resolution: videoFile.resolution })
243 if (oldFile) await video.removeWebTorrentFile(oldFile) 243 if (oldFile) await video.removeWebVideoFile(oldFile)
244 244
245 await VideoFileModel.customUpsert(videoFile, 'video', undefined) 245 await VideoFileModel.customUpsert(videoFile, 'video', undefined)
246 video.VideoFiles = await video.$get('VideoFiles') 246 video.VideoFiles = await video.$get('VideoFiles')
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'
7import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, isAudioFile } from '@shared/ffmpeg' 7import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, isAudioFile } from '@shared/ffmpeg'
8import { VideoFileMetadata, VideoResolution } from '@shared/models' 8import { VideoFileMetadata, VideoResolution } from '@shared/models'
9import { lTags } from './object-storage/shared' 9import { lTags } from './object-storage/shared'
10import { generateHLSVideoFilename, generateWebTorrentVideoFilename } from './paths' 10import { generateHLSVideoFilename, generateWebVideoFilename } from './paths'
11import { VideoPathManager } from './video-path-manager' 11import { VideoPathManager } from './video-path-manager'
12 12
13async function buildNewFile (options: { 13async 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
88async function removeAllWebTorrentFiles (video: MVideoWithAllFiles) { 88async 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
105async function removeWebTorrentFile (video: MVideoWithAllFiles, fileToDeleteId: number) { 105async 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}
diff --git a/server/lib/video-path-manager.ts b/server/lib/video-path-manager.ts
index 9953cae5d..133544bb2 100644
--- a/server/lib/video-path-manager.ts
+++ b/server/lib/video-path-manager.ts
@@ -8,7 +8,7 @@ import { DIRECTORIES } from '@server/initializers/constants'
8import { MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '@server/types/models' 8import { MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '@server/types/models'
9import { buildUUID } from '@shared/extra-utils' 9import { buildUUID } from '@shared/extra-utils'
10import { VideoStorage } from '@shared/models' 10import { VideoStorage } from '@shared/models'
11import { makeHLSFileAvailable, makeWebTorrentFileAvailable } from './object-storage' 11import { makeHLSFileAvailable, makeWebVideoFileAvailable } from './object-storage'
12import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from './paths' 12import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from './paths'
13import { isVideoInPrivateDirectory } from './video-privacy' 13import { isVideoInPrivateDirectory } from './video-privacy'
14 14
@@ -78,7 +78,7 @@ class VideoPathManager {
78 } 78 }
79 79
80 return this.makeAvailableFactory( 80 return this.makeAvailableFactory(
81 () => makeWebTorrentFileAvailable(videoFile.filename, destination), 81 () => makeWebVideoFileAvailable(videoFile.filename, destination),
82 true, 82 true,
83 cb 83 cb
84 ) 84 )
diff --git a/server/lib/video-privacy.ts b/server/lib/video-privacy.ts
index 39430ef1e..5dd4d9781 100644
--- a/server/lib/video-privacy.ts
+++ b/server/lib/video-privacy.ts
@@ -4,7 +4,7 @@ import { logger } from '@server/helpers/logger'
4import { DIRECTORIES } from '@server/initializers/constants' 4import { DIRECTORIES } from '@server/initializers/constants'
5import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' 5import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
6import { VideoPrivacy, VideoStorage } from '@shared/models' 6import { VideoPrivacy, VideoStorage } from '@shared/models'
7import { updateHLSFilesACL, updateWebTorrentFileACL } from './object-storage' 7import { updateHLSFilesACL, updateWebVideoFileACL } from './object-storage'
8 8
9const validPrivacySet = new Set([ 9const validPrivacySet = new Set([
10 VideoPrivacy.PRIVATE, 10 VideoPrivacy.PRIVATE,
@@ -67,9 +67,9 @@ async function moveFiles (options: {
67 67
68 for (const file of video.VideoFiles) { 68 for (const file of video.VideoFiles) {
69 if (file.storage === VideoStorage.FILE_SYSTEM) { 69 if (file.storage === VideoStorage.FILE_SYSTEM) {
70 await moveWebTorrentFileOnFS(type, video, file) 70 await moveWebVideoFileOnFS(type, video, file)
71 } else { 71 } else {
72 await updateWebTorrentFileACL(video, file) 72 await updateWebVideoFileACL(video, file)
73 } 73 }
74 } 74 }
75 75
@@ -84,22 +84,22 @@ async function moveFiles (options: {
84 } 84 }
85} 85}
86 86
87async function moveWebTorrentFileOnFS (type: MoveType, video: MVideo, file: MVideoFile) { 87async function moveWebVideoFileOnFS (type: MoveType, video: MVideo, file: MVideoFile) {
88 const directories = getWebTorrentDirectories(type) 88 const directories = getWebVideoDirectories(type)
89 89
90 const source = join(directories.old, file.filename) 90 const source = join(directories.old, file.filename)
91 const destination = join(directories.new, file.filename) 91 const destination = join(directories.new, file.filename)
92 92
93 try { 93 try {
94 logger.info('Moving WebTorrent files of %s after privacy change (%s -> %s).', video.uuid, source, destination) 94 logger.info('Moving web video files of %s after privacy change (%s -> %s).', video.uuid, source, destination)
95 95
96 await move(source, destination) 96 await move(source, destination)
97 } catch (err) { 97 } catch (err) {
98 logger.error('Cannot move webtorrent file %s to %s after privacy change', source, destination, { err }) 98 logger.error('Cannot move web video file %s to %s after privacy change', source, destination, { err })
99 } 99 }
100} 100}
101 101
102function getWebTorrentDirectories (moveType: MoveType) { 102function getWebVideoDirectories (moveType: MoveType) {
103 if (moveType === 'private-to-public') { 103 if (moveType === 'private-to-public') {
104 return { old: DIRECTORIES.VIDEOS.PRIVATE, new: DIRECTORIES.VIDEOS.PUBLIC } 104 return { old: DIRECTORIES.VIDEOS.PRIVATE, new: DIRECTORIES.VIDEOS.PUBLIC }
105 } 105 }
diff --git a/server/lib/video-studio.ts b/server/lib/video-studio.ts
index 0d3db8f60..f549a7084 100644
--- a/server/lib/video-studio.ts
+++ b/server/lib/video-studio.ts
@@ -12,7 +12,7 @@ import { JobQueue } from './job-queue'
12import { VideoStudioTranscodingJobHandler } from './runners' 12import { VideoStudioTranscodingJobHandler } from './runners'
13import { createOptimizeOrMergeAudioJobs } from './transcoding/create-transcoding-job' 13import { createOptimizeOrMergeAudioJobs } from './transcoding/create-transcoding-job'
14import { getTranscodingJobPriority } from './transcoding/transcoding-priority' 14import { getTranscodingJobPriority } from './transcoding/transcoding-priority'
15import { buildNewFile, removeHLSPlaylist, removeWebTorrentFile } from './video-file' 15import { buildNewFile, removeHLSPlaylist, removeWebVideoFile } from './video-file'
16import { VideoPathManager } from './video-path-manager' 16import { VideoPathManager } from './video-path-manager'
17 17
18const lTags = loggerTagsFactory('video-studio') 18const lTags = loggerTagsFactory('video-studio')
@@ -119,12 +119,12 @@ export async function onVideoStudioEnded (options: {
119// Private 119// Private
120// --------------------------------------------------------------------------- 120// ---------------------------------------------------------------------------
121 121
122async function removeAllFiles (video: MVideoWithAllFiles, webTorrentFileException: MVideoFile) { 122async function removeAllFiles (video: MVideoWithAllFiles, webVideoFileException: MVideoFile) {
123 await removeHLSPlaylist(video) 123 await removeHLSPlaylist(video)
124 124
125 for (const file of video.VideoFiles) { 125 for (const file of video.VideoFiles) {
126 if (file.id === webTorrentFileException.id) continue 126 if (file.id === webVideoFileException.id) continue
127 127
128 await removeWebTorrentFile(video, file.id) 128 await removeWebVideoFile(video, file.id)
129 } 129 }
130} 130}
diff --git a/server/lib/video-urls.ts b/server/lib/video-urls.ts
index 64c2c9bf9..0597488ad 100644
--- a/server/lib/video-urls.ts
+++ b/server/lib/video-urls.ts
@@ -9,7 +9,7 @@ function generateHLSRedundancyUrl (video: MVideo, playlist: MStreamingPlaylist)
9 return WEBSERVER.URL + STATIC_PATHS.REDUNDANCY + playlist.getStringType() + '/' + video.uuid 9 return WEBSERVER.URL + STATIC_PATHS.REDUNDANCY + playlist.getStringType() + '/' + video.uuid
10} 10}
11 11
12function generateWebTorrentRedundancyUrl (file: MVideoFile) { 12function generateWebVideoRedundancyUrl (file: MVideoFile) {
13 return WEBSERVER.URL + STATIC_PATHS.REDUNDANCY + file.filename 13 return WEBSERVER.URL + STATIC_PATHS.REDUNDANCY + file.filename
14} 14}
15 15
@@ -26,6 +26,6 @@ function getLocalVideoFileMetadataUrl (video: MVideoUUID, videoFile: MVideoFile)
26export { 26export {
27 getLocalVideoFileMetadataUrl, 27 getLocalVideoFileMetadataUrl,
28 28
29 generateWebTorrentRedundancyUrl, 29 generateWebVideoRedundancyUrl,
30 generateHLSRedundancyUrl 30 generateHLSRedundancyUrl
31} 31}