diff options
| author | Fuwn <[email protected]> | 2023-07-26 22:39:10 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-07-26 22:39:10 -0700 |
| commit | 08b9d1adccc2de6aab55a9b17a8bc4dc1ee8224d (patch) | |
| tree | 9ea208defec281a6bf3da46f24b00d51628490f4 | |
| parent | fix(html): use english or romaji title first (diff) | |
| download | old.due.moe-08b9d1adccc2de6aab55a9b17a8bc4dc1ee8224d.tar.xz old.due.moe-08b9d1adccc2de6aab55a9b17a8bc4dc1ee8224d.zip | |
fix(html): a ton of edge case handling
| -rw-r--r-- | src/due/html.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/due/html.py b/src/due/html.py index c2f78a7..3c9fdbf 100644 --- a/src/due/html.py +++ b/src/due/html.py @@ -78,6 +78,7 @@ def manga_to_html(releasing_outdated_manga, show_missing): manga = media["media"] title = manga["title"]["native"] id = manga["id"] + previous_volume_largest_chapter = 0 if id in ids: return @@ -138,6 +139,14 @@ def manga_to_html(releasing_outdated_manga, show_missing): cache.set(str(manga["id"]) + "ag", manga_chapter_aggregate) if "none" in manga_chapter_aggregate["volumes"]: + previous_volume_largest_chapter = list( + manga_chapter_aggregate["volumes"][ + str( + dict(enumerate(manga_chapter_aggregate["volumes"])).get(1) + or "none" + ) + ]["chapters"] + )[0] available = list( manga_chapter_aggregate["volumes"]["none"]["chapters"] )[0] @@ -150,7 +159,7 @@ def manga_to_html(releasing_outdated_manga, show_missing): try: available = list( manga_chapter_aggregate["volumes"][ - str(len(list(manga_chapter_aggregate["volumes"]))) + str(list(manga_chapter_aggregate["volumes"])[0]) ]["chapters"] )[0] except Exception: @@ -187,6 +196,9 @@ def manga_to_html(releasing_outdated_manga, show_missing): if str(available)[0].isdigit(): available = math.floor(float(available)) + if math.floor(float(previous_volume_largest_chapter)) > available: + available = math.floor(float(previous_volume_largest_chapter)) + if int(progress) >= int(available): ids.pop() |