This commit is contained in:
jxxghp
2024-04-30 15:42:23 +08:00
parent 8c60d2730b
commit ede1251685
2 changed files with 14 additions and 10 deletions

View File

@@ -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更新推送",

View File

@@ -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):