From a05015cacafa02a6cd8a88f416874f009715780a Mon Sep 17 00:00:00 2001 From: Anatoly Date: Fri, 16 Apr 2021 19:06:02 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20a=20download=20status=20?= =?UTF-8?q?display=20bug=20on=20Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed a bug on Windows where the full path was displayed instead of only the filename --- main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 45a4c7c..8944108 100644 --- a/main.py +++ b/main.py @@ -65,8 +65,12 @@ c = Console() def prg_hook(d): - _filename = d['filename'].replace( - os.path.join(output_dir, ch['title'])+'/', '') + _filedir = os.path.join(output_dir, ch['title'])+'/' + if platform.system() == 'Windows': + _filedir = _filedir.replace('/', '\\') + + _filename = d['filename'].replace(_filedir, '') + if d['status'] == 'finished': sys.stdout.write("\033[F") sys.stdout.write("\033[K")