Removed unused

This commit is contained in:
Dimitris Zlatanidis 2023-03-13 00:51:29 +02:00
parent c5676401da
commit b5ff4257eb

View file

@ -22,13 +22,7 @@ class Downloader(Configs, Utilities):
self.color = self.colour()
self.output: int = 0
self.stderr = None
self.stdout = None
self.bold: str = self.color['bold']
self.green: str = self.color['green']
self.yellow = self.color['yellow']
self.red: str = self.color['red']
self.blue: str = self.color['blue']
self.endc: str = self.color['endc']
@ -53,29 +47,30 @@ class Downloader(Configs, Utilities):
filename: str = url.split('/')[-1]
if self.downloader == 'wget':
self.output = subprocess.call(f'{self.downloader} {self.wget_options} --directory-prefix={self.path} '
f'"{url}"', shell=True, stderr=self.stderr, stdout=self.stdout)
output = subprocess.call(f'{self.downloader} {self.wget_options} --directory-prefix={self.path} '
f'"{url}"', shell=True)
elif self.downloader == 'curl':
self.output = subprocess.call(f'{self.downloader} {self.curl_options} "{url}" --output '
f'{self.path}/{filename}', shell=True, stderr=self.stderr,
stdout=self.stdout)
output = subprocess.call(f'{self.downloader} {self.curl_options} "{url}" --output '
f'{self.path}/{filename}', shell=True)
elif self.downloader == 'lftp':
self.output = subprocess.call(f'lftp {self.lftp_get_options} {url} -o {self.path}',
shell=True, stderr=self.stderr, stdout=self.stdout)
output = subprocess.call(f'lftp {self.lftp_get_options} {url} -o {self.path}', shell=True)
else:
raise SystemExit(f"{self.red}Error:{self.endc} Downloader '{self.downloader}' not supported.\n")
if self.output != 0:
raise SystemExit(self.output)
if output != 0:
raise SystemExit(output)
self.check_if_downloaded(url)
self.check_if_downloaded(url, output)
def check_if_downloaded(self, url) -> None:
def check_if_downloaded(self, url, output) -> None:
""" Checks if the file downloaded. """
url: str = unquote(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}{url}{self.endc}' "
raise SystemExit(f"\n{self.bred}FAILED {output}:{self.endc} '{self.blue}{url}{self.endc}' "
f"to download.\n")