fix 修复演员刮削

This commit is contained in:
thsrite
2024-08-22 12:46:27 +08:00
parent 52018d3d99
commit 8ffccb1639
3 changed files with 17 additions and 10 deletions

View File

@@ -35,7 +35,7 @@ MoviePilot三方插件市场https://github.com/thsrite/MoviePilot-Plugins/
- 插件彻底卸载 v1.0
- 实时软连接 v2.0.1
- 订阅规则自动填充 v2.7
- Emby元数据刷新 v1.7
- Emby元数据刷新 v1.7.1
- Emby媒体标签 v1.2
- 热门媒体订阅 v1.7
- [HomePage v1.2](docs%2FHomePage.md)

View File

@@ -447,11 +447,12 @@
"name": "Emby元数据刷新",
"description": "定时刷新Emby媒体库元数据演职人员中文。",
"labels": "Emby",
"version": "1.7",
"version": "1.7.1",
"icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/emby-icon.png",
"author": "thsrite",
"level": 1,
"history": {
"v1.7.1": "修复演员刮削",
"v1.7": "精细化刷新,最新入库支持刷新单集演职人员中文",
"v1.6": "修复豆瓣查询bug丰富日志",
"v1.5": "支持刷新演员中文路径关键词多个英文逗号分隔。建议覆盖元数据修改为False防止演员中文被刷新覆盖",

View File

@@ -36,7 +36,7 @@ class EmbyMetaRefresh(_PluginBase):
# 插件图标
plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/emby-icon.png"
# 插件版本
plugin_version = "1.7"
plugin_version = "1.7.1"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -188,7 +188,8 @@ class EmbyMetaRefresh(_PluginBase):
douban_actors = self.__update_people_chi(
item_id=item.get("SeriesId") if str(item.get('Type')) == 'Episode' else item.get("Id"),
title=item.get('SeriesName') if str(item.get('Type')) == 'Episode' else item.get('Name'),
type=MediaType('电视剧' if str(item.get('Type')) == 'Episode' else '电影'))
type=MediaType('电视剧' if str(item.get('Type')) == 'Episode' else '电影'),
season=item.get("ParentIndexNumber") if str(item.get('Type')) == 'Episode' else None)
# 是否有豆瓣演员信息
if not douban_actors:
@@ -241,7 +242,7 @@ class EmbyMetaRefresh(_PluginBase):
logger.error(f"获取Emby中最新媒体失败{str(err)}")
return []
def __update_people_chi(self, item_id, title, type):
def __update_people_chi(self, item_id, title, type, season=None):
"""
刮削演员中文名
"""
@@ -253,12 +254,17 @@ class EmbyMetaRefresh(_PluginBase):
return None
imdb_id = item_info.get("ProviderIds", {}).get("Imdb")
if imdb_id and self.__need_trans_actor(item_info):
if self.__need_trans_actor(item_info):
logger.info(f"开始获取 {title} ({item_info.get('ProductionYear')}) 的豆瓣演员信息 ...")
douban_actors = self.__get_douban_actors(title=title,
imdb_id=imdb_id,
type=type,
year=item_info.get("ProductionYear"))
year=item_info.get("ProductionYear"),
season=season)
if not douban_actors:
logger.info(f"未找到 {title} ({item_info.get('ProductionYear')}) 的豆瓣演员信息")
return None
logger.debug(
f"获取 {title} ({item_info.get('ProductionYear')}) 的豆瓣演员信息 完成,演员:{douban_actors}")
self.__update_peoples(itemid=item_id, iteminfo=item_info,
@@ -444,7 +450,7 @@ class EmbyMetaRefresh(_PluginBase):
character = re.sub("Director", "导演",
character)
if character:
logger.info(f"{people.get('Name')} 从豆瓣中获取到饰演角色:{character}")
logger.debug(f"{people.get('Name')} 从豆瓣中获取到饰演角色:{character}")
ret_people["Role"] = character
update_character = True
# 图片
@@ -600,7 +606,7 @@ class EmbyMetaRefresh(_PluginBase):
doubanitem = self.chain.douban_info(doubaninfo.get("id")) or {}
return (doubanitem.get("actors") or []) + (doubanitem.get("directors") or [])
else:
logger.debug(f"未找到豆瓣信息:{title} {year}")
logger.info(f"未找到豆瓣信息:{title} {year}")
return []
@staticmethod
@@ -680,7 +686,7 @@ class EmbyMetaRefresh(_PluginBase):
logger.info(
f"已通知刷新Emby电视剧{transferinfo.title} ({transferinfo.year}) {transferinfo.seasons}{transferinfo.episodes} item_id:{episode_item_id}")
if self._actor_chi:
self.__update_people_chi(item_id=item_id, title=transferinfo.title, type=MediaType.TV)
self.__update_people_chi(item_id=item_id, title=transferinfo.title, type=MediaType.TV, season=season)
def __get_emby_episode_item_id(self, item_id: str, season: int, episode: int) -> Optional[str]:
"""