aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r--server/lib/job-queue/handlers/move-to-object-storage.ts11
-rw-r--r--server/lib/job-queue/handlers/video-transcoding.ts10
2 files changed, 13 insertions, 8 deletions
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 4beca3d75..54a7c566b 100644
--- a/server/lib/job-queue/handlers/move-to-object-storage.ts
+++ b/server/lib/job-queue/handlers/move-to-object-storage.ts
@@ -56,16 +56,17 @@ async function moveWebTorrentFiles (video: MVideoWithAllFiles) {
56 56
57async function moveHLSFiles (video: MVideoWithAllFiles) { 57async function moveHLSFiles (video: MVideoWithAllFiles) {
58 for (const playlist of video.VideoStreamingPlaylists) { 58 for (const playlist of video.VideoStreamingPlaylists) {
59 const playlistWithVideo = playlist.withVideo(video)
59 60
60 for (const file of playlist.VideoFiles) { 61 for (const file of playlist.VideoFiles) {
61 if (file.storage !== VideoStorage.FILE_SYSTEM) continue 62 if (file.storage !== VideoStorage.FILE_SYSTEM) continue
62 63
63 // Resolution playlist 64 // Resolution playlist
64 const playlistFilename = getHlsResolutionPlaylistFilename(file.filename) 65 const playlistFilename = getHlsResolutionPlaylistFilename(file.filename)
65 await storeHLSFile(playlist, video, playlistFilename) 66 await storeHLSFile(playlistWithVideo, playlistFilename)
66 67
67 // Resolution fragmented file 68 // Resolution fragmented file
68 const fileUrl = await storeHLSFile(playlist, video, file.filename) 69 const fileUrl = await storeHLSFile(playlistWithVideo, file.filename)
69 70
70 const oldPath = join(getHLSDirectory(video), file.filename) 71 const oldPath = join(getHLSDirectory(video), file.filename)
71 72
@@ -78,10 +79,12 @@ async function doAfterLastJob (video: MVideoWithAllFiles, isNewVideo: boolean) {
78 for (const playlist of video.VideoStreamingPlaylists) { 79 for (const playlist of video.VideoStreamingPlaylists) {
79 if (playlist.storage === VideoStorage.OBJECT_STORAGE) continue 80 if (playlist.storage === VideoStorage.OBJECT_STORAGE) continue
80 81
82 const playlistWithVideo = playlist.withVideo(video)
83
81 // Master playlist 84 // Master playlist
82 playlist.playlistUrl = await storeHLSFile(playlist, video, playlist.playlistFilename) 85 playlist.playlistUrl = await storeHLSFile(playlistWithVideo, playlist.playlistFilename)
83 // Sha256 segments file 86 // Sha256 segments file
84 playlist.segmentsSha256Url = await storeHLSFile(playlist, video, playlist.segmentsSha256Filename) 87 playlist.segmentsSha256Url = await storeHLSFile(playlistWithVideo, playlist.segmentsSha256Filename)
85 88
86 playlist.storage = VideoStorage.OBJECT_STORAGE 89 playlist.storage = VideoStorage.OBJECT_STORAGE
87 90
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts
index 904ef2e3c..2d0798e12 100644
--- a/server/lib/job-queue/handlers/video-transcoding.ts
+++ b/server/lib/job-queue/handlers/video-transcoding.ts
@@ -14,7 +14,7 @@ import {
14 VideoTranscodingPayload 14 VideoTranscodingPayload
15} from '../../../../shared' 15} from '../../../../shared'
16import { retryTransactionWrapper } from '../../../helpers/database-utils' 16import { retryTransactionWrapper } from '../../../helpers/database-utils'
17import { computeResolutionsToTranscode } from '../../../helpers/ffprobe-utils' 17import { computeLowerResolutionsToTranscode } from '../../../helpers/ffprobe-utils'
18import { logger, loggerTagsFactory } from '../../../helpers/logger' 18import { logger, loggerTagsFactory } from '../../../helpers/logger'
19import { CONFIG } from '../../../initializers/config' 19import { CONFIG } from '../../../initializers/config'
20import { VideoModel } from '../../../models/video/video' 20import { VideoModel } from '../../../models/video/video'
@@ -81,7 +81,7 @@ async function handleHLSJob (job: Job, payload: HLSTranscodingPayload, video: MV
81 81
82 const videoOrStreamingPlaylist = videoFileInput.getVideoOrStreamingPlaylist() 82 const videoOrStreamingPlaylist = videoFileInput.getVideoOrStreamingPlaylist()
83 83
84 await VideoPathManager.Instance.makeAvailableVideoFile(videoOrStreamingPlaylist, videoFileInput, videoInputPath => { 84 await VideoPathManager.Instance.makeAvailableVideoFile(videoFileInput.withVideoOrPlaylist(videoOrStreamingPlaylist), videoInputPath => {
85 return generateHlsPlaylistResolution({ 85 return generateHlsPlaylistResolution({
86 video, 86 video,
87 videoInputPath, 87 videoInputPath,
@@ -135,7 +135,7 @@ async function handleWebTorrentOptimizeJob (job: Job, payload: OptimizeTranscodi
135// --------------------------------------------------------------------------- 135// ---------------------------------------------------------------------------
136 136
137async function onHlsPlaylistGeneration (video: MVideoFullLight, user: MUser, payload: HLSTranscodingPayload) { 137async function onHlsPlaylistGeneration (video: MVideoFullLight, user: MUser, payload: HLSTranscodingPayload) {
138 if (payload.isMaxQuality && CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) { 138 if (payload.isMaxQuality && payload.autoDeleteWebTorrentIfNeeded && CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) {
139 // Remove webtorrent files if not enabled 139 // Remove webtorrent files if not enabled
140 for (const file of video.VideoFiles) { 140 for (const file of video.VideoFiles) {
141 await video.removeWebTorrentFileAndTorrent(file) 141 await video.removeWebTorrentFileAndTorrent(file)
@@ -232,6 +232,7 @@ async function createHlsJobIfEnabled (user: MUserId, payload: {
232 isPortraitMode: payload.isPortraitMode, 232 isPortraitMode: payload.isPortraitMode,
233 copyCodecs: payload.copyCodecs, 233 copyCodecs: payload.copyCodecs,
234 isMaxQuality: payload.isMaxQuality, 234 isMaxQuality: payload.isMaxQuality,
235 autoDeleteWebTorrentIfNeeded: true,
235 isNewVideo: payload.isNewVideo 236 isNewVideo: payload.isNewVideo
236 } 237 }
237 238
@@ -261,7 +262,7 @@ async function createLowerResolutionsJobs (options: {
261 const { video, user, videoFileResolution, isPortraitMode, isNewVideo, type } = options 262 const { video, user, videoFileResolution, isPortraitMode, isNewVideo, type } = options
262 263
263 // Create transcoding jobs if there are enabled resolutions 264 // Create transcoding jobs if there are enabled resolutions
264 const resolutionsEnabled = computeResolutionsToTranscode(videoFileResolution, 'vod') 265 const resolutionsEnabled = computeLowerResolutionsToTranscode(videoFileResolution, 'vod')
265 const resolutionCreated: string[] = [] 266 const resolutionCreated: string[] = []
266 267
267 for (const resolution of resolutionsEnabled) { 268 for (const resolution of resolutionsEnabled) {
@@ -288,6 +289,7 @@ async function createLowerResolutionsJobs (options: {
288 isPortraitMode, 289 isPortraitMode,
289 copyCodecs: false, 290 copyCodecs: false,
290 isMaxQuality: false, 291 isMaxQuality: false,
292 autoDeleteWebTorrentIfNeeded: true,
291 isNewVideo 293 isNewVideo
292 } 294 }
293 295