mirror of
https://github.com/thsrite/MoviePilot-Plugins.git
synced 2026-06-05 07:26:50 +00:00
feat(embymetarefresh): 同时适配 zhconv 与 zhconv-rs
确保繁简转换在不同依赖环境下均可正常工作,并更新 v1.7.5 / v2.3.3 版本。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -491,11 +491,12 @@
|
||||
"name": "Emby元数据刷新",
|
||||
"description": "定时刷新Emby媒体库元数据,演职人员中文。",
|
||||
"labels": "Emby",
|
||||
"version": "1.7.4",
|
||||
"version": "1.7.5",
|
||||
"icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/emby-icon.png",
|
||||
"author": "thsrite",
|
||||
"level": 1,
|
||||
"history": {
|
||||
"v1.7.5": "同时适配 zhconv 和 zhconv-rs",
|
||||
"v1.7.4": "获取tmdb图片使用PROXY_HOST代理",
|
||||
"v1.7.3": "优化剧集演员刮削",
|
||||
"v1.7.2": "优化剧集演员刮削",
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
"name": "Emby元数据刷新",
|
||||
"description": "定时刷新Emby媒体库元数据,演职人员中文。",
|
||||
"labels": "Emby",
|
||||
"version": "2.3.2",
|
||||
"version": "2.3.3",
|
||||
"icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/emby-icon.png",
|
||||
"author": "thsrite",
|
||||
"level": 1,
|
||||
"history": {
|
||||
"v2.3.3": "同时适配 zhconv 和 zhconv-rs",
|
||||
"v2.3.2": "修复缓存序列化错误问题",
|
||||
"v2.3.1": "doumao yyds",
|
||||
"v2.3.0": "优化内存占用",
|
||||
|
||||
@@ -15,7 +15,21 @@ from apscheduler.triggers.cron import CronTrigger
|
||||
from dateutil.parser import isoparse
|
||||
from requests import RequestException
|
||||
from sqlalchemy.orm import Session
|
||||
from zhconv import zhconv
|
||||
|
||||
try:
|
||||
from zhconv import zhconv as _zhconv
|
||||
|
||||
def _convert_to_zh_hans(text: str) -> str:
|
||||
return _zhconv.convert(text, "zh-hans")
|
||||
except ImportError:
|
||||
try:
|
||||
from zhconv_rs import zhconv as _zhconv_rs
|
||||
|
||||
def _convert_to_zh_hans(text: str) -> str:
|
||||
return _zhconv_rs(text, "zh-hans")
|
||||
except ImportError:
|
||||
def _convert_to_zh_hans(text: str) -> str:
|
||||
return text
|
||||
|
||||
from app import schemas
|
||||
from app.chain.tmdb import TmdbChain
|
||||
@@ -43,7 +57,7 @@ class EmbyMetaRefresh(_PluginBase):
|
||||
# 插件图标
|
||||
plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/emby-icon.png"
|
||||
# 插件版本
|
||||
plugin_version = "2.3.2"
|
||||
plugin_version = "2.3.3"
|
||||
# 插件作者
|
||||
plugin_author = "thsrite"
|
||||
# 作者主页
|
||||
@@ -924,8 +938,8 @@ class EmbyMetaRefresh(_PluginBase):
|
||||
if also_known_as:
|
||||
for name in also_known_as:
|
||||
if name and StringUtils.is_chinese(name):
|
||||
# 使用cn2an将繁体转化为简体
|
||||
return zhconv.convert(name, "zh-hans")
|
||||
# 使用 zhconv / zhconv-rs 将繁体转化为简体
|
||||
return _convert_to_zh_hans(name)
|
||||
except Exception as err:
|
||||
logger.error(f"获取人物中文名失败:{err}")
|
||||
return ""
|
||||
|
||||
@@ -12,7 +12,21 @@ from apscheduler.schedulers.background import BackgroundScheduler
|
||||
from apscheduler.triggers.cron import CronTrigger
|
||||
from dateutil.parser import isoparse
|
||||
from requests import RequestException
|
||||
from zhconv import zhconv
|
||||
|
||||
try:
|
||||
from zhconv import zhconv as _zhconv
|
||||
|
||||
def _convert_to_zh_hans(text: str) -> str:
|
||||
return _zhconv.convert(text, "zh-hans")
|
||||
except ImportError:
|
||||
try:
|
||||
from zhconv_rs import zhconv as _zhconv_rs
|
||||
|
||||
def _convert_to_zh_hans(text: str) -> str:
|
||||
return _zhconv_rs(text, "zh-hans")
|
||||
except ImportError:
|
||||
def _convert_to_zh_hans(text: str) -> str:
|
||||
return text
|
||||
|
||||
from app import schemas
|
||||
from app.chain.tmdb import TmdbChain
|
||||
@@ -36,7 +50,7 @@ class EmbyMetaRefresh(_PluginBase):
|
||||
# 插件图标
|
||||
plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/emby-icon.png"
|
||||
# 插件版本
|
||||
plugin_version = "1.7.4"
|
||||
plugin_version = "1.7.5"
|
||||
# 插件作者
|
||||
plugin_author = "thsrite"
|
||||
# 作者主页
|
||||
@@ -596,8 +610,8 @@ class EmbyMetaRefresh(_PluginBase):
|
||||
if also_known_as:
|
||||
for name in also_known_as:
|
||||
if name and StringUtils.is_chinese(name):
|
||||
# 使用cn2an将繁体转化为简体
|
||||
return zhconv.convert(name, "zh-hans")
|
||||
# 使用 zhconv / zhconv-rs 将繁体转化为简体
|
||||
return _convert_to_zh_hans(name)
|
||||
except Exception as err:
|
||||
logger.error(f"获取人物中文名失败:{err}")
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user