From c0541351df4c34c406f52bc152e8b550ec110fc8 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 27 Jul 2023 19:29:23 -0700 Subject: feat(html): show total episodes for anime --- src/due/html.py | 13 +++++++++---- src/due/media.py | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/due/html.py b/src/due/html.py index f674adf..6162422 100644 --- a/src/due/html.py +++ b/src/due/html.py @@ -24,10 +24,10 @@ def seen(element, manga=False): return 0 available_matches = re.findall(r"\d+\]|\[\d+", element) - read_matches = re.search(r"\s(\d+)\s", element) + seen_matches = re.search(r"\s(\d+)/((\d+)|(\?))\s", element) - if read_matches: - read = int(read_matches.group(1)) + if seen_matches: + read = int(seen_matches.group(1)) if len(available_matches) > 1: return int(available_matches[1].strip("[]")) - read @@ -69,8 +69,13 @@ def anime_to_html(releasing_outdated_anime): continue + episodes = anime["episodes"] + total_html = ( + "" if episodes is None else f'/{episodes}' + ) + current_html.append( - f'
  • {title} {progress} [{available}]
  • ' + f'
  • {title} {progress}{total_html} [{available}]
  • ' ) current_html = sorted(current_html, key=seen) diff --git a/src/due/media.py b/src/due/media.py index 67d9e01..e97cc83 100644 --- a/src/due/media.py +++ b/src/due/media.py @@ -116,6 +116,7 @@ def media_list_collection_query(user_id: int, type) -> str: id status type + episodes title {{ romaji english native }} nextAiringEpisode {{ episode }} mediaListEntry {{ progress }} -- cgit v1.2.3