aboutsummaryrefslogtreecommitdiffstats
path: root/epy.py
diff options
context:
space:
mode:
authorwustho <benawiadha@gmail.com>2020-09-22 04:54:06 +0700
committerwustho <benawiadha@gmail.com>2020-09-22 04:54:06 +0700
commit7ff7835c956db333e1c63fdc3cb1f8f476f09af7 (patch)
treee38d74a50145ad24a25b39c99af0015637111271 /epy.py
parenta61eed521f667a7c6e1e3cb5a34d41e24e24c9af (diff)
downloadepy-7ff7835c956db333e1c63fdc3cb1f8f476f09af7.tar.gz
Widen try-finally: cleanup.
Diffstat (limited to 'epy.py')
-rwxr-xr-xepy.py47
1 files changed, 22 insertions, 25 deletions
diff --git a/epy.py b/epy.py
index b64d01e..7365e06 100755
--- a/epy.py
+++ b/epy.py
@@ -14,7 +14,7 @@ Options:
"""
-__version__ = "2020.9.21"
+__version__ = "2020.9.22"
__license__ = "GPL-3.0"
__author__ = "Benawi Adha"
__url__ = "https://github.com/wustho/epy"
@@ -1644,34 +1644,31 @@ def preread(stdscr, file):
ebook = det_ebook_cls(file)
- if ebook.path in STATE["States"]:
- idx = STATE["States"][ebook.path]["index"]
- width = STATE["States"][ebook.path]["width"]
- y = STATE["States"][ebook.path]["pos"]
- else:
- STATE["States"][ebook.path] = {}
- STATE["States"][ebook.path]["bmarks"] = []
- idx = 0
- y = 0
- width = 80
- pctg = None
+ try:
+ if ebook.path in STATE["States"]:
+ idx = STATE["States"][ebook.path]["index"]
+ width = STATE["States"][ebook.path]["width"]
+ y = STATE["States"][ebook.path]["pos"]
+ else:
+ STATE["States"][ebook.path] = {}
+ STATE["States"][ebook.path]["bmarks"] = []
+ idx = 0
+ y = 0
+ width = 80
+ pctg = None
- if cols <= width + 4:
- width = cols - 4
- pctg = STATE["States"][ebook.path].get("pctg", None)
+ if cols <= width + 4:
+ width = cols - 4
+ pctg = STATE["States"][ebook.path].get("pctg", None)
- try:
ebook.initialize()
- except:
- ebook.cleanup()
- find_media_viewer()
- find_dict_client()
- parse_keys()
- SHOWPROGRESS = CFG["ShowProgressIndicator"]
- count_max_reading_pg(ebook)
+ find_media_viewer()
+ find_dict_client()
+ parse_keys()
+ SHOWPROGRESS = CFG["ShowProgressIndicator"]
+ count_max_reading_pg(ebook)
- sec = ""
- try:
+ sec = ""
while True:
incr, width, y, pctg, sec = reader(
ebook, idx, width, y, pctg, sec