feat: complete cache coverage for musify
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful

This commit is contained in:
Hazel 2024-04-26 21:37:53 +02:00
parent 9a718af1c9
commit d7348b9111
2 changed files with 4 additions and 1 deletions

View File

@ -148,6 +148,9 @@ class Cache:
return None return None
# check if it is outdated # check if it is outdated
if f"{self.module}_{name}" not in self._id_to_attribute:
path.unlink()
return
existing_attribute: CacheAttribute = self._id_to_attribute[f"{self.module}_{name}"] existing_attribute: CacheAttribute = self._id_to_attribute[f"{self.module}_{name}"]
if not existing_attribute.is_valid: if not existing_attribute.is_valid:
return return

View File

@ -376,7 +376,7 @@ class Musify(Page):
def general_search(self, search_query: str) -> List[DatabaseObject]: def general_search(self, search_query: str) -> List[DatabaseObject]:
search_results = [] search_results = []
r = self.connection.get(f"https://musify.club/search?searchText={search_query}") r = self.connection.get(f"https://musify.club/search?searchText={search_query}", name="search_" + search_query)
if r is None: if r is None:
return [] return []
search_soup: BeautifulSoup = self.get_soup_from_response(r) search_soup: BeautifulSoup = self.get_soup_from_response(r)