diff options
| author | Bobby <[email protected]> | 2024-08-25 11:01:34 -0400 |
|---|---|---|
| committer | Bobby <[email protected]> | 2024-08-25 11:01:34 -0400 |
| commit | 1d3f9c61f94264fe351cd22346fbdf92e67e3839 (patch) | |
| tree | 12d4c99173dda0d0857e7d77db65f83f8a05c822 /homepage | |
| parent | b8b79d95dcf2bdb955189d59aef28d5d4bccacee (diff) | |
| download | yugen-1d3f9c61f94264fe351cd22346fbdf92e67e3839.tar.xz yugen-1d3f9c61f94264fe351cd22346fbdf92e67e3839.zip | |
motto homupage improvements
Diffstat (limited to 'homepage')
| -rw-r--r-- | homepage/utils.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/homepage/utils.py b/homepage/utils.py index 05c088b..f374224 100644 --- a/homepage/utils.py +++ b/homepage/utils.py @@ -27,6 +27,27 @@ def get_current_year(): return time.localtime().tm_year +def get_next_season(): + current_season = get_current_season() + if current_season == "WINTER": + return "SPRING" + elif current_season == "SPRING": + return "SUMMER" + elif current_season == "SUMMER": + return "FALL" + else: + return "WINTER" + + +def get_next_season_year(): + current_season = get_current_season() + current_year = get_current_year() + if current_season == "WINTER": + return current_year + else: + return current_year + 1 + + def get_trending_anime(): request_url = f"{CONSUMET_URL}/meta/anilist/trending?page=1&perPage=34" response = requests.get(request_url) @@ -54,8 +75,8 @@ def get_top_airing_anime(): def get_upcoming_anime(): - season = get_current_season() - year = get_current_year() + season = get_next_season() + year = get_next_season_year() request_url = f"{CONSUMET_URL}/meta/anilist/advanced-search?type=ANIME&status=NOT_YET_RELEASED&sort=[%22POPULARITY_DESC%22]&season={season}&year={year}&?page=1&perPage=6" response = requests.get(request_url) return response.json() |
