aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/youtube-dl/youtube-dl-wrapper.ts
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/helpers/youtube-dl/youtube-dl-wrapper.ts
parent64fd6158fd276f258bcfc4bb0c8fc2f64a220a11 (diff)
downloadPeerTube-5e2afe4290103bf0d54ae7b3e62781f2a00487c9.tar.gz
PeerTube-5e2afe4290103bf0d54ae7b3e62781f2a00487c9.tar.zst
PeerTube-5e2afe4290103bf0d54ae7b3e62781f2a00487c9.zip
Limit import depending on transcoding resolutions
Diffstat (limited to 'server/helpers/youtube-dl/youtube-dl-wrapper.ts')
-rw-r--r--server/helpers/youtube-dl/youtube-dl-wrapper.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/helpers/youtube-dl/youtube-dl-wrapper.ts b/server/helpers/youtube-dl/youtube-dl-wrapper.ts
index d585e9a95..176cf3b69 100644
--- a/server/helpers/youtube-dl/youtube-dl-wrapper.ts
+++ b/server/helpers/youtube-dl/youtube-dl-wrapper.ts
@@ -21,7 +21,11 @@ const processOptions = {
21 21
22class YoutubeDLWrapper { 22class YoutubeDLWrapper {
23 23
24 constructor (private readonly url: string = '', private readonly enabledResolutions: number[] = []) { 24 constructor (
25 private readonly url: string,
26 private readonly enabledResolutions: number[],
27 private readonly useBestFormat: boolean
28 ) {
25 29
26 } 30 }
27 31
@@ -30,7 +34,7 @@ class YoutubeDLWrapper {
30 34
31 const info = await youtubeDL.getInfo({ 35 const info = await youtubeDL.getInfo({
32 url: this.url, 36 url: this.url,
33 format: YoutubeDLCLI.getYoutubeDLVideoFormat(this.enabledResolutions), 37 format: YoutubeDLCLI.getYoutubeDLVideoFormat(this.enabledResolutions, this.useBestFormat),
34 additionalYoutubeDLArgs: youtubeDLArgs, 38 additionalYoutubeDLArgs: youtubeDLArgs,
35 processOptions 39 processOptions
36 }) 40 })
@@ -80,7 +84,7 @@ class YoutubeDLWrapper {
80 try { 84 try {
81 await youtubeDL.download({ 85 await youtubeDL.download({
82 url: this.url, 86 url: this.url,
83 format: YoutubeDLCLI.getYoutubeDLVideoFormat(this.enabledResolutions), 87 format: YoutubeDLCLI.getYoutubeDLVideoFormat(this.enabledResolutions, this.useBestFormat),
84 output: pathWithoutExtension, 88 output: pathWithoutExtension,
85 timeout, 89 timeout,
86 processOptions 90 processOptions