made it a bit easier to customize default aria2 options

This commit is contained in:
huangjx
2022-03-05 17:53:58 +08:00
parent 802c593905
commit 6d8b05687b
2 changed files with 8 additions and 5 deletions

View File

@@ -58,6 +58,10 @@ class Aria2
$this->startHook = $startHook; $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->rpcPort = $rpcPort ?? 6800;
$this->dlSpeed = $dlSpeed ?? 0;
$this->upSpeed = $upSpeed ?? "1M";
$this->logLevel = $logLevel ?? 'warn';
$this->setToken($this->tokenString); $this->setToken($this->tokenString);
$this->confDir = $conf_dir; $this->confDir = $conf_dir;
$this->sessionFile = $this->confDir . "/aria2.session"; $this->sessionFile = $this->confDir . "/aria2.session";
@@ -333,17 +337,17 @@ class Aria2
'--save-session=' . $this->sessionFile, '--save-session=' . $this->sessionFile,
'--input-file=' . $this->sessionFile, '--input-file=' . $this->sessionFile,
'--log=' . $this->logFile, '--log=' . $this->logFile,
'--rpc-listen-port=6800', '--rpc-listen-port=' . $this->rpcPort,
'--follow-torrent=true', '--follow-torrent=true',
'--enable-dht=true', '--enable-dht=true',
'--enable-peer-exchange=true', '--enable-peer-exchange=true',
'--peer-id-prefix=-TR2770-', '--peer-id-prefix=-TR2770-',
'--user-agent=Transmission/2.77', '--user-agent=Transmission/2.77',
'--log-level=notice', '--log-level=' . $this->logLevel,
'--seed-ratio=1.0', '--seed-ratio=1.0',
'--bt-seed-unverified=true', '--bt-seed-unverified=true',
'--max-overall-upload-limit=1M', '--max-overall-upload-limit=' . $this->upSpeed,
'--max-overall-download-limit=0', '--max-overall-download-limit=' . $this->dlSpeed,
'--max-connection-per-server=4', '--max-connection-per-server=4',
'--max-concurrent-downloads=10', '--max-concurrent-downloads=10',
'--check-certificate=false', '--check-certificate=false',

View File

@@ -123,7 +123,6 @@ class Youtube
public function download($url) public function download($url)
{ {
$this->install();
if ($this->audioOnly) { if ($this->audioOnly) {
$this->audioMode(); $this->audioMode();
} else { } else {