From 2a6c7b3dfd26f80fe2ab9c14451960b43a2896b1 Mon Sep 17 00:00:00 2001 From: wumode Date: Thu, 3 Jul 2025 12:55:32 +0800 Subject: [PATCH] =?UTF-8?q?update(ImdbSource):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BA=AE=E8=89=B2=E4=B8=BB=E9=A2=98=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.v2.json | 3 ++- plugins.v2/imdbsource/__init__.py | 20 ++++++++++---------- plugins.v2/imdbsource/imdbhelper.py | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/package.v2.json b/package.v2.json index 84ce046..4a4129b 100644 --- a/package.v2.json +++ b/package.v2.json @@ -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", diff --git a/plugins.v2/imdbsource/__init__.py b/plugins.v2/imdbsource/__init__.py index 3d4c3d2..d241124 100644 --- a/plugins.v2/imdbsource/__init__.py +++ b/plugins.v2/imdbsource/__init__.py @@ -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', ''), }, diff --git a/plugins.v2/imdbsource/imdbhelper.py b/plugins.v2/imdbsource/imdbhelper.py index 0dc1059..8ae1868 100644 --- a/plugins.v2/imdbsource/imdbhelper.py +++ b/plugins.v2/imdbsource/imdbhelper.py @@ -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 [],