From 4c865b78bfd25af125b087b98416a900c346597d Mon Sep 17 00:00:00 2001 From: vincenzo-sorcigli <57498723+vincenzo-sorcigli@users.noreply.github.com> Date: Tue, 21 Mar 2023 11:59:25 -0400 Subject: [PATCH 01/10] asd asd --- anime/scripts/db_pop.py | 127 ++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 70 deletions(-) diff --git a/anime/scripts/db_pop.py b/anime/scripts/db_pop.py index bc4ca47..64a1c37 100644 --- a/anime/scripts/db_pop.py +++ b/anime/scripts/db_pop.py @@ -47,45 +47,43 @@ def addAnime(self, anime_instance: dict): # get the date where the anime started airing, if any date = anime_instance["aired"]["prop"]["from"] if date["day"] is not None: - my_from_date = datetime.date( - date["year"], date["month"], date["day"]) + my_from_date = datetime.date(date["year"], date["month"], date["day"]) else: my_from_date = None # get the season if the month the anime aired is available - my_month = my_from_date.month - match my_month: - case 1 | 2 | 3: - my_time_of_year = "Winter" - case 4 | 5 | 6: - my_time_of_year = "Spring" - case 7 | 8 | 9: - my_time_of_year = "Summer" - case 10 | 11 | 12: - my_time_of_year = "Fall" - case None: - my_time_of_year = "" - - if my_time_of_year is not "": - my_season = f"{my_time_of_year} {my_from_date.year}" + if my_from_date is not None: + my_month = my_from_date.month + match my_month: + case 1|2|3: + my_time_of_year = "Winter" + case 4|5|6: + my_time_of_year = "Spring" + case 7|8|9: + my_time_of_year = "Summer" + case 10|11|12: + my_time_of_year = "Fall" + case None: + my_time_of_year = "" + + if my_time_of_year is not "": + my_season = f"{my_time_of_year} {my_from_date.year}" else: my_season = None + # get the date where the anime stopped airing, if any date = anime_instance["aired"]["prop"]["to"] if date["day"] is not None: - my_to_date = datetime.date( - date["year"], date["month"], date["day"]) + my_to_date = datetime.date(date["year"], date["month"], date["day"]) else: my_to_date = None except Exception as err: - raise Exception( - f"something in the special anime attributes didnt work: {err}") + raise Exception(f"something in the special anime attributes didnt work: {err}") try: - # try finding a django Anime with the MAL id of the anime - my_anime = Anime.objects.get(mal_id=anime_instance["mal_id"]) + my_anime = Anime.objects.get(mal_id=anime_instance["mal_id"]) # try finding a django Anime with the MAL id of the anime # if it does exist, update all of its attributes to what the api says my_anime.mal_id = anime_instance["mal_id"] @@ -133,11 +131,9 @@ def addAnime(self, anime_instance: dict): # for every name in the genre list for genre_name in genre_list: try: - # try and find a Genre object that matches the genre name - Genre.objects.get(genre=genre_name) - # if it does exist just print that it already exists - print(f"genre already exists: {genre_name}") - except Genre.DoesNotExist: # if it does not exist + Genre.objects.get(genre=genre_name) # try and find a Genre object that matches the genre name + print(f"genre already exists: {genre_name}") # if it does exist just print that it already exists + except Genre.DoesNotExist: # if it does not exist # create a Genre object with that name and print that it was created my_genre = Genre( genre=genre_name @@ -157,11 +153,9 @@ def addAnime(self, anime_instance: dict): # for every name in the studio list for studio_name in studio_list: try: - # try and find a Studio object that matches the studio name - Studio.objects.get(studio=studio_name) - # if it does exist, just print that it already exists - print(f"studio already exists: {studio_name}") - except Studio.DoesNotExist: # if it does not exist + Studio.objects.get(studio=studio_name) # try and find a Studio object that matches the studio name + print(f"studio already exists: {studio_name}") # if it does exist, just print that it already exists + except Studio.DoesNotExist: # if it does not exist # create a Studio object with that name and print that it was created my_studio = Studio( studio=studio_name @@ -175,15 +169,17 @@ def addAnime(self, anime_instance: dict): def initialPopulation(self, pages: int = 5, min_characters: int = 10, min_side_characters: int = 5,): - for page_num in range(1, pages+1): + for page_num in range(1,pages+1): api_url = f"{self.base_top_api_url}&page={page_num}" self.requestAPI(api_url) - for instance in self.response["data"]: # instance is the anime + for instance in self.response["data"]: # instance is the anime self.addAnime(instance) + time.sleep(4) + + self.noCharacterAnime(min_characters,min_side_characters) - self.noCharacterAnime(min_characters, min_side_characters) def updateAiringAnime(self, min_characters: int = 10, min_side_characters: int = 5,): @@ -194,8 +190,7 @@ def updateAiringAnime(self, min_characters: int = 10, min_side_characters: int = self.our_airing_anime.add(anime.mal_id) print(f"our_airing_anime: {self.our_airing_anime}") except Anime.DoesNotExist: - # if there are none then just say so - print("our_airing_anime: none") + print("our_airing_anime: none") # if there are none then just say so api_url = f"{self.base_airing_api_url}" self.requestAPI(api_url) @@ -208,55 +203,44 @@ def updateAiringAnime(self, min_characters: int = 10, min_side_characters: int = self.requestAPI(api_url) for instance in self.response["data"]: - # add the anime's id to their airing anime - self.their_airing_anime.add(instance["mal_id"]) + self.their_airing_anime.add(instance["mal_id"]) #add the anime's id to their airing anime self.addAnime(instance) - # add the newly created anime to the update characters set - self.update_characters_anime.add( - Anime.objects.get(mal_id=instance["mal_id"])) + self.update_characters_anime.add(Anime.objects.get(mal_id=instance["mal_id"])) # add the newly created anime to the update characters set + + self.updateCharacters(self.update_characters_anime, min_characters, min_side_characters,) - self.updateCharacters(self.update_characters_anime, - min_characters, min_side_characters,) print(f"our_airing_anime: {self.our_airing_anime}") print(f"their_airing_anime: {self.their_airing_anime}") - # get the anime that are in our_airing_anime but not their_airing_anime # this means that they are not airing anymore and our info is outdated - wrong_anime = self.our_airing_anime.difference(self.their_airing_anime) + wrong_anime = self.our_airing_anime.difference(self.their_airing_anime) # get the anime that are in our_airing_anime but not their_airing_anime # this means that they are not airing anymore and our info is outdated print(f"wrong_anime: {wrong_anime}") for mal_id in wrong_anime: my_anime = Anime.objects.get(mal_id=mal_id) - # so just set the status to "Finished Airing" - my_anime.status = "Finished Airing" + my_anime.status = "Finished Airing" # so just set the status to "Finished Airing" my_anime.save() self.our_airing_anime = set() self.their_airing_anime = set() - def noCharacterAnime(self, min_characters: int = 10, min_side_characters: int = 5,): - no_character_anime_set = set( - Anime.objects.filter(anime_characters=None)) - self.updateCharacters(no_character_anime_set, - min_characters, min_side_characters) + def noCharacterAnime(self, min_characters: int = 10, min_side_characters: int = 5,): + no_character_anime_set = set(Anime.objects.filter(anime_characters=None)) + self.updateCharacters(no_character_anime_set, min_characters, min_side_characters) def updateCharacters(self, anime_set: set, min_characters: int = 10, min_side_characters: int = 5,): for anime in anime_set: my_mal_id = anime.mal_id - self.requestAPI( - f"https://api.jikan.moe/v4/anime/{my_mal_id}/characters") + self.requestAPI(f"https://api.jikan.moe/v4/anime/{my_mal_id}/characters") supporting_index_favorites = dict() for character in self.response["data"]: if character["role"] == "Main": self.addCharacter(character, my_mal_id) else: - # add a key value pair to the dictionary {(character mal id): (number of favorites)} - supporting_index_favorites[self.response["data"].index( - character)] = character["favorites"] + supporting_index_favorites[self.response["data"].index(character)] = character["favorites"] # add a key value pair to the dictionary {(character mal id): (number of favorites)} - sorted_supporting_index_favorites = dict(sorted(supporting_index_favorites.items( - ), key=lambda x: x[1], reverse=True)) # sort the dictionary by descending order of favorites + sorted_supporting_index_favorites = dict(sorted(supporting_index_favorites.items(), key=lambda x:x[1], reverse=True)) # sort the dictionary by descending order of favorites print(f"SORTED: {sorted_supporting_index_favorites}") main_characters = anime.anime_characters.all().count() @@ -266,24 +250,24 @@ def updateCharacters(self, anime_set: set, min_characters: int = 10, min_side_ch else: side_characters = min_characters - main_characters - side_characters_to_add = list(sorted_supporting_index_favorites.keys())[ - :side_characters] # get the first (side_characters) mal ids of the set + side_characters_to_add = list(sorted_supporting_index_favorites.keys())[:side_characters] # get the first (side_characters) mal ids of the set for character_index in side_characters_to_add: - # find the character that corresponds to the given index - side_character = self.response["data"][character_index] - # add that character - self.addCharacter(side_character, my_mal_id) + side_character = self.response["data"][character_index] # find the character that corresponds to the given index + self.addCharacter(side_character, my_mal_id) # add that character time.sleep(4) + + + + def addCharacter(self, character: dict, anime_mal_id: int): try: my_character_mal_id = character["character"]["mal_id"] my_character_name = character["character"]["name"] my_anime = Anime.objects.get(mal_id=anime_mal_id) - # if it exists it will move on fine - my_character = Character.objects.get(mal_id=my_character_mal_id) - # if not then it will move onto except + my_character = Character.objects.get(mal_id=my_character_mal_id) #if it exists it will move on fine + #if not then it will move onto except print(f"character already exists: {my_character_name}") my_anime.anime_characters.add(my_character) except Character.DoesNotExist: @@ -297,6 +281,9 @@ def addCharacter(self, character: dict, anime_mal_id: int): my_anime.anime_characters.add(my_character) + + + DBPopulate = DBPopulate() DBPopulate.initialPopulation(pages=1) From ccb20f948a381bd5e99bf7975ec9c85b8b07da39 Mon Sep 17 00:00:00 2001 From: vincenzo-sorcigli <57498723+vincenzo-sorcigli@users.noreply.github.com> Date: Tue, 21 Mar 2023 12:15:41 -0400 Subject: [PATCH 02/10] add_characters toggle for initialPopulation --- anime/scripts/db_pop.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/anime/scripts/db_pop.py b/anime/scripts/db_pop.py index 64a1c37..7ff6316 100644 --- a/anime/scripts/db_pop.py +++ b/anime/scripts/db_pop.py @@ -167,7 +167,7 @@ def addAnime(self, anime_instance: dict): my_anime.anime_studio.add(Studio.objects.get(studio=studio_name)) my_anime.save() - def initialPopulation(self, pages: int = 5, min_characters: int = 10, min_side_characters: int = 5,): + def initialPopulation(self, pages: int = 5, min_characters: int = 10, min_side_characters: int = 5, add_characters: bool = False): for page_num in range(1,pages+1): @@ -178,7 +178,8 @@ def initialPopulation(self, pages: int = 5, min_characters: int = 10, min_side_c self.addAnime(instance) time.sleep(4) - self.noCharacterAnime(min_characters,min_side_characters) + if add_characters is True: + self.noCharacterAnime(min_characters,min_side_characters) def updateAiringAnime(self, min_characters: int = 10, min_side_characters: int = 5,): From baf6902653271350ee6cb7db54ddb2bc959f1c58 Mon Sep 17 00:00:00 2001 From: vincenzo-sorcigli <57498723+vincenzo-sorcigli@users.noreply.github.com> Date: Tue, 21 Mar 2023 12:26:01 -0400 Subject: [PATCH 03/10] aaaa --- anime/scripts/db_pop.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/anime/scripts/db_pop.py b/anime/scripts/db_pop.py index 7ff6316..86c844a 100644 --- a/anime/scripts/db_pop.py +++ b/anime/scripts/db_pop.py @@ -176,7 +176,8 @@ def initialPopulation(self, pages: int = 5, min_characters: int = 10, min_side_c for instance in self.response["data"]: # instance is the anime self.addAnime(instance) - time.sleep(4) + + time.sleep(4) if add_characters is True: self.noCharacterAnime(min_characters,min_side_characters) From 47abbf3843da901eedc377a38856cf7f40aa2108 Mon Sep 17 00:00:00 2001 From: vincenzo-sorcigli <57498723+vincenzo-sorcigli@users.noreply.github.com> Date: Tue, 9 May 2023 10:36:54 -0400 Subject: [PATCH 04/10] aaaaaaaaaaaaa --- anime/scripts/db_pop.py | 54 ++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/anime/scripts/db_pop.py b/anime/scripts/db_pop.py index 86c844a..22ab607 100644 --- a/anime/scripts/db_pop.py +++ b/anime/scripts/db_pop.py @@ -53,21 +53,24 @@ def addAnime(self, anime_instance: dict): # get the season if the month the anime aired is available if my_from_date is not None: - my_month = my_from_date.month - match my_month: - case 1|2|3: - my_time_of_year = "Winter" - case 4|5|6: - my_time_of_year = "Spring" - case 7|8|9: - my_time_of_year = "Summer" - case 10|11|12: - my_time_of_year = "Fall" - case None: - my_time_of_year = "" - - if my_time_of_year is not "": - my_season = f"{my_time_of_year} {my_from_date.year}" + if my_from_date.month is not None: + my_month = my_from_date.month + + match my_month: + case 1|2|3: + my_time_of_year = "Winter" + case 4|5|6: + my_time_of_year = "Spring" + case 7|8|9: + my_time_of_year = "Summer" + case 10|11|12: + my_time_of_year = "Fall" + case None: + my_time_of_year = "" + + if my_time_of_year is not "": + my_season = f"{my_time_of_year} {my_from_date.year}" + else: my_season = None @@ -180,10 +183,10 @@ def initialPopulation(self, pages: int = 5, min_characters: int = 10, min_side_c time.sleep(4) if add_characters is True: - self.noCharacterAnime(min_characters,min_side_characters) + self.noCharacterAnime(min_characters, min_side_characters) - def updateAiringAnime(self, min_characters: int = 10, min_side_characters: int = 5,): + def updateAiringAnime(self, min_characters: int = 10, min_side_characters: int = 5, add_characters: bool = False): # get all the anime that we have that are airing try: @@ -205,11 +208,14 @@ def updateAiringAnime(self, min_characters: int = 10, min_side_characters: int = self.requestAPI(api_url) for instance in self.response["data"]: - self.their_airing_anime.add(instance["mal_id"]) #add the anime's id to their airing anime self.addAnime(instance) - self.update_characters_anime.add(Anime.objects.get(mal_id=instance["mal_id"])) # add the newly created anime to the update characters set + self.their_airing_anime.add(instance["mal_id"]) #add the anime's id to their airing anime + + if add_characters is True: + self.update_characters_anime.add(Anime.objects.get(mal_id=instance["mal_id"])) # add the newly created anime to the update characters set - self.updateCharacters(self.update_characters_anime, min_characters, min_side_characters,) + if add_characters is True: + self.updateCharacters(self.update_characters_anime, min_characters, min_side_characters,) print(f"our_airing_anime: {self.our_airing_anime}") @@ -264,9 +270,11 @@ def updateCharacters(self, anime_set: set, min_characters: int = 10, min_side_ch def addCharacter(self, character: dict, anime_mal_id: int): + + my_character_mal_id = character["character"]["mal_id"] + my_character_name = character["character"]["name"] + try: - my_character_mal_id = character["character"]["mal_id"] - my_character_name = character["character"]["name"] my_anime = Anime.objects.get(mal_id=anime_mal_id) my_character = Character.objects.get(mal_id=my_character_mal_id) #if it exists it will move on fine #if not then it will move onto except @@ -281,6 +289,8 @@ def addCharacter(self, character: dict, anime_mal_id: int): ) my_character.save() my_anime.anime_characters.add(my_character) + except Anime.DoesNotExist: + raise Exception("no anime with this mal id exists in our database lol") From e2f07b41e83da95c0a8c414aec2721d6fb2dc4a2 Mon Sep 17 00:00:00 2001 From: vincenzo-sorcigli <57498723+vincenzo-sorcigli@users.noreply.github.com> Date: Thu, 11 May 2023 11:56:45 -0400 Subject: [PATCH 05/10] final version that matches docs --- anime/scripts/db_pop.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/anime/scripts/db_pop.py b/anime/scripts/db_pop.py index 22ab607..20a2ee0 100644 --- a/anime/scripts/db_pop.py +++ b/anime/scripts/db_pop.py @@ -11,7 +11,6 @@ def __init__(self): self.base_airing_api_url = "https://api.jikan.moe/v4/anime?status=airing" self.our_airing_anime = set() self.their_airing_anime = set() - self.update_characters_anime = set() self.response = None def requestAPI(self, api_url): @@ -207,15 +206,17 @@ def updateAiringAnime(self, min_characters: int = 10, min_side_characters: int = api_url = f"{self.base_airing_api_url}&page={page_num}" self.requestAPI(api_url) + update_characters_anime = [] + for instance in self.response["data"]: self.addAnime(instance) self.their_airing_anime.add(instance["mal_id"]) #add the anime's id to their airing anime if add_characters is True: - self.update_characters_anime.add(Anime.objects.get(mal_id=instance["mal_id"])) # add the newly created anime to the update characters set + update_characters_anime.add(Anime.objects.get(mal_id=instance["mal_id"])) # add the newly created anime to the update characters set if add_characters is True: - self.updateCharacters(self.update_characters_anime, min_characters, min_side_characters,) + self.updateCharacters(update_characters_anime, min_characters, min_side_characters,) print(f"our_airing_anime: {self.our_airing_anime}") @@ -247,7 +248,6 @@ def updateCharacters(self, anime_set: set, min_characters: int = 10, min_side_ch self.addCharacter(character, my_mal_id) else: supporting_index_favorites[self.response["data"].index(character)] = character["favorites"] # add a key value pair to the dictionary {(character mal id): (number of favorites)} - sorted_supporting_index_favorites = dict(sorted(supporting_index_favorites.items(), key=lambda x:x[1], reverse=True)) # sort the dictionary by descending order of favorites print(f"SORTED: {sorted_supporting_index_favorites}") From 16329bea55cead1190fdfcfc6ca06d4ef7a81a33 Mon Sep 17 00:00:00 2001 From: vincenzo-sorcigli <57498723+vincenzo-sorcigli@users.noreply.github.com> Date: Fri, 12 May 2023 11:57:49 -0400 Subject: [PATCH 06/10] turns out you can give more requests to the api than i thought --- anime/scripts/db_pop.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/anime/scripts/db_pop.py b/anime/scripts/db_pop.py index 20a2ee0..5958e2e 100644 --- a/anime/scripts/db_pop.py +++ b/anime/scripts/db_pop.py @@ -179,7 +179,7 @@ def initialPopulation(self, pages: int = 5, min_characters: int = 10, min_side_c for instance in self.response["data"]: # instance is the anime self.addAnime(instance) - time.sleep(4) + time.sleep(1) if add_characters is True: self.noCharacterAnime(min_characters, min_side_characters) @@ -201,7 +201,7 @@ def updateAiringAnime(self, min_characters: int = 10, min_side_characters: int = page_count = self.response["pagination"]["last_visible_page"] for page_num in range(1, (page_count+1)): - time.sleep(4) + time.sleep(1) api_url = f"{self.base_airing_api_url}&page={page_num}" self.requestAPI(api_url) @@ -263,7 +263,7 @@ def updateCharacters(self, anime_set: set, min_characters: int = 10, min_side_ch side_character = self.response["data"][character_index] # find the character that corresponds to the given index self.addCharacter(side_character, my_mal_id) # add that character - time.sleep(4) + time.sleep(1) From 8608dda9641e20f123383c92979b0b5ed1c0acc0 Mon Sep 17 00:00:00 2001 From: vincenzo-sorcigli <57498723+vincenzo-sorcigli@users.noreply.github.com> Date: Mon, 22 May 2023 12:18:04 -0400 Subject: [PATCH 07/10] improved school appropriate filtering --- anime/scripts/db_pop.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/anime/scripts/db_pop.py b/anime/scripts/db_pop.py index 5958e2e..7b51f42 100644 --- a/anime/scripts/db_pop.py +++ b/anime/scripts/db_pop.py @@ -11,6 +11,12 @@ def __init__(self): self.base_airing_api_url = "https://api.jikan.moe/v4/anime?status=airing" self.our_airing_anime = set() self.their_airing_anime = set() +<<<<<<< Updated upstream +======= + self.update_characters_anime = set() + self.inappropriate_ratings = ["Rx - Hentai", "R+ - Mild Nudity"] + self.inappropriate_genres = ["Ecchi", "Erotica", "Hentai"] +>>>>>>> Stashed changes self.response = None def requestAPI(self, api_url): @@ -33,10 +39,18 @@ def addAnime(self, anime_instance: dict): # if the rating is not school appropriate # move on to the next anime, don't add it - if anime_instance["rating"] == "Rx - Hentai" or anime_instance["rating"] == "R+ - Mild Nudity": + if anime_instance["rating"] in self.inappropriate_ratings: print(f"not school appropriate: {my_anime_name}") return + # create a list of the names of the anime's genres + genre_list = [] + for genre in anime_instance["genres"]: + if genre in self.inappropriate_genres: + print(f"not school appropriate: {my_anime_name}") + return + genre_list.append(genre["name"]) + # if the anime is not popular enough # move on to the next anime, don't add it if anime_instance["members"] < 5000: @@ -125,10 +139,6 @@ def addAnime(self, anime_instance: dict): ) my_anime.save() - # create a list of the names of the anime's genres - genre_list = [] - for genre in anime_instance["genres"]: - genre_list.append(genre["name"]) # for every name in the genre list for genre_name in genre_list: From e26d5f2b89a9b7ba00804905f78fd8c45f98b001 Mon Sep 17 00:00:00 2001 From: vincenzo-sorcigli <57498723+vincenzo-sorcigli@users.noreply.github.com> Date: Mon, 22 May 2023 12:22:44 -0400 Subject: [PATCH 08/10] resolve conflict --- anime/scripts/db_pop.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/anime/scripts/db_pop.py b/anime/scripts/db_pop.py index 7b51f42..76fbdf9 100644 --- a/anime/scripts/db_pop.py +++ b/anime/scripts/db_pop.py @@ -11,12 +11,9 @@ def __init__(self): self.base_airing_api_url = "https://api.jikan.moe/v4/anime?status=airing" self.our_airing_anime = set() self.their_airing_anime = set() -<<<<<<< Updated upstream -======= self.update_characters_anime = set() self.inappropriate_ratings = ["Rx - Hentai", "R+ - Mild Nudity"] self.inappropriate_genres = ["Ecchi", "Erotica", "Hentai"] ->>>>>>> Stashed changes self.response = None def requestAPI(self, api_url): From 9bfb56d6f7cdffdb12af953f3e373cc3b6689256 Mon Sep 17 00:00:00 2001 From: vincenzo-sorcigli <57498723+vincenzo-sorcigli@users.noreply.github.com> Date: Thu, 25 May 2023 12:15:37 -0400 Subject: [PATCH 09/10] bug fix for inappropriate genres --- anime/scripts/db_pop.py | 6 +++--- poetry.lock | 2 +- pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/anime/scripts/db_pop.py b/anime/scripts/db_pop.py index 76fbdf9..bcb9ba4 100644 --- a/anime/scripts/db_pop.py +++ b/anime/scripts/db_pop.py @@ -13,7 +13,7 @@ def __init__(self): self.their_airing_anime = set() self.update_characters_anime = set() self.inappropriate_ratings = ["Rx - Hentai", "R+ - Mild Nudity"] - self.inappropriate_genres = ["Ecchi", "Erotica", "Hentai"] + self.inappropriate_genres = ["Ecchi", "Erotica", "Hentai",] self.response = None def requestAPI(self, api_url): @@ -43,7 +43,7 @@ def addAnime(self, anime_instance: dict): # create a list of the names of the anime's genres genre_list = [] for genre in anime_instance["genres"]: - if genre in self.inappropriate_genres: + if genre["name"] in self.inappropriate_genres: print(f"not school appropriate: {my_anime_name}") return genre_list.append(genre["name"]) @@ -305,4 +305,4 @@ def addCharacter(self, character: dict, anime_mal_id: int): DBPopulate = DBPopulate() -DBPopulate.initialPopulation(pages=1) +DBPopulate.initialPopulation(pages=100) diff --git a/poetry.lock b/poetry.lock index 2a4daaf..a5a4b61 100644 --- a/poetry.lock +++ b/poetry.lock @@ -780,4 +780,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "afa0ce903f1f2a9cc329fd1a035d84d3d278a5923ae06ec294a42538f51b235a" +content-hash = "afa0ce903f1f2a9cc329fd1a035d84d3d278a5923ae06ec294a42538f51b235a" \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index c232fb2..d86e88f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,4 +26,4 @@ autopep8 = "^2.0.1" [build-system] requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +build-backend = "poetry.core.masonry.api" \ No newline at end of file From 6fc0847b0b185a8ea8a3374625fb4a9bb7d0372f Mon Sep 17 00:00:00 2001 From: Harvey Jiang <71397990+harveyj123@users.noreply.github.com> Date: Wed, 31 May 2023 12:06:46 -0400 Subject: [PATCH 10/10] Update db_pop.py --- anime/scripts/db_pop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anime/scripts/db_pop.py b/anime/scripts/db_pop.py index bcb9ba4..fda7880 100644 --- a/anime/scripts/db_pop.py +++ b/anime/scripts/db_pop.py @@ -13,7 +13,7 @@ def __init__(self): self.their_airing_anime = set() self.update_characters_anime = set() self.inappropriate_ratings = ["Rx - Hentai", "R+ - Mild Nudity"] - self.inappropriate_genres = ["Ecchi", "Erotica", "Hentai",] + self.inappropriate_genres = [ "Erotica", "Hentai",] self.response = None def requestAPI(self, api_url):