Merge pull request #830 from wumode/imdbsource

This commit is contained in:
jxxghp
2025-07-03 13:21:13 +08:00
committed by GitHub
3 changed files with 13 additions and 12 deletions

View File

@@ -434,11 +434,12 @@
"name": "IMDb源",
"description": "让探索支持IMDb数据源。",
"labels": "探索",
"version": "1.4.0",
"version": "1.4.1",
"icon": "IMDb_IOS-OSX_App.png",
"author": "wumode",
"level": 1,
"history": {
"v1.4.1": "优化亮色主题显示",
"v1.4.0":"添加仪表盘组件: IMDb 编辑精选",
"v1.3.3": "修复依赖问题",
"v1.3.2": "更新 API query hash",

View File

@@ -20,7 +20,7 @@ class ImdbSource(_PluginBase):
# 插件图标
plugin_icon = "IMDb_IOS-OSX_App.png"
# 插件版本
plugin_version = "1.4.0"
plugin_version = "1.4.1"
# 插件作者
plugin_author = "wumode"
# 作者主页
@@ -84,14 +84,15 @@ class ImdbSource(_PluginBase):
"""
if not self._staff_picks:
return None
def year_and_type(entry: Dict) -> Tuple[MediaType, str]:
def year_and_type(entry: Dict) -> Tuple[MediaType, str, str]:
title = next((t for t in titles if t.get("id") == entry.get('ttconst')), None)
if not title:
return MediaType.MOVIE, datetime.now().date().strftime("%Y")
return MediaType.MOVIE, datetime.now().date().strftime("%Y"), ''
media_id = title.get('titleType', {}).get('id')
release_year = title.get('releaseYear', {}).get('year') or datetime.now().date().strftime("%Y")
media_type = ImdbSource.title_id_to_mtype(media_id)
return media_type, release_year
plot = title.get("plot", {}).get("plotText", {}).get("plainText", '')
return media_type, release_year, plot
# 列配置
size_config = {
@@ -153,7 +154,7 @@ class ImdbSource(_PluginBase):
contents = []
for entry in entries:
cast = [name for related in entry.get('relatedconst', []) for name in names if name.get('id') == related]
mtype, year = year_and_type(entry)
mtype, year, plot = year_and_type(entry)
mp_url = f"/media?mediaid=imdb:{entry.get('ttconst')}&title='{entry.get('name')}'&year={year}&type={mtype.value}"
item1 = {
'component': 'VCarouselItem',
@@ -188,7 +189,7 @@ class ImdbSource(_PluginBase):
'props': {
'class': 'text-shadow line-clamp-2 overflow-hidden text-ellipsis ...'
},
'html': entry.get('description', ''),
'html': plot,
}
]
},
@@ -219,7 +220,7 @@ class ImdbSource(_PluginBase):
{
'component': 'VAvatar',
'props': {
'size': f'{48 if (is_mobile or self._component_size == "small") else 64}',
'size': f'{48 if is_mobile else 64}',
'class': 'mb-1'
},
'content': [
@@ -274,7 +275,6 @@ class ImdbSource(_PluginBase):
'props': {
'href': f"#{mp_url}",
'class': 'no-underline d-flex',
# 'style': 'width: 160px;'
},
'content': [
poster_com
@@ -294,7 +294,7 @@ class ImdbSource(_PluginBase):
'href': f"https://www.imdb.com/title/{entry.get('ttconst', '')}",
'target': '_blank',
'rel': 'noopener noreferrer',
'class': 'text-h4 font-weight-bold mb-2 d-flex align-center',
'class': 'text-h4 font-weight-bold mb-2 d-flex text-white align-center',
},
'content': [
{
@@ -322,7 +322,7 @@ class ImdbSource(_PluginBase):
'component': 'span',
'props': {
'class': 'text-shadow text-body-2 line-clamp-4 overflow-hidden',
'style': 'text-align: justify; hyphens: auto;'
'style': 'text-align: justify; hyphens: auto; color: rgba(231, 227, 252, 0.7);'
},
'html': entry.get('description', ''),
},

View File

@@ -398,7 +398,7 @@ class ImdbHelper:
]
}
"""
query = "query VerticalListPageItems( $titles: [ID!]! $names: [ID!]! $images: [ID!]! $videos: [ID!]! ) {\n titles(ids: $titles) { ...TitleParts meterRanking { currentRank meterType rankChange {changeDirection difference} } ratingsSummary { aggregateRating } }\n names(ids: $names) { ...NameParts }\n videos(ids: $videos) { ...VideoParts }\n images(ids: $images) { ...ImageParts }\n }\n fragment TitleParts on Title {\n id\n titleText { text }\n titleType { id }\n releaseYear { year }\n primaryImage { id url width height }\n}\n fragment NameParts on Name {\n id\n nameText { text }\n primaryImage { id url width height }\n}\n fragment ImageParts on Image {\n id\n height\n width\n url \n}\n fragment VideoParts on Video {\n id\n name { value }\n contentType { displayName { value } id }\n previewURLs { displayName { value } url videoDefinition videoMimeType }\n playbackURLs { displayName { value } url videoDefinition videoMimeType }\n thumbnail { height url width }\n}\n "
query = "query VerticalListPageItems( $titles: [ID!]! $names: [ID!]! $images: [ID!]! $videos: [ID!]! ) {\n titles(ids: $titles) { ...TitleParts meterRanking { currentRank meterType rankChange {changeDirection difference} } ratingsSummary { aggregateRating } }\n names(ids: $names) { ...NameParts }\n videos(ids: $videos) { ...VideoParts }\n images(ids: $images) { ...ImageParts }\n }\n fragment TitleParts on Title {\n id\n titleText { text }\n titleType { id }\n releaseYear { year }\n plot { plotText {plainText}}\n primaryImage { id url width height }\n}\n fragment NameParts on Name {\n id\n nameText { text }\n primaryImage { id url width height }\n}\n fragment ImageParts on Image {\n id\n height\n width\n url \n}\n fragment VideoParts on Video {\n id\n name { value }\n contentType { displayName { value } id }\n previewURLs { displayName { value } url videoDefinition videoMimeType }\n playbackURLs { displayName { value } url videoDefinition videoMimeType }\n thumbnail { height url width }\n}\n "
variables = {'images': images or [],
'titles': titles or [],
'names': names or [],