Files
MoviePilot/app/chain/_contracts.py
T

97 lines
2.6 KiB
Python

"""Chain mixin 对宿主能力的静态契约。"""
from __future__ import annotations
from typing import Any, Protocol
class ChainRuntimeMixinHost(Protocol):
"""识别与消息 mixin 共用的 Chain 运行能力。"""
runtime_config: Any
eventmanager: Any
messageoper: Any
messagequeue: Any
def run_module(self, method: str, **kwargs: Any) -> Any:
"""调用同步模块能力。"""
...
async def async_run_module(self, method: str, **kwargs: Any) -> Any:
"""调用异步模块能力。"""
...
class MusicSubscribeMixinHost(Protocol):
"""音乐订阅 mixin 对 SubscribeChain 的最小要求。"""
@classmethod
def _music_media_chain(cls) -> Any:
"""构造媒体识别链。"""
...
def _music_download_chain(self) -> Any:
"""构造下载链。"""
...
def _music_search_chain(self) -> Any:
"""构造搜索链。"""
...
def _music_site_keywords(self, mediainfo: Any) -> list[str]:
"""构造音乐站点搜索关键字。"""
...
def _matches_music_resource(self, mediainfo: Any, *texts: Any) -> bool:
"""判断站点资源文本是否匹配音乐目标。"""
...
def get_sub_sites(self, subscribe: Any) -> list[int]: ...
def get_params(self, subscribe: Any) -> Any: ...
def filter_torrents(self, *args: Any, **kwargs: Any) -> Any: ...
def check_and_handle_existing_media(self, *args: Any, **kwargs: Any) -> Any: ...
def finish_subscribe_or_not(self, *args: Any, **kwargs: Any) -> Any: ...
def get_subscribe_source_keyword(self, subscribe: Any) -> str: ...
class InteractionMixinHost(Protocol):
"""交互委托 mixin 对业务 Chain 的最小要求。"""
_interaction_handler_type: type
def _interaction_handler(self) -> Any:
"""构造业务交互处理器。"""
...
class TransferMixinHost(ChainRuntimeMixinHost, Protocol):
"""整理辅助 mixin 对 TransferChain 的最小要求。"""
@classmethod
def _transfer_media_chain(cls) -> Any:
"""构造媒体识别链。"""
...
@classmethod
def _transfer_storage_chain(cls) -> Any:
"""构造存储链。"""
...
@classmethod
def _transfer_subscribe_chain(cls) -> Any:
"""构造订阅链。"""
...
def post_message(self, *args: Any, **kwargs: Any) -> Any: ...
async def async_post_message(self, *args: Any, **kwargs: Any) -> Any: ...
def obtain_images(self, *args: Any, **kwargs: Any) -> Any: ...
def do_transfer(self, *args: Any, **kwargs: Any) -> Any: ...