aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFlorent <florent.git@zeteo.me>2022-01-09 17:21:45 +0100
committerChocobozzz <chocobozzz@cpy.re>2022-01-10 10:01:43 +0100
commit22c777863088f90c7f3f9df613b42952abab856d (patch)
tree4598391136ce36e8f94cd95604fe4aa80c4bb831
parentf332d502d5d6a6c7ab62199c8b45f24e488f48e7 (diff)
downloadPeerTube-22c777863088f90c7f3f9df613b42952abab856d.tar.gz
PeerTube-22c777863088f90c7f3f9df613b42952abab856d.tar.zst
PeerTube-22c777863088f90c7f3f9df613b42952abab856d.zip
Give the ability to define python path for youtube-dl / yt-dlp
-rw-r--r--config/default.yaml3
-rw-r--r--config/production.yaml.example3
-rw-r--r--server/helpers/youtube-dl/youtube-dl-cli.ts3
-rw-r--r--server/initializers/config.ts3
4 files changed, 10 insertions, 2 deletions
diff --git a/config/default.yaml b/config/default.yaml
index e254c2c28..2b0419535 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -446,6 +446,9 @@ import:
446 # yt-dlp is also supported 446 # yt-dlp is also supported
447 name: 'youtube-dl' 447 name: 'youtube-dl'
448 448
449 # Path to the python binary to execute for youtube-dl or yt-dlp
450 python_path: '/usr/bin/python3'
451
449 # IPv6 is very strongly rate-limited on most sites supported by youtube-dl 452 # IPv6 is very strongly rate-limited on most sites supported by youtube-dl
450 force_ipv4: false 453 force_ipv4: false
451 454
diff --git a/config/production.yaml.example b/config/production.yaml.example
index 0ce0b9d0e..893ccc33e 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -454,6 +454,9 @@ import:
454 # yt-dlp is also supported 454 # yt-dlp is also supported
455 name: 'youtube-dl' 455 name: 'youtube-dl'
456 456
457 # Path to the python binary to execute for youtube-dl or yt-dlp
458 python_path: '/usr/bin/python3'
459
457 # IPv6 is very strongly rate-limited on most sites supported by youtube-dl 460 # IPv6 is very strongly rate-limited on most sites supported by youtube-dl
458 force_ipv4: false 461 force_ipv4: false
459 462
diff --git a/server/helpers/youtube-dl/youtube-dl-cli.ts b/server/helpers/youtube-dl/youtube-dl-cli.ts
index 559f92984..293acff43 100644
--- a/server/helpers/youtube-dl/youtube-dl-cli.ts
+++ b/server/helpers/youtube-dl/youtube-dl-cli.ts
@@ -153,7 +153,8 @@ export class YoutubeDLCLI {
153 completeArgs = this.wrapWithIPOptions(completeArgs) 153 completeArgs = this.wrapWithIPOptions(completeArgs)
154 completeArgs = this.wrapWithFFmpegOptions(completeArgs) 154 completeArgs = this.wrapWithFFmpegOptions(completeArgs)
155 155
156 const output = await execa('python', [ youtubeDLBinaryPath, ...completeArgs, url ], processOptions) 156 const { PYTHON_PATH } = CONFIG.IMPORT.VIDEOS.HTTP.YOUTUBE_DL_RELEASE
157 const output = await execa(PYTHON_PATH, [ youtubeDLBinaryPath, ...completeArgs, url ], processOptions)
157 158
158 logger.debug('Runned youtube-dl command.', { command: output.command, ...lTags() }) 159 logger.debug('Runned youtube-dl command.', { command: output.command, ...lTags() })
159 160
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index f2e9f7088..fb6f7ae62 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -333,7 +333,8 @@ const CONFIG = {
333 333
334 YOUTUBE_DL_RELEASE: { 334 YOUTUBE_DL_RELEASE: {
335 get URL () { return config.get<string>('import.videos.http.youtube_dl_release.url') }, 335 get URL () { return config.get<string>('import.videos.http.youtube_dl_release.url') },
336 get NAME () { return config.get<string>('import.videos.http.youtube_dl_release.name') } 336 get NAME () { return config.get<string>('import.videos.http.youtube_dl_release.name') },
337 get PYTHON_PATH () { return config.get<string>('import.videos.http.youtube_dl_release.python_path') }
337 }, 338 },
338 339
339 get FORCE_IPV4 () { return config.get<boolean>('import.videos.http.force_ipv4') } 340 get FORCE_IPV4 () { return config.get<boolean>('import.videos.http.force_ipv4') }