added aria2 start hook script to update file without a proper name;increased filename column to 50%;fixed minor issue in ripping audio
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
<summary>Aria2 and youtube-dl web gui for nextcloud</summary>
|
<summary>Aria2 and youtube-dl web gui for nextcloud</summary>
|
||||||
<description>built-in torrent search;Start and stop Aria2 process, manage Aria2 from the web;
|
<description>built-in torrent search;Start and stop Aria2 process, manage Aria2 from the web;
|
||||||
Download videos from youtube, twitter and other sites;</description>
|
Download videos from youtube, twitter and other sites;</description>
|
||||||
<version>0.2.5</version>
|
<version>0.2.8</version>
|
||||||
<licence>agpl</licence>
|
<licence>agpl</licence>
|
||||||
<author mail="freefallbenson@gmail.com" homepage="https://github.com/shiningw">jiaxinhuang</author>
|
<author mail="freefallbenson@gmail.com" homepage="https://github.com/shiningw">jiaxinhuang</author>
|
||||||
<namespace>NCDownloader</namespace>
|
<namespace>NCDownloader</namespace>
|
||||||
|
|||||||
1
img/refresh.svg
Normal file
1
img/refresh.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M13.5 2c-5.621 0-10.211 4.443-10.475 10h-3.025l5 6.625 5-6.625h-2.975c.257-3.351 3.06-6 6.475-6 3.584 0 6.5 2.916 6.5 6.5s-2.916 6.5-6.5 6.5c-1.863 0-3.542-.793-4.728-2.053l-2.427 3.216c1.877 1.754 4.389 2.837 7.155 2.837 5.79 0 10.5-4.71 10.5-10.5s-4.71-10.5-10.5-10.5z"/></svg>
|
||||||
|
After Width: | Height: | Size: 371 B |
@@ -56,7 +56,11 @@ class Aria2Command extends base
|
|||||||
$this->dbconn->updateStatus($gid, Helper::STATUS[$status]);
|
$this->dbconn->updateStatus($gid, Helper::STATUS[$status]);
|
||||||
}
|
}
|
||||||
if ($action === 'start') {
|
if ($action === 'start') {
|
||||||
//Helper::log("$gid started");
|
if ($path = $input->getArgument('path')) {
|
||||||
|
$filename = basename($path);
|
||||||
|
$this->dbconn->updateFilename($gid,$filename);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class Aria2
|
|||||||
}
|
}
|
||||||
$this->php = Helper::findBinaryPath('php');
|
$this->php = Helper::findBinaryPath('php');
|
||||||
$this->completeHook = $completeHook;
|
$this->completeHook = $completeHook;
|
||||||
|
$this->startHook = $startHook;
|
||||||
$this->rpcUrl = sprintf("http://%s:%s/jsonrpc", $host, $port);
|
$this->rpcUrl = sprintf("http://%s:%s/jsonrpc", $host, $port);
|
||||||
$this->tokenString = $token ?? 'ncdownloader123';
|
$this->tokenString = $token ?? 'ncdownloader123';
|
||||||
$this->setToken($this->tokenString);
|
$this->setToken($this->tokenString);
|
||||||
@@ -311,6 +312,7 @@ class Aria2
|
|||||||
'--max-concurrent-downloads=10',
|
'--max-concurrent-downloads=10',
|
||||||
'--check-certificate=false',
|
'--check-certificate=false',
|
||||||
'--on-download-complete=' . $this->completeHook,
|
'--on-download-complete=' . $this->completeHook,
|
||||||
|
'--on-download-start=' . $this->startHook,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public function start($bin = null)
|
public function start($bin = null)
|
||||||
|
|||||||
@@ -112,4 +112,16 @@ class DBConn
|
|||||||
//$this->execute($sql, [$status, $gid]);
|
//$this->execute($sql, [$status, $gid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateFilename($gid, $filename)
|
||||||
|
{
|
||||||
|
$query = $this->queryBuilder;
|
||||||
|
$query->update($this->table)
|
||||||
|
->set("filename", $query->createNamedParameter($filename))
|
||||||
|
->where('gid = :gid')
|
||||||
|
->andWhere('filename = :filename')
|
||||||
|
->setParameter('gid', $gid)
|
||||||
|
->setParameter('filename', 'unknown');
|
||||||
|
return $query->execute();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,11 +61,11 @@ class Youtube
|
|||||||
$this->addOption('--prefer-ffmpeg');
|
$this->addOption('--prefer-ffmpeg');
|
||||||
$this->addOption('--add-metadata');
|
$this->addOption('--add-metadata');
|
||||||
$this->addOption('--metadata-from-title');
|
$this->addOption('--metadata-from-title');
|
||||||
$this->addOption("%(artist)s - %(title)s");
|
$this->addOption("%(artist)s-%(title)s");
|
||||||
$this->audioFormat = 'mp3';
|
|
||||||
}
|
|
||||||
$this->setAudioFormat($this->audioFormat);
|
|
||||||
$this->addOption('--extract-audio');
|
$this->addOption('--extract-audio');
|
||||||
|
}
|
||||||
|
$this->outTpl = "/%(id)s-%(title)s.m4a";
|
||||||
|
$this->setAudioFormat($this->audioFormat);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ class Youtube
|
|||||||
|
|
||||||
public function setAudioFormat($format)
|
public function setAudioFormat($format)
|
||||||
{
|
{
|
||||||
$this->setOption('--audio-format',$format);
|
$this->setOption('--audio-format', $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setvideoFormat($format)
|
public function setvideoFormat($format)
|
||||||
@@ -136,10 +136,8 @@ class Youtube
|
|||||||
{
|
{
|
||||||
if ($this->audioOnly) {
|
if ($this->audioOnly) {
|
||||||
$this->audioMode();
|
$this->audioMode();
|
||||||
$this->outTpl = "/%(id)s-%(title)s." . $this->audioFormat;
|
|
||||||
} else {
|
} else {
|
||||||
$this->addOption('--format');
|
$this->setOption('--format',$this->format);
|
||||||
$this->addOption($this->format);
|
|
||||||
}
|
}
|
||||||
$this->helper = YoutubeHelper::create();
|
$this->helper = YoutubeHelper::create();
|
||||||
$this->downloadDir = $this->downloadDir ?? $this->defaultDir;
|
$this->downloadDir = $this->downloadDir ?? $this->defaultDir;
|
||||||
@@ -148,7 +146,7 @@ class Youtube
|
|||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
$this->prependOption($this->bin);
|
$this->prependOption($this->bin);
|
||||||
$process = new Process($this->options, null, $this->env);
|
$process = new Process($this->options, null, $this->env);
|
||||||
//\OC::$server->getLogger()->error($process->getCommandLine(), ['app' => 'PHP']);
|
//\OC::$server->getLogger()->error($process->getWorkingDirectory(), ['app' => 'PHP']);
|
||||||
$process->setTimeout($this->timeout);
|
$process->setTimeout($this->timeout);
|
||||||
$process->run(function ($type, $buffer) use ($url) {
|
$process->run(function ($type, $buffer) use ($url) {
|
||||||
if (Process::ERR === $type) {
|
if (Process::ERR === $type) {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
.table-cell:first-child {
|
.table-cell:first-child {
|
||||||
flex : 1 1 auto;
|
flex : 1 1 auto;
|
||||||
width : 30%;
|
width : 50%;
|
||||||
overflow : hidden;
|
overflow : hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space : nowrap;
|
white-space : nowrap;
|
||||||
|
|||||||
Reference in New Issue
Block a user