From e90359eb08cff549b6a90b235d4b52abc1107d0b Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 23 Aug 2025 15:56:30 +0800 Subject: [PATCH] fix douban --- app/modules/douban/__init__.py | 4 ++++ app/modules/themoviedb/__init__.py | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/app/modules/douban/__init__.py b/app/modules/douban/__init__.py index 5db710b5..cce6b100 100644 --- a/app/modules/douban/__init__.py +++ b/app/modules/douban/__init__.py @@ -938,6 +938,8 @@ class DoubanModule(_ModuleBase): """ 搜索人物信息 """ + if settings.SEARCH_SOURCE and "douban" not in settings.SEARCH_SOURCE: + return None if not name: return [] result = self.doubanapi.person_search(keyword=name) @@ -956,6 +958,8 @@ class DoubanModule(_ModuleBase): """ 搜索人物信息(异步版本) """ + if settings.SEARCH_SOURCE and "douban" not in settings.SEARCH_SOURCE: + return None if not name: return [] result = await self.doubanapi.async_person_search(keyword=name) diff --git a/app/modules/themoviedb/__init__.py b/app/modules/themoviedb/__init__.py index de101c52..d5f9b7e5 100644 --- a/app/modules/themoviedb/__init__.py +++ b/app/modules/themoviedb/__init__.py @@ -639,6 +639,8 @@ class TheMovieDbModule(_ModuleBase): """ 搜索人物信息 """ + if settings.SEARCH_SOURCE and "themoviedb" not in settings.SEARCH_SOURCE: + return None if not name: return [] results = self.tmdb.search_persons(name) @@ -646,6 +648,19 @@ class TheMovieDbModule(_ModuleBase): return [MediaPerson(source='themoviedb', **person) for person in results] return [] + async def async_search_persons(self, name: str) -> Optional[List[MediaPerson]]: + """ + 异步搜索人物信息 + """ + if settings.SEARCH_SOURCE and "themoviedb" not in settings.SEARCH_SOURCE: + return None + if not name: + return [] + results = await self.tmdb.async_search_persons(name) + if results: + return [MediaPerson(source='themoviedb', **person) for person in results] + return [] + def search_collections(self, name: str) -> Optional[List[MediaInfo]]: """ 搜索集合信息