diff options
| author | Fuwn <[email protected]> | 2023-07-27 19:29:23 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-07-27 19:29:23 -0700 |
| commit | c0541351df4c34c406f52bc152e8b550ec110fc8 (patch) | |
| tree | 61f1a48c900d9c312ae3519dd28c28b9452c4b7e /src | |
| parent | fix(html): unavailable gte (diff) | |
| download | old.due.moe-c0541351df4c34c406f52bc152e8b550ec110fc8.tar.xz old.due.moe-c0541351df4c34c406f52bc152e8b550ec110fc8.zip | |
feat(html): show total episodes for anime
Diffstat (limited to 'src')
| -rw-r--r-- | src/due/html.py | 13 | ||||
| -rw-r--r-- | 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'<span style="opacity: 50%">/{episodes}</span>' + ) + current_html.append( - f'<li><a href="https://anilist.co/anime/{id}" target="_blank">{title}</a> {progress} [{available}]</li>' + f'<li><a href="https://anilist.co/anime/{id}" target="_blank">{title}</a> {progress}{total_html} [{available}]</li>' ) 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 }} |