mirror of
https://github.com/jxxghp/MoviePilot-Plugins.git
synced 2026-03-27 10:05:57 +00:00
Merge pull request #874 from wumode/imdbsource
This commit is contained in:
@@ -436,11 +436,12 @@
|
||||
"name": "IMDb源",
|
||||
"description": "让探索,推荐和媒体识别支持IMDb数据源。",
|
||||
"labels": "探索",
|
||||
"version": "1.5.5",
|
||||
"version": "1.5.6",
|
||||
"icon": "IMDb_IOS-OSX_App.png",
|
||||
"author": "wumode",
|
||||
"level": 1,
|
||||
"history": {
|
||||
"v1.5.6": "固定仪表盘组件海报比例; 修复 bug",
|
||||
"v1.5.5": "修复初始化错误",
|
||||
"v1.5.4": "改进媒体识别",
|
||||
"v1.5.3": "异步执行; 修复 bugs (主程序版本需要高于 2.6.8)",
|
||||
|
||||
@@ -29,7 +29,7 @@ class ImdbSource(_PluginBase):
|
||||
# 插件图标
|
||||
plugin_icon = "IMDb_IOS-OSX_App.png"
|
||||
# 插件版本
|
||||
plugin_version = "1.5.5"
|
||||
plugin_version = "1.5.6"
|
||||
# 插件作者
|
||||
plugin_author = "wumode"
|
||||
# 作者主页
|
||||
@@ -55,7 +55,8 @@ class ImdbSource(_PluginBase):
|
||||
_cache: Dict[str, Any] = {"discover": [], "trending": [], "imdb_top_250": [], "staff_picks": {}}
|
||||
_img_proxy_prefix: str = ''
|
||||
_scheduler: Optional[BackgroundScheduler] = None
|
||||
_original_method: Optional[Callable[..., Coroutine[Any, Any, Optional[MediaInfo]]]] = None
|
||||
_original_method: Optional[Callable] = None
|
||||
_original_async_method: Optional[Callable[..., Coroutine[Any, Any, Optional[MediaInfo]]]] = None
|
||||
|
||||
def init_plugin(self, config: dict = None):
|
||||
|
||||
@@ -86,10 +87,10 @@ class ImdbSource(_PluginBase):
|
||||
episode_group: Optional[str] = None,
|
||||
cache: bool = True):
|
||||
# 调用原始方法
|
||||
if not plugin_instance._original_method:
|
||||
if not plugin_instance._original_async_method:
|
||||
return None
|
||||
result = await plugin_instance._original_method(chain_self, meta, mtype, tmdbid, doubanid, bangumiid,
|
||||
episode_group, cache)
|
||||
result = await plugin_instance._original_async_method(chain_self, meta, mtype, tmdbid, doubanid, bangumiid,
|
||||
episode_group, cache)
|
||||
if result is None and plugin_instance._enabled and plugin_instance._recognize_media:
|
||||
logger.info(f"通过插件 {plugin_instance.plugin_name} 执行:async_recognize_media ...")
|
||||
return await plugin_instance.async_recognize_media(meta, mtype)
|
||||
@@ -196,6 +197,7 @@ class ImdbSource(_PluginBase):
|
||||
# 列配置
|
||||
size_config = {
|
||||
"small": {"cols": {"cols": 12, "md": 4}, "height": 335},
|
||||
"medium-small": {"cols": {"cols": 12, "md": 6}, "height": 335},
|
||||
"medium": {"cols": {"cols": 12, "md": 8}, "height": 335},
|
||||
}
|
||||
config = size_config.get(self._component_size, 'medium')
|
||||
@@ -258,7 +260,7 @@ class ImdbSource(_PluginBase):
|
||||
'props': {
|
||||
'src': primary_img_url,
|
||||
'cover': True,
|
||||
'position': 'center',
|
||||
'position': 'top',
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
@@ -356,22 +358,26 @@ class ImdbSource(_PluginBase):
|
||||
'props': {
|
||||
'src': poster_url,
|
||||
'alt': '海报',
|
||||
'max-width': str(180),
|
||||
'cover': True,
|
||||
'class': 'rounded mx-auto aspect-[2/3]'
|
||||
'class': 'rounded',
|
||||
'max-width': '160',
|
||||
'max-height': '240',
|
||||
'style': 'height: auto; aspect-ratio: 2/3;',
|
||||
}
|
||||
}
|
||||
|
||||
poster_ui = {
|
||||
'component': 'div',
|
||||
'props': {
|
||||
'class': 'align-center mt-2',
|
||||
'class': 'd-flex justify-center mt-2'
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
'component': 'a',
|
||||
'props': {
|
||||
'href': f"#{mp_url}",
|
||||
'class': 'no-underline w-100 h-100',
|
||||
'href': f'#{mp_url}',
|
||||
'class': 'no-underline w-100',
|
||||
'style': 'display: flex; justify-content: center;'
|
||||
},
|
||||
'content': [
|
||||
poster_com
|
||||
@@ -434,7 +440,7 @@ class ImdbSource(_PluginBase):
|
||||
'props': {
|
||||
'src': primary_img_url,
|
||||
'cover': True,
|
||||
'position': 'center'
|
||||
'position': 'top'
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
@@ -462,7 +468,7 @@ class ImdbSource(_PluginBase):
|
||||
'component': 'VCol',
|
||||
'props': {
|
||||
'cols': 12,
|
||||
'md': 3,
|
||||
'md': 3
|
||||
},
|
||||
'content': [
|
||||
poster_ui
|
||||
@@ -678,6 +684,7 @@ class ImdbSource(_PluginBase):
|
||||
'label': '组件规格',
|
||||
'items': [
|
||||
{"title": "小型", "value": "small"},
|
||||
{"title": "中小型", "value": "medium-small"},
|
||||
{"title": "中型", "value": "medium"}
|
||||
]
|
||||
}
|
||||
@@ -720,7 +727,74 @@ class ImdbSource(_PluginBase):
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'component': 'VRow',
|
||||
'content': [
|
||||
{
|
||||
'component': 'VCol',
|
||||
'props': {
|
||||
'cols': 12
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
'component': 'VAlert',
|
||||
'props': {
|
||||
'type': 'info',
|
||||
'variant': 'tonal',
|
||||
'title': '代理设置',
|
||||
'text': '可能需要通过代理访问的域名:「media-amazon.com」「media-imdb.com」「imdbapi.dev」「imdb.com」'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'component': 'VRow',
|
||||
'content': [
|
||||
{
|
||||
'component': 'VCol',
|
||||
'props': {
|
||||
'cols': 12
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
'component': 'VAlert',
|
||||
'props': {
|
||||
'border': 'start',
|
||||
'border-color': 'info',
|
||||
'variant': 'tonal',
|
||||
'title': 'About IMDbAPI'
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
'component': 'span',
|
||||
'text': 'This plugin makes partial use of the Free IMDb API (imdbapi.dev), courtesy of '
|
||||
},
|
||||
{
|
||||
'component': 'a',
|
||||
'props': {
|
||||
'href': 'https://t.me/imdbapi',
|
||||
'target': '_blank'
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
'component': 'u',
|
||||
'text': '@reflect pprof'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'component': 'span',
|
||||
'text': '. Huge thanks for this fantastic API!'
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
], {
|
||||
@@ -902,11 +976,11 @@ class ImdbSource(_PluginBase):
|
||||
remaining = count - len(results)
|
||||
self._cache[interest] = [] # 清空缓存
|
||||
data = await self._imdb_helper.async_advanced_title_search(first_page=first_page,
|
||||
title_types=title_types,
|
||||
sort_by="POPULARITY",
|
||||
sort_order="ASC",
|
||||
interests=(interest,)
|
||||
)
|
||||
title_types=title_types,
|
||||
sort_by="POPULARITY",
|
||||
sort_order="ASC",
|
||||
interests=(interest,)
|
||||
)
|
||||
if not data:
|
||||
new_results = []
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user