Repos / pytaku / 343f2cbb88
commit 343f2cbb8831288a59fb223c6a484290fa03dbfa
Author: Bùi Thành Nhân <hi@imnhan.com>
Date: Thu Aug 6 20:22:42 2020 +0700
mangadex oneshots don't have chap number at all
diff --git a/src/mangoapi/__init__.py b/src/mangoapi/__init__.py
index 9e66dd7..7bb4fa5 100644
--- a/src/mangoapi/__init__.py
+++ b/src/mangoapi/__init__.py
@@ -10,6 +10,9 @@
def _parse_chapter_number(string):
+ if string == "":
+ # most likely a oneshot
+ return {"number": ""}
nums = string.split(".")
count = len(nums)
assert count == 1 or count == 2
diff --git a/src/pytaku/persistence.py b/src/pytaku/persistence.py
index 41e0a00..ab3a2be 100644
--- a/src/pytaku/persistence.py
+++ b/src/pytaku/persistence.py
@@ -118,8 +118,8 @@ def save_chapter(chapter):
"id": chapter["id"],
"title_id": chapter["title_id"],
"site": "mangadex",
- "num_major": chapter["num_major"],
- "num_minor": chapter.get("num_minor", None),
+ "num_major": chapter.get("num_major"),
+ "num_minor": chapter.get("num_minor"),
"name": chapter["name"],
"pages": json.dumps(chapter["pages"]),
"groups": json.dumps(chapter["groups"]),