Add a way to pass a Config object to VideoDownload
This commit is contained in:
parent
a3dee17b2a
commit
b6f8e585be
1 changed files with 6 additions and 2 deletions
|
@ -29,9 +29,13 @@ class VideoDownload
|
||||||
/**
|
/**
|
||||||
* VideoDownload constructor.
|
* VideoDownload constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct(Config $config = null)
|
||||||
{
|
{
|
||||||
$this->config = Config::getInstance();
|
if (isset($config)) {
|
||||||
|
$this->config = $config;
|
||||||
|
} else {
|
||||||
|
$this->config = Config::getInstance();
|
||||||
|
}
|
||||||
$this->procBuilder = new ProcessBuilder();
|
$this->procBuilder = new ProcessBuilder();
|
||||||
if (!is_file($this->config->youtubedl)) {
|
if (!is_file($this->config->youtubedl)) {
|
||||||
throw new \Exception("Can't find youtube-dl at ".$this->config->youtubedl);
|
throw new \Exception("Can't find youtube-dl at ".$this->config->youtubedl);
|
||||||
|
|
Loading…
Reference in a new issue