Fix download cleanup
Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
parent
c0a446749a
commit
7ebd051ed3
|
|
@ -31,7 +31,7 @@ class DownloadStatus:
|
||||||
return self.__download.name
|
return self.__download.name
|
||||||
|
|
||||||
def path(self):
|
def path(self):
|
||||||
return "{}{}/{}".format(DOWNLOAD_DIR, self.__uid, self.name())
|
return "{}{}".format(DOWNLOAD_DIR, self.__uid)
|
||||||
|
|
||||||
def size(self):
|
def size(self):
|
||||||
return self.__download.total_length_string()
|
return self.__download.total_length_string()
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,8 @@ import mimetypes
|
||||||
|
|
||||||
def clean_download(path: str):
|
def clean_download(path: str):
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
if os.path.isfile(path):
|
LOGGER.info("Cleaning download: {}".format(path))
|
||||||
os.remove(path)
|
shutil.rmtree(path)
|
||||||
else:
|
|
||||||
shutil.rmtree(path)
|
|
||||||
|
|
||||||
|
|
||||||
def exit_clean_up(signal, frame):
|
def exit_clean_up(signal, frame):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue