mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-06-03 14:39:56 +08:00
chore: update text processing dependencies
This commit is contained in:
@@ -2,7 +2,6 @@ import re
|
||||
from typing import List, Optional, Tuple, Union
|
||||
|
||||
import cn2an
|
||||
import zhconv
|
||||
|
||||
from app import schemas
|
||||
from app.core.config import settings
|
||||
@@ -19,6 +18,7 @@ from app.schemas.types import MediaType, ModuleType, MediaRecognizeType
|
||||
from app.utils.common import retry
|
||||
from app.utils.http import RequestUtils
|
||||
from app.utils.limit import rate_limit_exponential
|
||||
from app.utils.zhconv import convert as zhconv_convert
|
||||
|
||||
|
||||
class DoubanModule(_ModuleBase):
|
||||
@@ -77,7 +77,7 @@ class DoubanModule(_ModuleBase):
|
||||
准备搜索名称列表,保留中英文名称分别识别且按顺序去重的历史行为。
|
||||
"""
|
||||
# 简体名称
|
||||
zh_name = zhconv.convert(meta.cn_name, "zh-hans") if meta.cn_name else None
|
||||
zh_name = zhconv_convert(meta.cn_name, "zh-hans") if meta.cn_name else None
|
||||
# 使用中英文名分别识别,去重去空,但要保持顺序
|
||||
return list(dict.fromkeys([k for k in [meta.cn_name, zh_name, meta.en_name] if k]))
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import re
|
||||
from typing import Optional, List, Tuple, Union, Dict
|
||||
|
||||
import cn2an
|
||||
import zhconv
|
||||
|
||||
from app import schemas
|
||||
from app.core.config import settings
|
||||
@@ -17,6 +16,7 @@ from app.modules.themoviedb.tmdbapi import TmdbApi
|
||||
from app.schemas.category import CategoryConfig
|
||||
from app.schemas.types import MediaType, MediaImageType, ModuleType, MediaRecognizeType
|
||||
from app.utils.http import RequestUtils
|
||||
from app.utils.zhconv import convert as zhconv_convert
|
||||
|
||||
|
||||
_DATE_RE = re.compile(r"^\d{4}-\d{2}-\d{2}$")
|
||||
@@ -116,7 +116,7 @@ class TheMovieDbModule(_ModuleBase):
|
||||
准备搜索名称列表
|
||||
"""
|
||||
# 简体名称
|
||||
zh_name = zhconv.convert(meta.cn_name, "zh-hans") if meta.cn_name else None
|
||||
zh_name = zhconv_convert(meta.cn_name, "zh-hans") if meta.cn_name else None
|
||||
# 使用中英文名分别识别,去重去空,但要保持顺序
|
||||
return list(dict.fromkeys([k for k in [meta.cn_name, zh_name, meta.en_name] if k]))
|
||||
|
||||
|
||||
@@ -2,12 +2,11 @@ import re
|
||||
import traceback
|
||||
from typing import Optional, List
|
||||
|
||||
import zhconv
|
||||
|
||||
from app.core.config import settings
|
||||
from app.log import logger
|
||||
from app.schemas.types import MediaType
|
||||
from app.utils.string import StringUtils
|
||||
from app.utils.zhconv import convert as zhconv_convert
|
||||
from .tmdbv3api import TMDb, Search, Movie, TV, Season, Episode, Discover, Trending, Person, Collection
|
||||
from .tmdbv3api.exceptions import TMDbException
|
||||
|
||||
@@ -726,7 +725,7 @@ class TmdbApi:
|
||||
if iso_3166_1 == "CN":
|
||||
title = alternative_title.get("title")
|
||||
if title and StringUtils.is_chinese(title) \
|
||||
and zhconv.convert(title, "zh-hans") == title:
|
||||
and zhconv_convert(title, "zh-hans") == title:
|
||||
return title
|
||||
return tmdbinfo.get("title") if tmdbinfo.get("media_type") == MediaType.MOVIE else tmdbinfo.get("name")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user