aboutsummaryrefslogtreecommitdiff
path: root/homepage
diff options
context:
space:
mode:
authorBobby <[email protected]>2024-08-25 11:01:34 -0400
committerBobby <[email protected]>2024-08-25 11:01:34 -0400
commit1d3f9c61f94264fe351cd22346fbdf92e67e3839 (patch)
tree12d4c99173dda0d0857e7d77db65f83f8a05c822 /homepage
parentb8b79d95dcf2bdb955189d59aef28d5d4bccacee (diff)
downloadyugen-1d3f9c61f94264fe351cd22346fbdf92e67e3839.tar.xz
yugen-1d3f9c61f94264fe351cd22346fbdf92e67e3839.zip
motto homupage improvements
Diffstat (limited to 'homepage')
-rw-r--r--homepage/utils.py25
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()