From 08b9d1adccc2de6aab55a9b17a8bc4dc1ee8224d Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 26 Jul 2023 22:39:10 -0700 Subject: fix(html): a ton of edge case handling --- src/due/html.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') 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() -- cgit v1.2.3