mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-17 07:48:18 +01:00
Updated for dict
This commit is contained in:
parent
db8f9ad2e0
commit
03872cdc91
1 changed files with 7 additions and 9 deletions
|
@ -25,7 +25,12 @@ class Downloader(Configs):
|
||||||
|
|
||||||
self.filename = None
|
self.filename = None
|
||||||
self.downloader_command: str = str()
|
self.downloader_command: str = str()
|
||||||
|
self.downloader_tools: dict = {
|
||||||
|
'wget': self.wget_downloader,
|
||||||
|
'wget2': self.wget_downloader,
|
||||||
|
'curl': self.curl_downloader,
|
||||||
|
'lftp': self.lftp_downloader
|
||||||
|
}
|
||||||
self.option_for_parallel: bool = self.utils.is_option(
|
self.option_for_parallel: bool = self.utils.is_option(
|
||||||
['-P', '--parallel'], flags)
|
['-P', '--parallel'], flags)
|
||||||
|
|
||||||
|
@ -50,18 +55,11 @@ class Downloader(Configs):
|
||||||
path: str = urlparse(url).path
|
path: str = urlparse(url).path
|
||||||
self.filename: str = unquote(Path(path).name)
|
self.filename: str = unquote(Path(path).name)
|
||||||
|
|
||||||
downloader_tool: dict = {
|
|
||||||
'wget': self.wget_downloader,
|
|
||||||
'wget2': self.wget_downloader,
|
|
||||||
'curl': self.curl_downloader,
|
|
||||||
'lftp': self.lftp_downloader
|
|
||||||
}
|
|
||||||
|
|
||||||
if url.startswith('file'):
|
if url.startswith('file'):
|
||||||
self.copy_local_binary_file(url)
|
self.copy_local_binary_file(url)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
downloader_tool[self.downloader](url)
|
self.downloader_tools[self.downloader](url)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.errors.raise_error_message(f"Downloader '{self.downloader}' not supported", exit_status=1)
|
self.errors.raise_error_message(f"Downloader '{self.downloader}' not supported", exit_status=1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue