[improvement] download clients parameters

This commit is contained in:
Vinicius Moreira
2020-06-01 16:34:53 -03:00
parent 5327747bbf
commit 0912384781
3 changed files with 18 additions and 17 deletions

View File

@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Improvements
- minor UI improvements
- download clients parameters
### Fixes
- resetting some configuration fields during initialization

View File

@@ -3,6 +3,7 @@ import time
from threading import Thread
from bauh.api.abstract.handler import ProcessWatcher
from bauh.commons.html import bold
from bauh.view.util.translation import I18n
@@ -45,8 +46,8 @@ class TransactionStatusHandler(Thread):
perc = self.gen_percentage()
self.downloading += 1
self.watcher.change_substatus('{}[{}/{}] {} {}'.format(perc, self.downloading, self.npkgs,
self.i18n['downloading'].capitalize(), output.split(' ')[1].strip()))
self.watcher.change_substatus('{}[{}/{}] {} {} {}'.format(perc, self.downloading, self.npkgs, bold('[pacman]'),
self.i18n['downloading'].capitalize(), output.split(' ')[1].strip()))
elif output.startswith('upgrading'):
if self.get_performed() < self.npkgs:
perc = self.gen_percentage()

View File

@@ -42,35 +42,34 @@ class AdaptableFileDownloader(FileDownloader):
def _get_aria2c_process(self, url: str, output_path: str, cwd: str, root_password: str, threads: int) -> SimpleProcess:
cmd = ['aria2c', url,
'--no-conf',
'--max-connection-per-server={}'.format(threads),
'-x', '16',
'--enable-color=false',
'--stderr=true',
'--summary-interval=0',
'--disable-ipv6',
'--min-split-size=1M',
'-k', '1M',
'--allow-overwrite=true',
'--continue=true',
'--timeout=5',
'-c',
'-t', '5',
'--max-file-not-found=3',
'--file-allocation=falloc',
'--remote-time=true']
'--file-allocation=none',
'--console-log-level=error']
if threads > 1:
cmd.append('--split={}'.format(threads))
cmd.append('-s')
cmd.append(str(threads))
if output_path:
output_split = output_path.split('/')
cmd.append('--dir=' + '/'.join(output_split[:-1]))
cmd.append('--out=' + output_split[-1])
cmd.append('-d')
cmd.append('/'.join(output_split[:-1]))
cmd.append('-o')
cmd.append(output_split[-1])
return SimpleProcess(cmd=cmd, root_password=root_password, cwd=cwd)
def _get_axel_process(self, url: str, output_path: str, cwd: str, root_password: str, threads: int) -> SimpleProcess:
cmd = ['axel', url,
'--num-connections={}'.format(threads),
'--ipv4',
'--no-clobber',
'--timeout=5']
cmd = ['axel', url, '-n', str(threads), '-4', '-c', '-T', '5']
if output_path:
cmd.append('--output={}'.format(output_path))
@@ -78,7 +77,7 @@ class AdaptableFileDownloader(FileDownloader):
return SimpleProcess(cmd=cmd, cwd=cwd, root_password=root_password)
def _get_wget_process(self, url: str, output_path: str, cwd: str, root_password: str) -> SimpleProcess:
cmd = ['wget', url, '--continue', '--retry-connrefused', '--tries=10', '--no-config']
cmd = ['wget', url, '-c', '--retry-connrefused', '-t', '10', '--no-config', '-nc']
if output_path:
cmd.append('-O')