From 09123847816128ec25fd718a99ec17aa5b1707b9 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 1 Jun 2020 16:34:53 -0300 Subject: [PATCH] [improvement] download clients parameters --- CHANGELOG.md | 1 + bauh/gems/arch/output.py | 5 +++-- bauh/view/core/downloader.py | 29 ++++++++++++++--------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7c30dd2..41f9772a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/bauh/gems/arch/output.py b/bauh/gems/arch/output.py index 6df509ad..3f9efd42 100644 --- a/bauh/gems/arch/output.py +++ b/bauh/gems/arch/output.py @@ -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() diff --git a/bauh/view/core/downloader.py b/bauh/view/core/downloader.py index d01b5ccc..cede24fc 100644 --- a/bauh/view/core/downloader.py +++ b/bauh/view/core/downloader.py @@ -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')