Skip to content

Commit 0344276

Browse files
committed
fix Hath scanner crash on corner case #7
1 parent 0614703 commit 0344276

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

comiclib/scanner/21-hath.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ class Scanner:
1010
def scan(self, path: Path, id: str, metadata: dict, prev_scanners: list[str]) -> bool:
1111
if path.is_dir() and (path / 'galleryinfo.txt').exists():
1212
logger.info(f' <- {path}')
13-
metadata["source"] = 'https://exhentai.org/g/' + re.search(r"\[(\d+)\]$", path.name)[1] + '/'
13+
match = re.search(r"\[(\d+)\]$", path.name)
14+
if match is not None:
15+
metadata["source"] = 'https://exhentai.org/g/' + match[1] + '/'
16+
else:
17+
metadata["source"] = 'https://exhentai.org/g/' + path.name + '/'
1418
information = (path / 'galleryinfo.txt').read_text().splitlines()
1519
_key, _, title = information[0].partition(':')
1620
assert _key == 'Title'

0 commit comments

Comments
 (0)