added delete option for youtube-dl download;added options for copying links;

This commit is contained in:
huangjx
2022-02-19 00:44:45 +08:00
parent d25e0c1ec1
commit 06e1588d06
13 changed files with 219 additions and 23 deletions

View File

@@ -154,11 +154,13 @@ class Youtube
//\OC::$server->getLogger()->error($process->getCommandLine(), ['app' => 'PHP']);
$process = new Process($this->options, null, $this->env);
$process->setTimeout($this->timeout);
$process->run(function ($type, $buffer) use ($url) {
$data = ['link' => $url];
$process->run(function ($type, $buffer) use ($data, $process) {
if (Process::ERR === $type) {
$this->onError($buffer);
// $this->onError($buffer);
} else {
$this->onOutput($buffer, $url);
$data['pid'] = $process->getPid();
$this->onOutput($buffer, $data);
}
});
if ($process->isSuccessful()) {
@@ -173,9 +175,9 @@ class Youtube
$this->helper->log($buffer);
}
public function onOutput($buffer, $url)
public function onOutput($buffer, $extra)
{
$this->helper->run($buffer, $url);
$this->helper->run($buffer, $extra);
}
public function getDownloadUrl($url)
{