mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-16 03:41:11 +01:00
Updated for filename
This commit is contained in:
parent
0d5d779722
commit
a7d7c958ee
1 changed files with 6 additions and 4 deletions
|
@ -4,8 +4,8 @@
|
||||||
import shutil
|
import shutil
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from urllib.parse import unquote
|
|
||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
|
from urllib.parse import unquote, urlparse
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
|
@ -46,7 +46,8 @@ class Downloader(Configs):
|
||||||
def tool(self, url: str) -> None:
|
def tool(self, url: str) -> None:
|
||||||
""" Downloader tools wget, wget2, curl and lftp. """
|
""" Downloader tools wget, wget2, curl and lftp. """
|
||||||
command: str = ''
|
command: str = ''
|
||||||
filename: str = url.split('/')[-1]
|
path: str = urlparse(url).path
|
||||||
|
filename: str = Path(path).name
|
||||||
|
|
||||||
if url.startswith('file'):
|
if url.startswith('file'):
|
||||||
shutil.copy2(url[7:], self.tmp_slpkg)
|
shutil.copy2(url[7:], self.tmp_slpkg)
|
||||||
|
@ -69,8 +70,9 @@ class Downloader(Configs):
|
||||||
def check_if_downloaded(self, url: str) -> None:
|
def check_if_downloaded(self, url: str) -> None:
|
||||||
""" Checks if the file downloaded. """
|
""" Checks if the file downloaded. """
|
||||||
url: str = unquote(url)
|
url: str = unquote(url)
|
||||||
file: str = url.split('/')[-1]
|
path: str = urlparse(url).path
|
||||||
path_file: Path = Path(self.path, file)
|
filename: str = Path(path).name
|
||||||
|
path_file: Path = Path(self.path, filename)
|
||||||
|
|
||||||
if not path_file.exists():
|
if not path_file.exists():
|
||||||
self.errors.raise_error_message(f"Download the '{url}' file", exit_status=20)
|
self.errors.raise_error_message(f"Download the '{url}' file", exit_status=20)
|
||||||
|
|
Loading…
Reference in a new issue