From 01b3cfc39c73fec72f60a24bae51050a929f40b6 Mon Sep 17 00:00:00 2001 From: benadha Date: Sat, 15 Jan 2022 14:39:32 +0700 Subject: Hotfix: url meta window issue and update version --- epy.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'epy.py') diff --git a/epy.py b/epy.py index 5060850..1572ad0 100755 --- a/epy.py +++ b/epy.py @@ -22,7 +22,7 @@ examples: """ -__version__ = "2022.1.8" +__version__ = "2022.1.15" __license__ = "GPL-3.0" __author__ = "Benawi Adha" __email__ = "benawiadha@gmail.com" @@ -931,7 +931,7 @@ class URL(Ebook): return self.html def get_img_bytestr(self, src: str) -> Tuple[str, bytes]: - image_url = urljoin(self.path, src) + image_url = src if is_url(src) else urljoin(self.path, src) # TODO: catch error on request with urlopen(Request(image_url, headers=URL._header)) as response: byte_str = response.read() @@ -2520,9 +2520,12 @@ class Reader: @text_win def show_win_metadata(self): - mdata = "[File Info]\nPATH: {}\nSIZE: {} MB\n \n[Book Info]\n".format( - self.ebook.path, round(os.path.getsize(self.ebook.path) / 1024 ** 2, 2) - ) + if os.path.isfile(self.ebook.path): + mdata = "[File Info]\nPATH: {}\nSIZE: {} MB\n \n[Book Info]\n".format( + self.ebook.path, round(os.path.getsize(self.ebook.path) / 1024 ** 2, 2) + ) + else: + mdata = "[File Info]\nPATH: {}\n \n[Book Info]\n".format(self.ebook.path) book_metadata = self.ebook.get_meta() for field in dataclasses.fields(book_metadata): -- cgit