From 74c71390c94f9b88fc9d2cbd766542dbf9762b90 Mon Sep 17 00:00:00 2001 From: thsrite Date: Mon, 3 Jun 2024 09:54:32 +0800 Subject: [PATCH] fix unhashable type: 'dict' --- app/modules/themoviedb/tmdbapi.py | 3 ++- app/modules/themoviedb/tmdbv3api/objs/discover.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/modules/themoviedb/tmdbapi.py b/app/modules/themoviedb/tmdbapi.py index 01e630a5..7532835c 100644 --- a/app/modules/themoviedb/tmdbapi.py +++ b/app/modules/themoviedb/tmdbapi.py @@ -1052,7 +1052,8 @@ class TmdbApi: return [] try: logger.debug(f"正在发现电影:{kwargs}...") - tmdbinfo = self.discover.discover_movies(kwargs) + params_tuple = tuple(kwargs.items()) + tmdbinfo = self.discover.discover_movies(params_tuple) if tmdbinfo: for info in tmdbinfo: info['media_type'] = MediaType.MOVIE diff --git a/app/modules/themoviedb/tmdbv3api/objs/discover.py b/app/modules/themoviedb/tmdbv3api/objs/discover.py index 3e659cc4..50fca6ef 100644 --- a/app/modules/themoviedb/tmdbv3api/objs/discover.py +++ b/app/modules/themoviedb/tmdbv3api/objs/discover.py @@ -14,12 +14,13 @@ class Discover(TMDb): } @cached(cache=TTLCache(maxsize=1, ttl=43200)) - def discover_movies(self, params): + def discover_movies(self, params_tuple): """ Discover movies by different types of data like average rating, number of votes, genres and certifications. :param params: dict :return: """ + params = dict(params_tuple) return self._request_obj(self._urls["movies"], urlencode(params), key="results", call_cached=False) @cached(cache=TTLCache(maxsize=1, ttl=43200))