diff --git a/appinfo/info.xml b/appinfo/info.xml
index 79541fd..65f07a2 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -5,7 +5,7 @@
Aria2 and youtube-dl web gui for nextcloud
built-in torrent search;Start and stop Aria2 process, manage Aria2 from the web;
Download videos from youtube, twitter and other sites;
- 0.2.5
+ 0.2.8
agpl
jiaxinhuang
NCDownloader
diff --git a/img/refresh.svg b/img/refresh.svg
new file mode 100644
index 0000000..ce46e1f
--- /dev/null
+++ b/img/refresh.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/lib/Command/Aria2Command.php b/lib/Command/Aria2Command.php
index 8cecfec..3a9af40 100644
--- a/lib/Command/Aria2Command.php
+++ b/lib/Command/Aria2Command.php
@@ -56,7 +56,11 @@ class Aria2Command extends base
$this->dbconn->updateStatus($gid, Helper::STATUS[$status]);
}
if ($action === 'start') {
- //Helper::log("$gid started");
+ if ($path = $input->getArgument('path')) {
+ $filename = basename($path);
+ $this->dbconn->updateFilename($gid,$filename);
+ }
+
}
return 1;
}
diff --git a/lib/Tools/Aria2.php b/lib/Tools/Aria2.php
index 7301a49..6b9166a 100644
--- a/lib/Tools/Aria2.php
+++ b/lib/Tools/Aria2.php
@@ -50,6 +50,7 @@ class Aria2
}
$this->php = Helper::findBinaryPath('php');
$this->completeHook = $completeHook;
+ $this->startHook = $startHook;
$this->rpcUrl = sprintf("http://%s:%s/jsonrpc", $host, $port);
$this->tokenString = $token ?? 'ncdownloader123';
$this->setToken($this->tokenString);
@@ -311,6 +312,7 @@ class Aria2
'--max-concurrent-downloads=10',
'--check-certificate=false',
'--on-download-complete=' . $this->completeHook,
+ '--on-download-start=' . $this->startHook,
];
}
public function start($bin = null)
diff --git a/lib/Tools/DBConn.php b/lib/Tools/DBConn.php
index 217dcc5..4509eea 100644
--- a/lib/Tools/DBConn.php
+++ b/lib/Tools/DBConn.php
@@ -112,4 +112,16 @@ class DBConn
//$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();
+ }
+
}
diff --git a/lib/Tools/Youtube.php b/lib/Tools/Youtube.php
index 9fc486a..f6b02e9 100644
--- a/lib/Tools/Youtube.php
+++ b/lib/Tools/Youtube.php
@@ -61,11 +61,11 @@ class Youtube
$this->addOption('--prefer-ffmpeg');
$this->addOption('--add-metadata');
$this->addOption('--metadata-from-title');
- $this->addOption("%(artist)s - %(title)s");
- $this->audioFormat = 'mp3';
+ $this->addOption("%(artist)s-%(title)s");
+ $this->addOption('--extract-audio');
}
+ $this->outTpl = "/%(id)s-%(title)s.m4a";
$this->setAudioFormat($this->audioFormat);
- $this->addOption('--extract-audio');
return $this;
}
@@ -76,7 +76,7 @@ class Youtube
public function setAudioFormat($format)
{
- $this->setOption('--audio-format',$format);
+ $this->setOption('--audio-format', $format);
}
public function setvideoFormat($format)
@@ -136,10 +136,8 @@ class Youtube
{
if ($this->audioOnly) {
$this->audioMode();
- $this->outTpl = "/%(id)s-%(title)s." . $this->audioFormat;
} else {
- $this->addOption('--format');
- $this->addOption($this->format);
+ $this->setOption('--format',$this->format);
}
$this->helper = YoutubeHelper::create();
$this->downloadDir = $this->downloadDir ?? $this->defaultDir;
@@ -148,7 +146,7 @@ class Youtube
$this->setUrl($url);
$this->prependOption($this->bin);
$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->run(function ($type, $buffer) use ($url) {
if (Process::ERR === $type) {
diff --git a/src/css/table.scss b/src/css/table.scss
index 78c567f..349562d 100644
--- a/src/css/table.scss
+++ b/src/css/table.scss
@@ -52,7 +52,7 @@
.table-cell:first-child {
flex : 1 1 auto;
- width : 30%;
+ width : 50%;
overflow : hidden;
text-overflow: ellipsis;
white-space : nowrap;