aboutsummaryrefslogtreecommitdiffstats
path: root/epy.py
diff options
context:
space:
mode:
authorwustho <benawiadha@gmail.com>2020-09-22 15:14:18 +0700
committerwustho <benawiadha@gmail.com>2020-09-22 15:14:18 +0700
commit2c8891a2b508d54bc58ad3fe27bd180dec3819e7 (patch)
tree407d0799824e1b87afbdbe70dd021785d1a7f275 /epy.py
parent324ae009ea27ea110440ef1805b332910bd83238 (diff)
downloadepy-2c8891a2b508d54bc58ad3fe27bd180dec3819e7.tar.gz
Fixed toc entry with missing or empty index location.
Diffstat (limited to 'epy.py')
-rwxr-xr-xepy.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/epy.py b/epy.py
index afdca4e..f92161a 100755
--- a/epy.py
+++ b/epy.py
@@ -209,7 +209,10 @@ class Epub:
src = i.get("href")
name = "".join(list(i.itertext()))
src = src.split("#")
- idx = contents.index(unquote(src[0]))
+ try:
+ idx = contents.index(unquote(src[0]))
+ except ValueError:
+ continue
self.toc_entries[0].append(name)
self.toc_entries[1].append(idx)
if len(src) == 2:
@@ -302,7 +305,10 @@ class Mobi(Epub):
src = i.get("href")
name = "".join(list(i.itertext()))
src = src.split("#")
- idx = contents.index(unquote(src[0]))
+ try:
+ idx = contents.index(unquote(src[0]))
+ except ValueError:
+ continue
self.toc_entries[0].append(name)
self.toc_entries[1].append(idx)
if len(src) == 2: