Always use custom arguments (fixes #45)

Custom arguments for curl
This commit is contained in:
Pierre Rudloff 2016-02-28 23:00:33 +01:00
parent b69a12d49c
commit c73be59a52
4 changed files with 8 additions and 4 deletions

View file

@ -32,6 +32,7 @@ Class Config
public $params = '--no-playlist --no-warnings -f best';
public $convert = false;
public $avconv = 'vendor/bin/ffmpeg';
public $curl_params = '';
/**
* Config constructor

View file

@ -32,8 +32,9 @@ Class VideoDownload
static function getUA()
{
$config = Config::getInstance();
$cmd = escapeshellcmd($config->python.' '.escapeshellarg($config->youtubedl).' '.$config->params);
exec(
escapeshellcmd($config->python).' '.escapeshellarg($config->youtubedl).' --dump-user-agent',
$cmd.' --dump-user-agent',
$version
);
return $version[0];
@ -47,8 +48,9 @@ Class VideoDownload
static function listExtractors()
{
$config = Config::getInstance();
$cmd = escapeshellcmd($config->python.' '.escapeshellarg($config->youtubedl).' '.$config->params);
exec(
escapeshellcmd($config->python).' '.escapeshellarg($config->youtubedl).' --list-extractors',
$cmd.' --list-extractors',
$extractors
);
return $extractors;
@ -65,7 +67,7 @@ Class VideoDownload
static function getFilename($url, $format=null)
{
$config = Config::getInstance();
$cmd = escapeshellcmd($config->python).' '.escapeshellarg($config->youtubedl);
$cmd = escapeshellcmd($config->python.' '.escapeshellarg($config->youtubedl).' '.$config->params);
if (isset($format)) {
$cmd .= ' -f '.escapeshellarg($format);
}

View file

@ -1,5 +1,6 @@
youtubedl: vendor/rg3/youtube-dl/youtube_dl/__main__.py
python: /usr/bin/python
params: --no-playlist --no-warnings -f best
curl_params:
convert: false
avconv: vendor/bin/ffmpeg

View file

@ -130,7 +130,7 @@ class FrontController
);
header("Content-Type: audio/mpeg");
passthru(
'curl --user-agent '.escapeshellarg($UA).
'curl '.$config->curl_params.' --user-agent '.escapeshellarg($UA).
' '.escapeshellarg($video->url).
' | '.$config->avconv.
' -v quiet -i - -f mp3 -vn pipe:1'