mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-03 13:55:00 +08:00
41 lines
1.0 KiB
Python
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
|