mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-15 19:14:01 +08:00
fix(search): 支持单次搜索启用多个媒体数据源,合并显示所有源结果 (#6270)
- 新增 is_media_source_enabled/is_media_source_selected,请求级 source 支持逗号分隔多数据源,缺省回退全局 SEARCH_SOURCE 配置 - 四个媒体模块的搜索/人物/合集方法统一接入多源判断 - 补充多数据源搜索相关测试
This commit is contained in:
@@ -9,6 +9,7 @@ from app.log import logger
|
||||
from app.modules import _ModuleBase
|
||||
from app.modules.anilist.anilist import AniListApi
|
||||
from app.schemas.types import MediaRecognizeType, MediaType, ModuleType
|
||||
from app.utils.media import is_media_source_enabled
|
||||
|
||||
|
||||
class AniListModule(_ModuleBase):
|
||||
@@ -309,9 +310,7 @@ class AniListModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 统一媒体信息列表
|
||||
"""
|
||||
if source and source != "anilist":
|
||||
return None
|
||||
if not source and settings.SEARCH_SOURCE and "anilist" not in settings.SEARCH_SOURCE:
|
||||
if not is_media_source_enabled(source, "anilist"):
|
||||
return None
|
||||
if not meta or not meta.name:
|
||||
return []
|
||||
@@ -331,9 +330,7 @@ class AniListModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 统一媒体信息列表
|
||||
"""
|
||||
if source and source != "anilist":
|
||||
return None
|
||||
if not source and settings.SEARCH_SOURCE and "anilist" not in settings.SEARCH_SOURCE:
|
||||
if not is_media_source_enabled(source, "anilist"):
|
||||
return None
|
||||
if not meta or not meta.name:
|
||||
return []
|
||||
|
||||
@@ -10,6 +10,7 @@ from app.modules import _ModuleBase
|
||||
from app.modules.bangumi.bangumi import BangumiApi
|
||||
from app.schemas.types import MediaRecognizeType, MediaType, ModuleType
|
||||
from app.utils.http import RequestUtils
|
||||
from app.utils.media import is_media_source_enabled
|
||||
|
||||
|
||||
class BangumiModule(_ModuleBase):
|
||||
@@ -202,9 +203,7 @@ class BangumiModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 媒体信息
|
||||
"""
|
||||
if source and source != "bangumi":
|
||||
return None
|
||||
if not source and settings.SEARCH_SOURCE and "bangumi" not in settings.SEARCH_SOURCE:
|
||||
if not is_media_source_enabled(source, "bangumi"):
|
||||
return None
|
||||
if not meta.name:
|
||||
return []
|
||||
@@ -224,9 +223,7 @@ class BangumiModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 媒体信息
|
||||
"""
|
||||
if source and source != "bangumi":
|
||||
return None
|
||||
if not source and settings.SEARCH_SOURCE and "bangumi" not in settings.SEARCH_SOURCE:
|
||||
if not is_media_source_enabled(source, "bangumi"):
|
||||
return None
|
||||
if not meta.name:
|
||||
return []
|
||||
|
||||
@@ -17,6 +17,7 @@ from app.schemas.types import MediaType, ModuleType, MediaRecognizeType
|
||||
from app.utils.common import retry
|
||||
from app.utils.http import RequestUtils
|
||||
from app.utils.limit import rate_limit_exponential
|
||||
from app.utils.media import is_media_source_enabled
|
||||
from app.utils.zhconv import convert as zhconv_convert
|
||||
|
||||
|
||||
@@ -844,9 +845,7 @@ class DoubanModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 媒体信息
|
||||
"""
|
||||
if source and source != "douban":
|
||||
return None
|
||||
if not source and settings.SEARCH_SOURCE and "douban" not in settings.SEARCH_SOURCE:
|
||||
if not is_media_source_enabled(source, "douban"):
|
||||
return None
|
||||
if not meta.name:
|
||||
return []
|
||||
@@ -865,9 +864,7 @@ class DoubanModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 媒体信息
|
||||
"""
|
||||
if source and source != "douban":
|
||||
return None
|
||||
if not source and settings.SEARCH_SOURCE and "douban" not in settings.SEARCH_SOURCE:
|
||||
if not is_media_source_enabled(source, "douban"):
|
||||
return None
|
||||
if not meta.name:
|
||||
return []
|
||||
@@ -886,9 +883,7 @@ class DoubanModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 人物信息列表
|
||||
"""
|
||||
if source and source != "douban":
|
||||
return None
|
||||
if not source and settings.SEARCH_SOURCE and "douban" not in settings.SEARCH_SOURCE:
|
||||
if not is_media_source_enabled(source, "douban"):
|
||||
return None
|
||||
if not name:
|
||||
return []
|
||||
@@ -913,9 +908,7 @@ class DoubanModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 人物信息列表
|
||||
"""
|
||||
if source and source != "douban":
|
||||
return None
|
||||
if not source and settings.SEARCH_SOURCE and "douban" not in settings.SEARCH_SOURCE:
|
||||
if not is_media_source_enabled(source, "douban"):
|
||||
return None
|
||||
if not name:
|
||||
return []
|
||||
|
||||
@@ -16,6 +16,7 @@ from app.modules.themoviedb.tmdbapi import TmdbApi
|
||||
from app.schemas.category import CategoryConfig
|
||||
from app.schemas.types import MediaType, MediaImageType, ModuleType, MediaRecognizeType
|
||||
from app.utils.http import RequestUtils
|
||||
from app.utils.media import is_media_source_enabled, is_media_source_selected
|
||||
from app.utils.zhconv import convert as zhconv_convert
|
||||
|
||||
|
||||
@@ -744,9 +745,7 @@ class TheMovieDbModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 媒体信息列表
|
||||
"""
|
||||
if source and source != "themoviedb":
|
||||
return None
|
||||
if not source and settings.SEARCH_SOURCE and "themoviedb" not in settings.SEARCH_SOURCE:
|
||||
if not is_media_source_enabled(source, "themoviedb"):
|
||||
return None
|
||||
if not meta.name:
|
||||
return []
|
||||
@@ -778,9 +777,7 @@ class TheMovieDbModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 人物信息列表
|
||||
"""
|
||||
if source and source != "themoviedb":
|
||||
return None
|
||||
if not source and settings.SEARCH_SOURCE and "themoviedb" not in settings.SEARCH_SOURCE:
|
||||
if not is_media_source_enabled(source, "themoviedb"):
|
||||
return None
|
||||
if not name:
|
||||
return []
|
||||
@@ -798,9 +795,7 @@ class TheMovieDbModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 人物信息列表
|
||||
"""
|
||||
if source and source != "themoviedb":
|
||||
return None
|
||||
if not source and settings.SEARCH_SOURCE and "themoviedb" not in settings.SEARCH_SOURCE:
|
||||
if not is_media_source_enabled(source, "themoviedb"):
|
||||
return None
|
||||
if not name:
|
||||
return []
|
||||
@@ -818,7 +813,7 @@ class TheMovieDbModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 合集信息列表
|
||||
"""
|
||||
if source and source != "themoviedb":
|
||||
if source and not is_media_source_selected(source, "themoviedb"):
|
||||
return None
|
||||
if not name:
|
||||
return []
|
||||
@@ -836,7 +831,7 @@ class TheMovieDbModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 合集信息列表
|
||||
"""
|
||||
if source and source != "themoviedb":
|
||||
if source and not is_media_source_selected(source, "themoviedb"):
|
||||
return None
|
||||
if not name:
|
||||
return []
|
||||
@@ -1232,9 +1227,7 @@ class TheMovieDbModule(_ModuleBase):
|
||||
:param source: 请求级搜索数据源
|
||||
:return: 媒体信息列表
|
||||
"""
|
||||
if source and source != "themoviedb":
|
||||
return None
|
||||
if not source and settings.SEARCH_SOURCE and "themoviedb" not in settings.SEARCH_SOURCE:
|
||||
if not is_media_source_enabled(source, "themoviedb"):
|
||||
return None
|
||||
if not meta.name:
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user