From ede1251685157ccbede7e5110497476ad901a32f Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 30 Apr 2024 15:42:23 +0800 Subject: [PATCH] fix #252 --- package.json | 7 +++++-- plugins/personmeta/__init__.py | 17 +++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 06a0f69..33b78e9 100644 --- a/package.json +++ b/package.json @@ -344,10 +344,13 @@ "name": "演职人员刮削", "description": "刮削演职人员图片以及中文名称。", "labels": "媒体库,刮削", - "version": "1.2", + "version": "1.3", "icon": "actor.png", "author": "jxxghp", - "level": 1 + "level": 1, + "history": { + "v1.3": "修复v1.8.5版本后刮削报错问题" + } }, "MoviePilotUpdateNotify": { "name": "MoviePilot更新推送", diff --git a/plugins/personmeta/__init__.py b/plugins/personmeta/__init__.py index 5c769fb..e5a2cdd 100644 --- a/plugins/personmeta/__init__.py +++ b/plugins/personmeta/__init__.py @@ -14,6 +14,7 @@ from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.triggers.cron import CronTrigger from requests import RequestException +from app import schemas from app.chain.mediaserver import MediaServerChain from app.chain.tmdb import TmdbChain from app.core.config import settings @@ -39,7 +40,7 @@ class PersonMeta(_PluginBase): # 插件图标 plugin_icon = "actor.png" # 插件版本 - plugin_version = "1.2" + plugin_version = "1.3" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -510,9 +511,9 @@ class PersonMeta(_PluginBase): # 从TMDB信息中更新人物信息 person_tmdbid, person_imdbid = __get_peopleid(personinfo) if person_tmdbid: - person_tmdbinfo = self.tmdbchain.person_detail(int(person_tmdbid)) - if person_tmdbinfo: - cn_name = self.__get_chinese_name(person_tmdbinfo) + person_detail = self.tmdbchain.person_detail(int(person_tmdbid)) + if person_detail: + cn_name = self.__get_chinese_name(person_detail) if cn_name: # 更新中文名 logger.debug(f"{people.get('Name')} 从TMDB获取到中文名:{cn_name}") @@ -520,13 +521,13 @@ class PersonMeta(_PluginBase): ret_people["Name"] = cn_name updated_name = True # 更新中文描述 - biography = person_tmdbinfo.get("biography") + biography = person_detail.biography if biography and StringUtils.is_chinese(biography): logger.debug(f"{people.get('Name')} 从TMDB获取到中文描述") personinfo["Overview"] = biography updated_overview = True # 图片 - profile_path = person_tmdbinfo.get('profile_path') + profile_path = person_detail.profile_path if profile_path: logger.debug(f"{people.get('Name')} 从TMDB获取到图片:{profile_path}") profile_path = f"https://{settings.TMDB_IMAGE_DOMAIN}/t/p/original{profile_path}" @@ -994,12 +995,12 @@ class PersonMeta(_PluginBase): return None @staticmethod - def __get_chinese_name(personinfo: dict) -> str: + def __get_chinese_name(personinfo: schemas.MediaPerson) -> str: """ 获取TMDB别名中的中文名 """ try: - also_known_as = personinfo.get("also_known_as") or [] + also_known_as = personinfo.also_known_as or [] if also_known_as: for name in also_known_as: if name and StringUtils.is_chinese(name):