Updated for ponce

This commit is contained in:
Dimitris Zlatanidis 2023-03-05 10:32:54 +02:00
parent 4c4f7e34e1
commit dcf850da0b

View file

@ -25,7 +25,7 @@ class Downloader(Configs, Utilities):
self.color = self.colour()
self.progress = ProgressBar()
self.output = 0
self.output: int = 0
self.stderr = None
self.stdout = None
@ -57,15 +57,13 @@ class Downloader(Configs, Utilities):
def check_if_downloaded(self) -> None:
""" Checks if the file downloaded. """
if 'ponce' not in self.url:
url: str = unquote(self.url)
file: str = url.split('/')[-1]
path_file = Path(self.path, file)
url: str = unquote(self.url)
file: str = url.split('/')[-1]
path_file = Path(self.path, file)
if not path_file.exists():
raise SystemExit(f"\n{self.red}FAILED {self.output}:{self.endc} '{self.blue}{self.url}{self.endc}' "
f"to download.\n")
if not path_file.exists():
raise SystemExit(f"\n{self.red}FAILED {self.output}:{self.endc} '{self.blue}{self.url}{self.endc}' "
f"to download.\n")
def download(self) -> None:
""" Starting multiprocessing download process. """
@ -91,8 +89,8 @@ class Downloader(Configs, Utilities):
if not p1.is_alive():
if p1.exitcode != 0:
done = f' {self.bred} Failed{self.endc}'
self.output = p1.exitcode
done: str = f' {self.bred} Failed{self.endc}'
self.output: int = p1.exitcode
print(f'{self.endc}{done}', end='')
p2.terminate()