aboutsummaryrefslogtreecommitdiffstats
path: root/epy.py
diff options
context:
space:
mode:
authorbenadha <benawiadha@gmail.com>2022-01-15 14:39:32 +0700
committerbenadha <benawiadha@gmail.com>2022-01-15 14:39:32 +0700
commit01b3cfc39c73fec72f60a24bae51050a929f40b6 (patch)
tree4f8a3cb16f7177b621782f544c1cc3944985ceff /epy.py
parent75b5e6a04a116902703cc99d12889b10bcd23023 (diff)
downloadepy-01b3cfc39c73fec72f60a24bae51050a929f40b6.tar.gz
Hotfix: url meta window issue and update versionv2022.1.15
Diffstat (limited to 'epy.py')
-rwxr-xr-xepy.py13
1 files changed, 8 insertions, 5 deletions
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):