aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/helpers/youtube-dl.ts12
-rw-r--r--server/initializers/config.ts6
2 files changed, 14 insertions, 4 deletions
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts
index 87a0d0584..d17c9d554 100644
--- a/server/helpers/youtube-dl.ts
+++ b/server/helpers/youtube-dl.ts
@@ -6,6 +6,7 @@ import { peertubeTruncate, root } from './core-utils'
6import { ensureDir, remove, writeFile } from 'fs-extra' 6import { ensureDir, remove, writeFile } from 'fs-extra'
7import * as request from 'request' 7import * as request from 'request'
8import { createWriteStream } from 'fs' 8import { createWriteStream } from 'fs'
9import { CONFIG } from '@server/initializers/config'
9 10
10export type YoutubeDLInfo = { 11export type YoutubeDLInfo = {
11 name?: string 12 name?: string
@@ -45,11 +46,16 @@ function downloadYoutubeDLVideo (url: string, timeout: number) {
45 46
46 logger.info('Importing youtubeDL video %s', url) 47 logger.info('Importing youtubeDL video %s', url)
47 48
48 const options = [ '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best', '-o', path ] 49 let options = [ '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best', '-o', path ]
50
51 if (CONFIG.IMPORT.VIDEOS.HTTP.PROXY.ENABLED) {
52 logger.debug('Using proxy for YoutubeDL')
53
54 options = [ '--proxy', CONFIG.IMPORT.VIDEOS.HTTP.PROXY.URL ].concat(options)
55 }
49 56
50 if (process.env.FFMPEG_PATH) { 57 if (process.env.FFMPEG_PATH) {
51 options.push('--ffmpeg-location') 58 options = options.concat([ '--ffmpeg-location', process.env.FFMPEG_PATH ])
52 options.push(process.env.FFMPEG_PATH)
53 } 59 }
54 60
55 return new Promise<string>(async (res, rej) => { 61 return new Promise<string>(async (res, rej) => {
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 95b069533..7fd77f3e8 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -191,7 +191,11 @@ const CONFIG = {
191 IMPORT: { 191 IMPORT: {
192 VIDEOS: { 192 VIDEOS: {
193 HTTP: { 193 HTTP: {
194 get ENABLED () { return config.get<boolean>('import.videos.http.enabled') } 194 get ENABLED () { return config.get<boolean>('import.videos.http.enabled') },
195 PROXY: {
196 get ENABLED () { return config.get<boolean>('import.videos.http.proxy.enabled') },
197 get URL () { return config.get<string>('import.videos.http.proxy.url') }
198 }
195 }, 199 },
196 TORRENT: { 200 TORRENT: {
197 get ENABLED () { return config.get<boolean>('import.videos.torrent.enabled') } 201 get ENABLED () { return config.get<boolean>('import.videos.torrent.enabled') }