Files
MoviePilot/app/chain/acoustid.py
DDSRem 2de976f6b3 Merge pull request #7050 from DDSRem-Dev/codex-comment-migration
docs: 统一全项目中文注释和结构化契约说明
2026-10-17 19:26:29 +08:00

41 lines
1.0 KiB
Python

"""
通过模块调度按本地音频指纹查询 MusicBrainz 录音标识。
"""
from pathlib import Path
from typing import Optional, Union
from app.chain.base import ChainBase
class AcoustIdChain(ChainBase):
"""
AcoustID 音频指纹识别来源链。
"""
def identify_music_by_fingerprint(
self,
path: Union[str, Path],
) -> Optional[str]:
"""
根据本地音频指纹返回 MusicBrainz Recording ID。
"""
result = self.run_module(
"identify_music_by_fingerprint",
path=Path(path),
)
return str(result).strip() if result else None
async def async_identify_music_by_fingerprint(
self,
path: Union[str, Path],
) -> Optional[str]:
"""
异步根据本地音频指纹返回 MusicBrainz Recording ID。
"""
result = await self.async_run_module(
"async_identify_music_by_fingerprint",
path=Path(path),
)
return str(result).strip() if result else None