refactor backend module architecture

This commit is contained in:
jxxghp
2026-08-14 15:45:38 +08:00
parent 557cc0e2e3
commit 7b3444c366
716 changed files with 10378 additions and 7709 deletions
+1
View File
@@ -0,0 +1 @@
"""MoviePilot 插件可依赖的稳定宿主接口。"""
+46
View File
@@ -0,0 +1,46 @@
"""插件可用的缓存契约、适配器工厂和装饰器。"""
from app.infrastructure.cache import (
AsyncFileBackend,
AsyncRedisBackend,
FileBackend,
RedisBackend,
)
from app.platform.cache import (
AsyncCache,
AsyncCacheBackend,
AsyncFileCache,
AsyncMemoryBackend,
Cache,
CacheBackend,
FileCache,
LRUCache,
MemoryBackend,
TTLCache,
async_fresh,
cached,
fresh,
is_fresh,
)
__all__ = [
"AsyncCache",
"AsyncCacheBackend",
"AsyncFileBackend",
"AsyncFileCache",
"AsyncMemoryBackend",
"AsyncRedisBackend",
"Cache",
"CacheBackend",
"FileBackend",
"FileCache",
"LRUCache",
"MemoryBackend",
"RedisBackend",
"TTLCache",
"async_fresh",
"cached",
"fresh",
"is_fresh",
]
+6
View File
@@ -0,0 +1,6 @@
"""插件可读取的宿主配置对象。"""
from app.platform.config import global_vars, settings
__all__ = ["global_vars", "settings"]
+6
View File
@@ -0,0 +1,6 @@
"""插件事件订阅与发布接口。"""
from app.platform.events import Event, EventManager, eventmanager
__all__ = ["Event", "EventManager", "eventmanager"]
+17
View File
@@ -0,0 +1,17 @@
"""插件可使用的稳定日志入口。"""
from app.platform.log import (
CustomFormatter,
LogConfigModel,
LogEntry,
LogSettings,
LoggerManager,
NonBlockingFileHandler,
configure_log_settings,
configure_log_writer,
logger,
log_settings,
)
__all__ = ["logger"]
+41
View File
@@ -0,0 +1,41 @@
"""插件使用的媒体上下文、标题解析和识别类型。"""
from app.domain.context import Context, MediaInfo, TorrentInfo
from app.domain.meta.metaanime import MetaAnime
from app.domain.meta.metabase import MetaBase
from app.domain.meta.metamusic import (
MetaMusic,
MusicNameContext,
MusicNameParseResult,
MusicNameParser,
MusicNamePattern,
MusicNamePatternMatch,
MusicNameRegistry,
)
from app.domain.meta.metavideo import MetaVideo
from app.domain.meta.words import WordsMatcher
from app.domain.metainfo import MetaInfo, MetaInfoPath
from app.domain.scraper import NfoReader
from app.domain.tokens import Tokens
__all__ = [
"Context",
"MediaInfo",
"MetaAnime",
"MetaBase",
"MetaInfo",
"MetaInfoPath",
"MetaMusic",
"MetaVideo",
"NfoReader",
"Tokens",
"MusicNameContext",
"MusicNameParseResult",
"MusicNameParser",
"MusicNamePattern",
"MusicNamePatternMatch",
"MusicNameRegistry",
"TorrentInfo",
"WordsMatcher",
]
+19
View File
@@ -0,0 +1,19 @@
"""插件常用的 HTTP、地址和站点处理工具。"""
from app.domain.site import SiteUtils
from app.infrastructure.network import IpUtils
from app.foundation.url import UrlUtils
from app.foundation.http import AsyncRequestUtils, RequestUtils
from app.integrations.location import WebUtils
from app.security.url import SecurityUtils
__all__ = [
"AsyncRequestUtils",
"IpUtils",
"RequestUtils",
"SecurityUtils",
"SiteUtils",
"UrlUtils",
"WebUtils",
]
+7
View File
@@ -0,0 +1,7 @@
"""插件和模块运行时管理接口。"""
from app.extensions.module_manager import ModuleManager
from app.extensions.plugin_manager import PluginManager
__all__ = ["ModuleManager", "PluginManager"]
+27
View File
@@ -0,0 +1,27 @@
"""插件可使用的宿主服务发现与运行时门面。"""
from app.extensions.service_registry import ServiceBaseHelper, ServiceConfigHelper
from app.platform.runtime import SystemHelper
from app.services.downloader import DownloaderHelper
from app.services.filter import RuleHelper
from app.services.mediaserver import (
MediaServerIdentityHelper,
MediaServerHelper,
MusicMediaServerHelper,
)
from app.services.storage import StorageHelper
from app.services.notification import NotificationHelper
__all__ = [
"DownloaderHelper",
"MediaServerHelper",
"MediaServerIdentityHelper",
"MusicMediaServerHelper",
"NotificationHelper",
"RuleHelper",
"ServiceBaseHelper",
"ServiceConfigHelper",
"StorageHelper",
"SystemHelper",
]
+35
View File
@@ -0,0 +1,35 @@
"""插件常用的无状态通用工具。"""
from app.domain.string import StringUtils
from app.foundation.crypto import CryptoJsUtils
from app.foundation.dom import DomUtils
from app.foundation.jieba import cut
from app.foundation.object import ObjectUtils
from app.foundation.singleton import Singleton
from app.infrastructure.system import SystemUtils
from app.platform.execution import log_execution_time, retry
from app.platform.localization import LocaleHelper
from app.platform.scheduling import TimerUtils
from app.security.otp import OtpUtils
decrypt = CryptoJsUtils.decrypt
encrypt = CryptoJsUtils.encrypt
__all__ = [
"CryptoJsUtils",
"DomUtils",
"ObjectUtils",
"OtpUtils",
"LocaleHelper",
"Singleton",
"StringUtils",
"SystemUtils",
"TimerUtils",
"cut",
"decrypt",
"encrypt",
"log_execution_time",
"retry",
]