public function __construct(Config $config = null)
{
if (isset($config)) {
$this->config = $config;
} else {
$this->config = Config::getInstance();
}
$this->procBuilder = new ProcessBuilder();
if (!is_file($this->config->youtubedl)) {
throw new \Exception("Can't find youtube-dl at " . $this->config->youtubedl);
} elseif (!is_file($this->config->python)) {
throw new \Exception("Can't find Python at " . $this->config->python);
}
$this->procBuilder->setPrefix(array_merge([$this->config->python, $this->config->youtubedl], $this->config->params));
}