mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 20:04:15 +02:00
[improvement] download clients parameters
This commit is contained in:
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
- minor UI improvements
|
- minor UI improvements
|
||||||
|
- download clients parameters
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- resetting some configuration fields during initialization
|
- resetting some configuration fields during initialization
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import time
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
from bauh.api.abstract.handler import ProcessWatcher
|
from bauh.api.abstract.handler import ProcessWatcher
|
||||||
|
from bauh.commons.html import bold
|
||||||
from bauh.view.util.translation import I18n
|
from bauh.view.util.translation import I18n
|
||||||
|
|
||||||
|
|
||||||
@@ -45,8 +46,8 @@ class TransactionStatusHandler(Thread):
|
|||||||
perc = self.gen_percentage()
|
perc = self.gen_percentage()
|
||||||
self.downloading += 1
|
self.downloading += 1
|
||||||
|
|
||||||
self.watcher.change_substatus('{}[{}/{}] {} {}'.format(perc, self.downloading, self.npkgs,
|
self.watcher.change_substatus('{}[{}/{}] {} {} {}'.format(perc, self.downloading, self.npkgs, bold('[pacman]'),
|
||||||
self.i18n['downloading'].capitalize(), output.split(' ')[1].strip()))
|
self.i18n['downloading'].capitalize(), output.split(' ')[1].strip()))
|
||||||
elif output.startswith('upgrading'):
|
elif output.startswith('upgrading'):
|
||||||
if self.get_performed() < self.npkgs:
|
if self.get_performed() < self.npkgs:
|
||||||
perc = self.gen_percentage()
|
perc = self.gen_percentage()
|
||||||
|
|||||||
@@ -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:
|
def _get_aria2c_process(self, url: str, output_path: str, cwd: str, root_password: str, threads: int) -> SimpleProcess:
|
||||||
cmd = ['aria2c', url,
|
cmd = ['aria2c', url,
|
||||||
'--no-conf',
|
'--no-conf',
|
||||||
'--max-connection-per-server={}'.format(threads),
|
'-x', '16',
|
||||||
'--enable-color=false',
|
'--enable-color=false',
|
||||||
'--stderr=true',
|
'--stderr=true',
|
||||||
'--summary-interval=0',
|
'--summary-interval=0',
|
||||||
'--disable-ipv6',
|
'--disable-ipv6',
|
||||||
'--min-split-size=1M',
|
'-k', '1M',
|
||||||
'--allow-overwrite=true',
|
'--allow-overwrite=true',
|
||||||
'--continue=true',
|
'-c',
|
||||||
'--timeout=5',
|
'-t', '5',
|
||||||
'--max-file-not-found=3',
|
'--max-file-not-found=3',
|
||||||
'--file-allocation=falloc',
|
'--file-allocation=none',
|
||||||
'--remote-time=true']
|
'--console-log-level=error']
|
||||||
|
|
||||||
if threads > 1:
|
if threads > 1:
|
||||||
cmd.append('--split={}'.format(threads))
|
cmd.append('-s')
|
||||||
|
cmd.append(str(threads))
|
||||||
|
|
||||||
if output_path:
|
if output_path:
|
||||||
output_split = output_path.split('/')
|
output_split = output_path.split('/')
|
||||||
cmd.append('--dir=' + '/'.join(output_split[:-1]))
|
cmd.append('-d')
|
||||||
cmd.append('--out=' + output_split[-1])
|
cmd.append('/'.join(output_split[:-1]))
|
||||||
|
cmd.append('-o')
|
||||||
|
cmd.append(output_split[-1])
|
||||||
|
|
||||||
return SimpleProcess(cmd=cmd, root_password=root_password, cwd=cwd)
|
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:
|
def _get_axel_process(self, url: str, output_path: str, cwd: str, root_password: str, threads: int) -> SimpleProcess:
|
||||||
cmd = ['axel', url,
|
cmd = ['axel', url, '-n', str(threads), '-4', '-c', '-T', '5']
|
||||||
'--num-connections={}'.format(threads),
|
|
||||||
'--ipv4',
|
|
||||||
'--no-clobber',
|
|
||||||
'--timeout=5']
|
|
||||||
|
|
||||||
if output_path:
|
if output_path:
|
||||||
cmd.append('--output={}'.format(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)
|
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:
|
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:
|
if output_path:
|
||||||
cmd.append('-O')
|
cmd.append('-O')
|
||||||
|
|||||||
Reference in New Issue
Block a user