aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-05 15:05:20 +0200
committerChocobozzz <me@florianbigard.com>2022-08-09 09:18:07 +0200
commit5e2afe4290103bf0d54ae7b3e62781f2a00487c9 (patch)
tree84e084135c60d208fc9afcee63180d3200f763e6 /server/lib/job-queue/handlers
parent64fd6158fd276f258bcfc4bb0c8fc2f64a220a11 (diff)
downloadPeerTube-5e2afe4290103bf0d54ae7b3e62781f2a00487c9.tar.gz
PeerTube-5e2afe4290103bf0d54ae7b3e62781f2a00487c9.tar.zst
PeerTube-5e2afe4290103bf0d54ae7b3e62781f2a00487c9.zip
Limit import depending on transcoding resolutions
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r--server/lib/job-queue/handlers/video-import.ts9
-rw-r--r--server/lib/job-queue/handlers/video-transcoding.ts2
2 files changed, 8 insertions, 3 deletions
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts
index 40804e82e..4cde26aef 100644
--- a/server/lib/job-queue/handlers/video-import.ts
+++ b/server/lib/job-queue/handlers/video-import.ts
@@ -2,6 +2,7 @@ import { Job } from 'bull'
2import { move, remove, stat } from 'fs-extra' 2import { move, remove, stat } from 'fs-extra'
3import { retryTransactionWrapper } from '@server/helpers/database-utils' 3import { 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 { isPostImportVideoAccepted } from '@server/lib/moderation' 6import { isPostImportVideoAccepted } from '@server/lib/moderation'
6import { generateWebTorrentVideoFilename } from '@server/lib/paths' 7import { generateWebTorrentVideoFilename } from '@server/lib/paths'
7import { Hooks } from '@server/lib/plugins/hooks' 8import { Hooks } from '@server/lib/plugins/hooks'
@@ -25,7 +26,7 @@ import {
25 VideoResolution, 26 VideoResolution,
26 VideoState 27 VideoState
27} from '@shared/models' 28} from '@shared/models'
28import { ffprobePromise, getVideoStreamDuration, getVideoStreamFPS, getVideoStreamDimensionsInfo } from '../../../helpers/ffmpeg' 29import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamDuration, getVideoStreamFPS } from '../../../helpers/ffmpeg'
29import { logger } from '../../../helpers/logger' 30import { logger } from '../../../helpers/logger'
30import { getSecureTorrentName } from '../../../helpers/utils' 31import { getSecureTorrentName } from '../../../helpers/utils'
31import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent' 32import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent'
@@ -80,7 +81,11 @@ async function processYoutubeDLImport (job: Job, videoImport: MVideoImportDefaul
80 81
81 const options = { type: payload.type, videoImportId: videoImport.id } 82 const options = { type: payload.type, videoImportId: videoImport.id }
82 83
83 const youtubeDL = new YoutubeDLWrapper(videoImport.targetUrl, ServerConfigManager.Instance.getEnabledResolutions('vod')) 84 const youtubeDL = new YoutubeDLWrapper(
85 videoImport.targetUrl,
86 ServerConfigManager.Instance.getEnabledResolutions('vod'),
87 CONFIG.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION
88 )
84 89
85 return processFile( 90 return processFile(
86 () => youtubeDL.downloadVideo(payload.fileExt, JOB_TTL['video-import']), 91 () => youtubeDL.downloadVideo(payload.fileExt, JOB_TTL['video-import']),
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts
index 890d34e3b..4e5e97919 100644
--- a/server/lib/job-queue/handlers/video-transcoding.ts
+++ b/server/lib/job-queue/handlers/video-transcoding.ts
@@ -265,7 +265,7 @@ async function createLowerResolutionsJobs (options: {
265 265
266 // Create transcoding jobs if there are enabled resolutions 266 // Create transcoding jobs if there are enabled resolutions
267 const resolutionsEnabled = await Hooks.wrapObject( 267 const resolutionsEnabled = await Hooks.wrapObject(
268 computeResolutionsToTranscode({ inputResolution: videoFileResolution, type: 'vod', includeInputResolution: false }), 268 computeResolutionsToTranscode({ input: videoFileResolution, type: 'vod', includeInput: false, strictLower: true }),
269 'filter:transcoding.auto.resolutions-to-transcode.result', 269 'filter:transcoding.auto.resolutions-to-transcode.result',
270 options 270 options
271 ) 271 )