fix(tools): 애니 파이프라인 버그 4건 수정 — Unicode SyntaxError, 카타카나 변환, Nyaa 검색 전략 + Python 환경 설정
This commit is contained in:
@@ -81,16 +81,37 @@ class AnimePipeline:
|
||||
except Exception as e:
|
||||
result.errors.append(f"자막 조회 오류: {e}")
|
||||
|
||||
# 3. Nyaa 토렌트 검색 (원제 로마자로)
|
||||
# 3. Nyaa 토렌트 검색 (다중 전략 — suffix 있는/없는 조합)
|
||||
try:
|
||||
from tools.title_matcher import japanese_to_romaji
|
||||
romaji_title = japanese_to_romaji(anime.original_subject)
|
||||
import re as _re
|
||||
|
||||
# 먼저 로마자로 검색
|
||||
torrents = await self.nyaa.search(romaji_title)
|
||||
if not torrents:
|
||||
# 원제 그대로 검색
|
||||
torrents = await self.nyaa.search(anime.original_subject)
|
||||
romaji_full = japanese_to_romaji(anime.original_subject)
|
||||
# 한자/비ASCII 잔류 문자 제거 → 순수 로마자만 추출
|
||||
romaji_clean = _re.sub(r'[^\x00-\x7F]+', ' ', romaji_full).strip()
|
||||
romaji_clean = _re.sub(r'\s+', ' ', romaji_clean)
|
||||
|
||||
# 검색 전략 (query, use_default_suffix) 순서
|
||||
strategies: list[tuple[str, bool]] = []
|
||||
if romaji_clean and len(romaji_clean) >= 3:
|
||||
strategies.append((romaji_clean, True)) # romaji + ASW HEVC
|
||||
strategies.append((romaji_clean, False)) # romaji only
|
||||
strategies.append((anime.original_subject, True)) # 원제 + suffix
|
||||
strategies.append((anime.original_subject, False)) # 원제 only
|
||||
strategies.append((anime.subject, True)) # 한글 + suffix
|
||||
strategies.append((anime.subject, False)) # 한글 only
|
||||
|
||||
torrents = []
|
||||
for query, use_suffix in strategies:
|
||||
torrents = await self.nyaa.search(
|
||||
query, use_default_suffix=use_suffix,
|
||||
)
|
||||
if torrents:
|
||||
suffix_label = " +suffix" if use_suffix else ""
|
||||
logger.info(
|
||||
f"Nyaa 검색 성공: '{query}'{suffix_label} → {len(torrents)}건"
|
||||
)
|
||||
break
|
||||
|
||||
# 제목 매칭 필터링
|
||||
matched = match_titles(
|
||||
|
||||
Reference in New Issue
Block a user