mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-06-05 15:39:40 +08:00
fix: use original name for media recognize share
This commit is contained in:
@@ -39,3 +39,4 @@ def should_use_parent_title_for_file_stem(
|
||||
def clear_parsed_title_for_parent_merge(meta: MetaBase) -> None:
|
||||
meta.cn_name = None
|
||||
meta.en_name = None
|
||||
meta.original_name = None
|
||||
|
||||
@@ -29,6 +29,8 @@ class MetaBase(object):
|
||||
cn_name: Optional[str] = None
|
||||
# 识别的英文名
|
||||
en_name: Optional[str] = None
|
||||
# 未应用识别词时识别出的名称
|
||||
original_name: Optional[str] = None
|
||||
# 年份
|
||||
year: Optional[str] = None
|
||||
# 总季数
|
||||
@@ -555,6 +557,9 @@ class MetaBase(object):
|
||||
if not self.name:
|
||||
self.cn_name = meta.cn_name
|
||||
self.en_name = meta.en_name
|
||||
# 未应用识别词时识别出的名称
|
||||
if not self.original_name:
|
||||
self.original_name = meta.original_name
|
||||
# 年份
|
||||
if not self.year:
|
||||
self.year = meta.year
|
||||
|
||||
@@ -14,13 +14,13 @@ from app.log import logger
|
||||
from app.schemas.types import MediaType
|
||||
|
||||
|
||||
def MetaInfo(title: str, subtitle: Optional[str] = None, custom_words: List[str] = None) -> MetaBase:
|
||||
def _build_meta_info(
|
||||
title: str,
|
||||
subtitle: Optional[str] = None,
|
||||
custom_words: List[str] = None,
|
||||
) -> MetaBase:
|
||||
"""
|
||||
根据标题和副标题识别元数据
|
||||
:param title: 标题、种子名、文件名
|
||||
:param subtitle: 副标题、描述
|
||||
:param custom_words: 自定义识别词列表
|
||||
:return: MetaAnime、MetaVideo
|
||||
根据标题构造元数据
|
||||
"""
|
||||
# 原标题
|
||||
org_title = title
|
||||
@@ -40,7 +40,7 @@ def MetaInfo(title: str, subtitle: Optional[str] = None, custom_words: List[str]
|
||||
meta = MetaAnime(title, subtitle, isfile) if is_anime(title) else MetaVideo(title, subtitle, isfile)
|
||||
# 记录原标题
|
||||
meta.title = org_title
|
||||
# 记录使用的识别词
|
||||
# 记录使用的识别词
|
||||
meta.apply_words = apply_words or []
|
||||
# 修正媒体信息
|
||||
if metainfo.get('tmdbid'):
|
||||
@@ -67,6 +67,23 @@ def MetaInfo(title: str, subtitle: Optional[str] = None, custom_words: List[str]
|
||||
return meta
|
||||
|
||||
|
||||
def MetaInfo(title: str, subtitle: Optional[str] = None, custom_words: List[str] = None) -> MetaBase:
|
||||
"""
|
||||
根据标题和副标题识别元数据
|
||||
:param title: 标题、种子名、文件名
|
||||
:param subtitle: 副标题、描述
|
||||
:param custom_words: 自定义识别词列表
|
||||
:return: MetaAnime、MetaVideo
|
||||
"""
|
||||
meta = _build_meta_info(title=title, subtitle=subtitle, custom_words=custom_words)
|
||||
if meta.apply_words:
|
||||
original_meta = _build_meta_info(title=title, subtitle=subtitle)
|
||||
meta.original_name = original_meta.name or meta.name
|
||||
else:
|
||||
meta.original_name = meta.name
|
||||
return meta
|
||||
|
||||
|
||||
def MetaInfoPath(path: Path, custom_words: List[str] = None) -> MetaBase:
|
||||
"""
|
||||
根据路径识别元数据
|
||||
|
||||
@@ -39,7 +39,7 @@ class MediaRecognizeShareHelper(metaclass=WeakSingleton):
|
||||
"""
|
||||
if not meta:
|
||||
return None
|
||||
keyword = getattr(meta, "name", None)
|
||||
keyword = getattr(meta, "original_name", None) or getattr(meta, "name", None)
|
||||
if keyword:
|
||||
keyword = str(keyword).strip()
|
||||
return keyword or None
|
||||
|
||||
Reference in New Issue
Block a user