mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
chore: sync database worker branch with upstream v3
This commit is contained in:
@@ -27,7 +27,9 @@ import threading
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Callable, Dict, List, Optional
|
from typing import Any, Callable, Dict, List, Optional
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|
||||||
# worker 脚本路径。用绝对路径直接执行,而不是 -m 或 import:
|
# worker 脚本路径。用绝对路径直接执行,而不是 -m 或 import:
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ from app.runtime.capabilities.model import (
|
|||||||
SelectorSchema,
|
SelectorSchema,
|
||||||
)
|
)
|
||||||
from app.runtime.capabilities.registry import CapabilityRegistry
|
from app.runtime.capabilities.registry import CapabilityRegistry
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
|
|
||||||
|
|
||||||
_DEFAULT_CAPABILITY_ROOT = Path(__file__).resolve().parent
|
_DEFAULT_CAPABILITY_ROOT = Path(__file__).resolve().parent
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ from pathlib import Path
|
|||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.adapters.network.http import RequestUtils
|
from app.adapters.network.http import RequestUtils
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ from urllib.parse import urlsplit
|
|||||||
from langchain_core.messages import AIMessage, AIMessageChunk
|
from langchain_core.messages import AIMessage, AIMessageChunk
|
||||||
|
|
||||||
from app.agent.llm.gateway import resolve_llm_provider_runtime
|
from app.agent.llm.gateway import resolve_llm_provider_runtime
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ import aiofiles
|
|||||||
import httpx
|
import httpx
|
||||||
import jwt
|
import jwt
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import LlmProviderAction, SystemConfigKey
|
from app.schemas.types import LlmProviderAction, SystemConfigKey
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ from typing import Dict, List, Optional
|
|||||||
|
|
||||||
from langchain_core.messages import BaseMessage, messages_from_dict, messages_to_dict
|
from langchain_core.messages import BaseMessage, messages_from_dict, messages_to_dict
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.agentdata import AgentChatPort as AgentChatOper
|
from app.application.agentdata import AgentChatPort as AgentChatOper
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.agent import ConversationMemory
|
from app.schemas.agent import ConversationMemory
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ from app.agent.tools.impl.mcp import (
|
|||||||
)
|
)
|
||||||
from app.agent.tools.impl.query_system_settings import QuerySystemSettingsTool
|
from app.agent.tools.impl.query_system_settings import QuerySystemSettingsTool
|
||||||
from app.chain.agent import AgentChain
|
from app.chain.agent import AgentChain
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.events import eventmanager
|
from app.runtime.events import eventmanager
|
||||||
from app.runtime.observability import record_metric
|
from app.runtime.observability import record_metric
|
||||||
from app.application.plugin.runtime import get_plugin_manager
|
from app.application.plugin.runtime import get_plugin_manager
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ from typing import Any, Dict, Optional
|
|||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from app.agent.llm.capability import AgentCapabilityManager
|
from app.agent.llm.capability import AgentCapabilityManager
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.notification import ChannelCapability
|
from app.schemas.notification import ChannelCapability
|
||||||
from app.schemas.notification import ChannelCapabilities
|
from app.schemas.notification import ChannelCapabilities
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ from urllib.parse import urlencode, urljoin, urlparse
|
|||||||
|
|
||||||
from app.agent.skills.metadata import parse_skill_metadata
|
from app.agent.skills.metadata import parse_skill_metadata
|
||||||
from app.runtime.cache import cached, fresh
|
from app.runtime.cache import cached, fresh
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.adapters.network.http import RequestUtils
|
from app.adapters.network.http import RequestUtils
|
||||||
from app.foundation.singleton import WeakSingleton
|
from app.foundation.singleton import WeakSingleton
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ from app.agent.policy.sanitizer import (
|
|||||||
)
|
)
|
||||||
from app.agent.tools.tags import ToolTag
|
from app.agent.tools.tags import ToolTag
|
||||||
from app.chain import ChainBase
|
from app.chain import ChainBase
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.messaging.agent import matches_channel_admin
|
from app.application.messaging.agent import matches_channel_admin
|
||||||
from app.runtime.extensions.service_config import ServiceConfigHelper
|
from app.runtime.extensions.service_config import ServiceConfigHelper
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import json
|
|||||||
import shutil
|
import shutil
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.plugin.runtime import get_plugin_manager
|
from app.application.plugin.runtime import get_plugin_manager
|
||||||
from app.application.plugin.install import PluginInstallCommand
|
from app.application.plugin.install import PluginInstallCommand
|
||||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ from pathlib import Path
|
|||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from app.agent.tools.impl._command_safety import validate_command_safety
|
from app.agent.tools.impl._command_safety import validate_command_safety
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|
||||||
if os.name == "posix":
|
if os.name == "posix":
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ from app.agent.tools.tags import ToolTag
|
|||||||
from app.chain.download import DownloadChain
|
from app.chain.download import DownloadChain
|
||||||
from app.chain.media import MediaChain
|
from app.chain.media import MediaChain
|
||||||
from app.chain.search import SearchChain
|
from app.chain.search import SearchChain
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import Context
|
from app.domain.context import Context
|
||||||
from app.domain.metainfo import MetaInfo
|
from app.domain.metainfo import MetaInfo
|
||||||
from app.application.agentdata import SitePort as SiteOper
|
from app.application.agentdata import SitePort as SiteOper
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ from pydantic import BaseModel, Field, model_validator
|
|||||||
|
|
||||||
from app.agent.tools.base import MoviePilotTool
|
from app.agent.tools.base import MoviePilotTool
|
||||||
from app.agent.tools.tags import ToolTag
|
from app.agent.tools.tags import ToolTag
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.agentdata import AgentChatPort as AgentChatOper
|
from app.application.agentdata import AgentChatPort as AgentChatOper
|
||||||
from app.application.agentdata import AgentTaskPort as AgentTaskOper
|
from app.application.agentdata import AgentTaskPort as AgentTaskOper
|
||||||
from app.runtime.scheduling import TimerUtils
|
from app.runtime.scheduling import TimerUtils
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ from pydantic import BaseModel, Field
|
|||||||
|
|
||||||
from app.agent.tools.base import MoviePilotTool
|
from app.agent.tools.base import MoviePilotTool
|
||||||
from app.agent.tools.tags import ToolTag
|
from app.agent.tools.tags import ToolTag
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.agentdata import AgentTaskPort as AgentTaskOper
|
from app.application.agentdata import AgentTaskPort as AgentTaskOper
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ from app.agent.tools.impl._system_setting_utils import (
|
|||||||
resolve_setting_spec,
|
resolve_setting_spec,
|
||||||
should_redact_setting,
|
should_redact_setting,
|
||||||
)
|
)
|
||||||
from app.runtime.config import settings
|
|
||||||
from app.application.configuration import (
|
from app.application.configuration import (
|
||||||
SystemConfigReader,
|
SystemConfigReader,
|
||||||
get_configured_system_config as SystemConfigOper,
|
get_configured_system_config as SystemConfigOper,
|
||||||
|
get_runtime_settings,
|
||||||
)
|
)
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ class QuerySystemSettingsTool(MoviePilotTool):
|
|||||||
def _load_setting_value(self, spec: SettingSpec):
|
def _load_setting_value(self, spec: SettingSpec):
|
||||||
"""读取指定设置项的当前值。"""
|
"""读取指定设置项的当前值。"""
|
||||||
if spec.source == "settings":
|
if spec.source == "settings":
|
||||||
return getattr(settings, spec.key)
|
return get_runtime_settings().get(spec.key)
|
||||||
return self._get_system_config().get(spec.systemconfig_key)
|
return self._get_system_config().get(spec.systemconfig_key)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ from pydantic import BaseModel, Field
|
|||||||
from app.agent.tools.base import MoviePilotTool
|
from app.agent.tools.base import MoviePilotTool
|
||||||
from app.agent.tools.tags import ToolTag
|
from app.agent.tools.tags import ToolTag
|
||||||
from app.chain.media import MediaChain
|
from app.chain.media import MediaChain
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import Context
|
from app.domain.context import Context
|
||||||
from app.domain.meta.metamusic import MetaMusic
|
from app.domain.meta.metamusic import MetaMusic
|
||||||
from app.domain.metainfo import MetaInfo
|
from app.domain.metainfo import MetaInfo
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ from app.agent.tools.base import MoviePilotTool
|
|||||||
from app.agent.tools.tags import ToolTag
|
from app.agent.tools.tags import ToolTag
|
||||||
from app.chain.media import MediaChain
|
from app.chain.media import MediaChain
|
||||||
from app.chain.scraping import ScrapingChain
|
from app.chain.scraping import ScrapingChain
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.workflow import FileItem
|
from app.schemas.workflow import FileItem
|
||||||
from app.schemas.types import (
|
from app.schemas.types import (
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ from pydantic import BaseModel, Field
|
|||||||
|
|
||||||
from app.agent.tools.base import MoviePilotTool
|
from app.agent.tools.base import MoviePilotTool
|
||||||
from app.agent.tools.tags import ToolTag
|
from app.agent.tools.tags import ToolTag
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|
||||||
# 搜索超时时间(秒)
|
# 搜索超时时间(秒)
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ from pydantic import BaseModel, Field
|
|||||||
from app.agent.llm.capability import AgentCapabilityManager
|
from app.agent.llm.capability import AgentCapabilityManager
|
||||||
from app.agent.tools.base import MoviePilotTool
|
from app.agent.tools.base import MoviePilotTool
|
||||||
from app.agent.tools.tags import ToolTag
|
from app.agent.tools.tags import ToolTag
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.message import Message
|
from app.schemas.message import Message
|
||||||
from app.schemas.message import MessageType
|
from app.schemas.message import MessageType
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ from pydantic import BaseModel, Field, model_validator
|
|||||||
|
|
||||||
from app.agent.tools.base import MoviePilotTool
|
from app.agent.tools.base import MoviePilotTool
|
||||||
from app.agent.tools.tags import ToolTag
|
from app.agent.tools.tags import ToolTag
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.agentdata import AgentTaskPort as AgentTaskOper
|
from app.application.agentdata import AgentTaskPort as AgentTaskOper
|
||||||
from app.runtime.scheduling import TimerUtils
|
from app.runtime.scheduling import TimerUtils
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ from app.agent.tools.impl._system_setting_utils import (
|
|||||||
resolve_setting_spec,
|
resolve_setting_spec,
|
||||||
should_redact_setting,
|
should_redact_setting,
|
||||||
)
|
)
|
||||||
from app.runtime.config import settings
|
|
||||||
from app.runtime.events import eventmanager
|
from app.runtime.events import eventmanager
|
||||||
from app.application.configuration import (
|
from app.application.configuration import (
|
||||||
SystemConfigService,
|
SystemConfigService,
|
||||||
get_configured_system_config as SystemConfigOper,
|
get_configured_system_config as SystemConfigOper,
|
||||||
|
get_runtime_settings,
|
||||||
)
|
)
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.event import ConfigChangeEventData
|
from app.schemas.event import ConfigChangeEventData
|
||||||
@@ -126,7 +126,7 @@ class UpdateSystemSettingsTool(MoviePilotTool):
|
|||||||
def _load_setting_value(self, spec: SettingSpec):
|
def _load_setting_value(self, spec: SettingSpec):
|
||||||
"""读取指定设置项的当前值。"""
|
"""读取指定设置项的当前值。"""
|
||||||
if spec.source == "settings":
|
if spec.source == "settings":
|
||||||
return getattr(settings, spec.key)
|
return get_runtime_settings().get(spec.key)
|
||||||
return self._get_system_config().get(spec.systemconfig_key)
|
return self._get_system_config().get(spec.systemconfig_key)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -274,7 +274,7 @@ class UpdateSystemSettingsTool(MoviePilotTool):
|
|||||||
changed = False
|
changed = False
|
||||||
message = ""
|
message = ""
|
||||||
if spec.source == "settings":
|
if spec.source == "settings":
|
||||||
success, message = settings.update_setting(spec.key, next_value)
|
success, message = get_runtime_settings().update(spec.key, next_value)
|
||||||
if success is False:
|
if success is False:
|
||||||
return json.dumps(
|
return json.dumps(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ class RuntimeSettingsService:
|
|||||||
|
|
||||||
def update(self, key: str, value: Any) -> tuple[Optional[bool], str]:
|
def update(self, key: str, value: Any) -> tuple[Optional[bool], str]:
|
||||||
"""更新单个部署设置。"""
|
"""更新单个部署设置。"""
|
||||||
return self._settings.update_setting(key=key, value=value)
|
return self._settings.update_setting(key, value)
|
||||||
|
|
||||||
|
|
||||||
class SystemConfigService:
|
class SystemConfigService:
|
||||||
@@ -383,6 +383,9 @@ def configure_runtime_settings(service: RuntimeSettingsService) -> None:
|
|||||||
"""由组合根登记管理 API 使用的部署设置服务。"""
|
"""由组合根登记管理 API 使用的部署设置服务。"""
|
||||||
global _runtime_settings_service
|
global _runtime_settings_service
|
||||||
_runtime_settings_service = service
|
_runtime_settings_service = service
|
||||||
|
from app.runtime.settings import configure_runtime_settings_compat
|
||||||
|
|
||||||
|
configure_runtime_settings_compat(service)
|
||||||
|
|
||||||
|
|
||||||
def get_runtime_settings() -> RuntimeSettingsService:
|
def get_runtime_settings() -> RuntimeSettingsService:
|
||||||
|
|||||||
+4
-1
@@ -15,7 +15,10 @@ from urllib.request import ProxyHandler, Request, build_opener, urlopen
|
|||||||
import click
|
import click
|
||||||
import psutil
|
import psutil
|
||||||
|
|
||||||
from app.runtime.config import Settings, settings
|
from app.runtime.config import Settings
|
||||||
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.state import SystemHelper
|
from app.runtime.state import SystemHelper
|
||||||
from app.application.backup import BackupArtifact
|
from app.application.backup import BackupArtifact
|
||||||
from app.startup.database import build_database_governance
|
from app.startup.database import build_database_governance
|
||||||
|
|||||||
@@ -43,6 +43,14 @@ def run_legacy_sync_query(operation: Callable[[Session], _R]) -> _R:
|
|||||||
except Exception as close_err: # noqa: BLE001 兼容查询释放失败不改变返回语义
|
except Exception as close_err: # noqa: BLE001 兼容查询释放失败不改变返回语义
|
||||||
logger.error(f"释放数据库会话失败:{close_err}")
|
logger.error(f"释放数据库会话失败:{close_err}")
|
||||||
|
|
||||||
|
|
||||||
|
async def run_legacy_async_query(
|
||||||
|
operation: Callable[[AsyncSession], Awaitable[_R]],
|
||||||
|
) -> _R:
|
||||||
|
"""为移除异步查询装饰器的旧 Model ABI 提供一次性异步会话。"""
|
||||||
|
async with async_session_scope() as db:
|
||||||
|
return await operation(db)
|
||||||
|
|
||||||
def _get_args_db(
|
def _get_args_db(
|
||||||
args: tuple[Any, ...],
|
args: tuple[Any, ...],
|
||||||
kwargs: dict[str, Any],
|
kwargs: dict[str, Any],
|
||||||
|
|||||||
+53
-13
@@ -4,7 +4,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|||||||
from sqlalchemy.orm import Mapped, Session, mapped_column
|
from sqlalchemy.orm import Mapped, Session, mapped_column
|
||||||
|
|
||||||
from app.db.base import get_id_column, Base
|
from app.db.base import get_id_column, Base
|
||||||
from app.db.decorators import db_query, async_db_query
|
from app.db.decorators import run_legacy_async_query, run_legacy_sync_query
|
||||||
|
|
||||||
|
|
||||||
class PluginData(Base):
|
class PluginData(Base):
|
||||||
@@ -21,28 +21,54 @@ class PluginData(Base):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@db_query
|
def get_plugin_data(cls, db: Session | None = None, plugin_id: str | None = None):
|
||||||
def get_plugin_data(cls, db: Session, plugin_id: str):
|
"""在调用方 Session 中读取插件全部数据,并兼容旧无会话入口。"""
|
||||||
|
if plugin_id is None:
|
||||||
|
raise TypeError("plugin_id is required")
|
||||||
|
if not isinstance(db, Session):
|
||||||
|
return run_legacy_sync_query(lambda session: cls.get_plugin_data(session, plugin_id))
|
||||||
return list(db.execute(select(cls).where(cls.plugin_id == plugin_id)).scalars().all())
|
return list(db.execute(select(cls).where(cls.plugin_id == plugin_id)).scalars().all())
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@async_db_query
|
async def async_get_plugin_data(
|
||||||
async def async_get_plugin_data(cls, db: AsyncSession, plugin_id: str):
|
cls, db: AsyncSession | None = None, plugin_id: str | None = None
|
||||||
|
):
|
||||||
|
"""在调用方 AsyncSession 中读取插件全部数据,并兼容旧无会话入口。"""
|
||||||
|
if plugin_id is None:
|
||||||
|
raise TypeError("plugin_id is required")
|
||||||
|
if not isinstance(db, AsyncSession):
|
||||||
|
return await run_legacy_async_query(
|
||||||
|
lambda session: cls.async_get_plugin_data(session, plugin_id)
|
||||||
|
)
|
||||||
result = await db.execute(select(cls).where(cls.plugin_id == plugin_id))
|
result = await db.execute(select(cls).where(cls.plugin_id == plugin_id))
|
||||||
return list(result.scalars().all())
|
return list(result.scalars().all())
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@db_query
|
def get_plugin_data_by_key(
|
||||||
def get_plugin_data_by_key(cls, db: Session, plugin_id: str, key: str):
|
cls, db: Session | None = None, plugin_id: str | None = None, key: str | None = None
|
||||||
|
):
|
||||||
|
"""在调用方 Session 中按键读取插件数据,并兼容旧无会话入口。"""
|
||||||
|
if plugin_id is None or key is None:
|
||||||
|
raise TypeError("plugin_id and key are required")
|
||||||
|
if not isinstance(db, Session):
|
||||||
|
return run_legacy_sync_query(
|
||||||
|
lambda session: cls.get_plugin_data_by_key(session, plugin_id, key)
|
||||||
|
)
|
||||||
return db.execute(
|
return db.execute(
|
||||||
select(cls).where(cls.plugin_id == plugin_id, cls.key == key)
|
select(cls).where(cls.plugin_id == plugin_id, cls.key == key)
|
||||||
).scalars().first()
|
).scalars().first()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@async_db_query
|
|
||||||
async def async_get_plugin_data_by_key(
|
async def async_get_plugin_data_by_key(
|
||||||
cls, db: AsyncSession, plugin_id: str, key: str
|
cls, db: AsyncSession | None = None, plugin_id: str | None = None, key: str | None = None
|
||||||
):
|
):
|
||||||
|
"""在调用方 AsyncSession 中按键读取插件数据,并兼容旧无会话入口。"""
|
||||||
|
if plugin_id is None or key is None:
|
||||||
|
raise TypeError("plugin_id and key are required")
|
||||||
|
if not isinstance(db, AsyncSession):
|
||||||
|
return await run_legacy_async_query(
|
||||||
|
lambda session: cls.async_get_plugin_data_by_key(session, plugin_id, key)
|
||||||
|
)
|
||||||
result = await db.execute(
|
result = await db.execute(
|
||||||
select(cls).where(cls.plugin_id == plugin_id, cls.key == key)
|
select(cls).where(cls.plugin_id == plugin_id, cls.key == key)
|
||||||
)
|
)
|
||||||
@@ -59,14 +85,28 @@ class PluginData(Base):
|
|||||||
db.execute(delete(cls).where(cls.plugin_id == plugin_id))
|
db.execute(delete(cls).where(cls.plugin_id == plugin_id))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@db_query
|
def get_plugin_data_by_plugin_id(
|
||||||
def get_plugin_data_by_plugin_id(cls, db: Session, plugin_id: str):
|
cls, db: Session | None = None, plugin_id: str | None = None
|
||||||
|
):
|
||||||
|
"""在调用方 Session 中按插件 ID 读取数据,并兼容旧无会话入口。"""
|
||||||
|
if plugin_id is None:
|
||||||
|
raise TypeError("plugin_id is required")
|
||||||
|
if not isinstance(db, Session):
|
||||||
|
return run_legacy_sync_query(
|
||||||
|
lambda session: cls.get_plugin_data_by_plugin_id(session, plugin_id)
|
||||||
|
)
|
||||||
return list(db.execute(select(cls).where(cls.plugin_id == plugin_id)).scalars().all())
|
return list(db.execute(select(cls).where(cls.plugin_id == plugin_id)).scalars().all())
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@async_db_query
|
|
||||||
async def async_get_plugin_data_by_plugin_id(
|
async def async_get_plugin_data_by_plugin_id(
|
||||||
cls, db: AsyncSession, plugin_id: str
|
cls, db: AsyncSession | None = None, plugin_id: str | None = None
|
||||||
):
|
):
|
||||||
|
"""在调用方 AsyncSession 中按插件 ID 读取数据,并兼容旧无会话入口。"""
|
||||||
|
if plugin_id is None:
|
||||||
|
raise TypeError("plugin_id is required")
|
||||||
|
if not isinstance(db, AsyncSession):
|
||||||
|
return await run_legacy_async_query(
|
||||||
|
lambda session: cls.async_get_plugin_data_by_plugin_id(session, plugin_id)
|
||||||
|
)
|
||||||
result = await db.execute(select(cls).where(cls.plugin_id == plugin_id))
|
result = await db.execute(select(cls).where(cls.plugin_id == plugin_id))
|
||||||
return list(result.scalars().all())
|
return list(result.scalars().all())
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|||||||
from sqlalchemy.orm import Mapped, Session, mapped_column
|
from sqlalchemy.orm import Mapped, Session, mapped_column
|
||||||
|
|
||||||
from app.db.base import Base, get_id_column
|
from app.db.base import Base, get_id_column
|
||||||
from app.db.decorators import db_query, async_db_query
|
from app.db.decorators import run_legacy_async_query
|
||||||
|
|
||||||
|
|
||||||
class SiteIcon(Base):
|
class SiteIcon(Base):
|
||||||
@@ -22,12 +22,25 @@ class SiteIcon(Base):
|
|||||||
base64: Mapped[Optional[str]] = mapped_column(String)
|
base64: Mapped[Optional[str]] = mapped_column(String)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@db_query
|
|
||||||
def get_by_domain(cls, db: Session, domain: str):
|
def get_by_domain(cls, db: Session, domain: str):
|
||||||
|
"""在调用方 Session 中查询站点图标。"""
|
||||||
return db.execute(select(cls).where(cls.domain == domain)).scalars().first()
|
return db.execute(select(cls).where(cls.domain == domain)).scalars().first()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@async_db_query
|
async def async_get_by_domain(
|
||||||
async def async_get_by_domain(cls, db: AsyncSession, domain: str):
|
cls,
|
||||||
result = await db.execute(select(cls).where(cls.domain == domain))
|
db: AsyncSession | None = None,
|
||||||
return result.scalar_one_or_none()
|
domain: str | None = None,
|
||||||
|
):
|
||||||
|
"""在调用方 AsyncSession 中查询站点图标。"""
|
||||||
|
if domain is None:
|
||||||
|
raise TypeError("domain is required")
|
||||||
|
|
||||||
|
async def query(session: AsyncSession):
|
||||||
|
"""在给定异步会话中执行站点图标查询。"""
|
||||||
|
result = await session.execute(select(cls).where(cls.domain == domain))
|
||||||
|
return result.scalar_one_or_none()
|
||||||
|
|
||||||
|
if isinstance(db, AsyncSession):
|
||||||
|
return await query(db)
|
||||||
|
return await run_legacy_async_query(query)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|||||||
from sqlalchemy.orm import Mapped, Session, mapped_column
|
from sqlalchemy.orm import Mapped, Session, mapped_column
|
||||||
|
|
||||||
from app.db.base import get_id_column, Base
|
from app.db.base import get_id_column, Base
|
||||||
from app.db.decorators import db_query, async_db_query
|
from app.db.decorators import run_legacy_async_query
|
||||||
|
|
||||||
|
|
||||||
class SiteStatistic(Base):
|
class SiteStatistic(Base):
|
||||||
@@ -30,15 +30,28 @@ class SiteStatistic(Base):
|
|||||||
note: Mapped[Optional[Any]] = mapped_column(JSON)
|
note: Mapped[Optional[Any]] = mapped_column(JSON)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@db_query
|
|
||||||
def get_by_domain(cls, db: Session, domain: str):
|
def get_by_domain(cls, db: Session, domain: str):
|
||||||
|
"""在调用方 Session 中查询站点统计。"""
|
||||||
return db.execute(select(cls).where(cls.domain == domain)).scalars().first()
|
return db.execute(select(cls).where(cls.domain == domain)).scalars().first()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@async_db_query
|
async def async_get_by_domain(
|
||||||
async def async_get_by_domain(cls, db: AsyncSession, domain: str):
|
cls,
|
||||||
result = await db.execute(select(cls).where(cls.domain == domain))
|
db: AsyncSession | None = None,
|
||||||
return result.scalar_one_or_none()
|
domain: str | None = None,
|
||||||
|
):
|
||||||
|
"""在调用方 AsyncSession 中查询站点统计,并兼容旧无会话调用。"""
|
||||||
|
if domain is None:
|
||||||
|
raise TypeError("domain is required")
|
||||||
|
|
||||||
|
async def query(session: AsyncSession):
|
||||||
|
"""在给定异步会话中执行站点统计查询。"""
|
||||||
|
result = await session.execute(select(cls).where(cls.domain == domain))
|
||||||
|
return result.scalar_one_or_none()
|
||||||
|
|
||||||
|
if isinstance(db, AsyncSession):
|
||||||
|
return await query(db)
|
||||||
|
return await run_legacy_async_query(query)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def reset(cls, db: Session):
|
def reset(cls, db: Session):
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ from sqlalchemy import String, UniqueConstraint, JSON, select
|
|||||||
from sqlalchemy.orm import Mapped, Session, mapped_column
|
from sqlalchemy.orm import Mapped, Session, mapped_column
|
||||||
|
|
||||||
from app.db.base import get_id_column, Base
|
from app.db.base import get_id_column, Base
|
||||||
from app.db.decorators import db_query
|
|
||||||
|
|
||||||
|
|
||||||
class UserConfig(Base):
|
class UserConfig(Base):
|
||||||
@@ -24,8 +23,8 @@ class UserConfig(Base):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@db_query
|
|
||||||
def get_by_key(cls, db: Session, username: str, key: str):
|
def get_by_key(cls, db: Session, username: str, key: str):
|
||||||
|
"""在调用方 Session 中查询用户配置。"""
|
||||||
return db.execute(
|
return db.execute(
|
||||||
select(cls).where(cls.username == username, cls.key == key)
|
select(cls).where(cls.username == username, cls.key == key)
|
||||||
).scalars().first()
|
).scalars().first()
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ import psutil
|
|||||||
|
|
||||||
from app.adapters.system.backup.database import verify_database_backup
|
from app.adapters.system.backup.database import verify_database_backup
|
||||||
from app.adapters.system.backup.files import BackupFiles
|
from app.adapters.system.backup.files import BackupFiles
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.topology import process_topology_issue
|
from app.runtime.topology import process_topology_issue
|
||||||
from app.doctor.models import DoctorFinding, DoctorFindingStatus, DoctorReport, DoctorSeverity
|
from app.doctor.models import DoctorFinding, DoctorFindingStatus, DoctorReport, DoctorSeverity
|
||||||
from app.adapters.system.host import SystemUtils
|
from app.adapters.system.host import SystemUtils
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import sys
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.doctor.checks import default_checks
|
from app.doctor.checks import default_checks
|
||||||
from app.doctor.models import (
|
from app.doctor.models import (
|
||||||
DoctorFinding,
|
DoctorFinding,
|
||||||
|
|||||||
+3
-1
@@ -22,7 +22,9 @@ from app.adapters.web.security.access import (
|
|||||||
)
|
)
|
||||||
from app.application.security.token import create_access_token, decode_access_token
|
from app.application.security.token import create_access_token, decode_access_token
|
||||||
from app.runtime.extensions.plugin_manager import PluginManager
|
from app.runtime.extensions.plugin_manager import PluginManager
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.correlation import get_correlation_id
|
from app.runtime.correlation import get_correlation_id
|
||||||
from app.runtime.localization import LocaleHelper
|
from app.runtime.localization import LocaleHelper
|
||||||
from app.runtime.log import configure_correlation_id_provider, logger
|
from app.runtime.log import configure_correlation_id_provider, logger
|
||||||
|
|||||||
+4
-1
@@ -55,7 +55,10 @@ elif SystemUtils.is_frozen():
|
|||||||
sys.stderr = open(os.devnull, 'w')
|
sys.stderr = open(os.devnull, 'w')
|
||||||
|
|
||||||
from app.factory import app
|
from app.factory import app
|
||||||
from app.runtime.config import global_vars, settings
|
from app.runtime.config import global_vars
|
||||||
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.topology import (
|
from app.runtime.topology import (
|
||||||
UnsupportedProcessTopologyError,
|
UnsupportedProcessTopologyError,
|
||||||
validate_process_topology,
|
validate_process_topology,
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ from pathlib import Path
|
|||||||
from typing import Any, Optional, Tuple, Union
|
from typing import Any, Optional, Tuple, Union
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.modules import _ModuleBase
|
from app.modules import _ModuleBase
|
||||||
from app.schemas.types import ModuleType, OtherModulesType
|
from app.schemas.types import ModuleType, OtherModulesType
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
from app.schemas.context import MediaPerson as _SchemaMediaPerson
|
from app.schemas.context import MediaPerson as _SchemaMediaPerson
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MediaInfo
|
from app.domain.context import MediaInfo
|
||||||
from app.domain.meta.metabase import MetaBase
|
from app.domain.meta.metabase import MetaBase
|
||||||
from app.domain.scraper import MediaScraperHelper
|
from app.domain.scraper import MediaScraperHelper
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ from datetime import date
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
|
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ from dataclasses import dataclass
|
|||||||
from typing import Any, List, Optional, Tuple, Union
|
from typing import Any, List, Optional, Tuple, Union
|
||||||
|
|
||||||
from app.schemas.context import MediaPerson as _SchemaMediaPerson
|
from app.schemas.context import MediaPerson as _SchemaMediaPerson
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MediaInfo
|
from app.domain.context import MediaInfo
|
||||||
from app.domain.meta.metabase import MetaBase
|
from app.domain.meta.metabase import MetaBase
|
||||||
from app.domain.scraper import MediaScraperHelper
|
from app.domain.scraper import MediaScraperHelper
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ from typing import Optional
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
|
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ import discord
|
|||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MediaInfo, Context
|
from app.domain.context import MediaInfo, Context
|
||||||
from app.domain.metainfo import MetaInfo
|
from app.domain.metainfo import MetaInfo
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ from typing import Any, List, Optional, Tuple, Union
|
|||||||
import cn2an
|
import cn2an
|
||||||
|
|
||||||
from app.schemas.context import MediaPerson as _SchemaMediaPerson
|
from app.schemas.context import MediaPerson as _SchemaMediaPerson
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import (
|
from app.domain.context import (
|
||||||
MediaInfo,
|
MediaInfo,
|
||||||
MusicAlbumInfo,
|
MusicAlbumInfo,
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import requests
|
|||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
|
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
|
||||||
from app.foundation.singleton import WeakSingleton
|
from app.foundation.singleton import WeakSingleton
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ from app.schemas.mediaserver import MediaServerLibrary as _SchemaMediaServerLibr
|
|||||||
from app.schemas.mediaserver import MediaServerPlayItem as _SchemaMediaServerPlayItem
|
from app.schemas.mediaserver import MediaServerPlayItem as _SchemaMediaServerPlayItem
|
||||||
from app.schemas.mediaserver import RefreshMediaItem as _SchemaRefreshMediaItem
|
from app.schemas.mediaserver import RefreshMediaItem as _SchemaRefreshMediaItem
|
||||||
from app.schemas.mediaserver import WebhookEventInfo as _SchemaWebhookEventInfo
|
from app.schemas.mediaserver import WebhookEventInfo as _SchemaWebhookEventInfo
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.mediaserver import MediaServerIdentityHelper, MusicMediaServerHelper
|
from app.application.mediaserver import MediaServerIdentityHelper, MusicMediaServerHelper
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.mediaserver import MediaServerItem
|
from app.schemas.mediaserver import MediaServerItem
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ from typing import Optional, Tuple, Union
|
|||||||
|
|
||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.domain.context import MediaInfo
|
from app.domain.context import MediaInfo
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.modules import _ModuleBase
|
from app.modules import _ModuleBase
|
||||||
from app.schemas.types import MediaType, ModuleType, OtherModulesType
|
from app.schemas.types import MediaType, ModuleType, OtherModulesType
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ from lark_oapi.event.callback.model.p2_card_action_trigger import (
|
|||||||
P2CardActionTriggerResponse,
|
P2CardActionTriggerResponse,
|
||||||
)
|
)
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import Context, MediaInfo
|
from app.domain.context import Context, MediaInfo
|
||||||
from app.application.security.user import get_configured_user_channel_lookup
|
from app.application.security.user import get_configured_user_channel_lookup
|
||||||
from app.application.messaging.agent import matches_channel_admin
|
from app.application.messaging.agent import matches_channel_admin
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Optional, List, Tuple, Union, Dict, Callable
|
from typing import Any, Optional, List, Tuple, Union, Dict, Callable
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MediaInfo, MusicInfo
|
from app.domain.context import MediaInfo, MusicInfo
|
||||||
from app.domain.meta.metabase import MetaBase
|
from app.domain.meta.metabase import MetaBase
|
||||||
from app.domain.meta.metamusic import MetaMusic
|
from app.domain.meta.metamusic import MetaMusic
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ import requests
|
|||||||
|
|
||||||
from app.schemas.file import StorageUsage as _SchemaStorageUsage
|
from app.schemas.file import StorageUsage as _SchemaStorageUsage
|
||||||
from app.schemas.workflow import FileItem as _SchemaFileItem
|
from app.schemas.workflow import FileItem as _SchemaFileItem
|
||||||
from app.runtime.config import settings, global_vars
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
from app.runtime.config import global_vars
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.modules.filemanager import StorageBase
|
from app.modules.filemanager import StorageBase
|
||||||
from app.modules.filemanager.storages import transfer_process
|
from app.modules.filemanager.storages import transfer_process
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ from typing import Optional, List
|
|||||||
from app.schemas.file import StorageUsage as _SchemaStorageUsage
|
from app.schemas.file import StorageUsage as _SchemaStorageUsage
|
||||||
from app.schemas.workflow import FileItem as _SchemaFileItem
|
from app.schemas.workflow import FileItem as _SchemaFileItem
|
||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.runtime.config import settings, global_vars
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
from app.runtime.config import global_vars
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.modules.filemanager.storages import StorageBase, transfer_process
|
from app.modules.filemanager.storages import StorageBase, transfer_process
|
||||||
from app.schemas.exception import OperationInterrupted, StorageQueryError
|
from app.schemas.exception import OperationInterrupted, StorageQueryError
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ from typing import Optional, List
|
|||||||
|
|
||||||
from app.schemas.file import StorageUsage as _SchemaStorageUsage
|
from app.schemas.file import StorageUsage as _SchemaStorageUsage
|
||||||
from app.schemas.workflow import FileItem as _SchemaFileItem
|
from app.schemas.workflow import FileItem as _SchemaFileItem
|
||||||
from app.runtime.config import global_vars, settings
|
from app.runtime.config import global_vars
|
||||||
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.directory import DirectoryHelper
|
from app.application.directory import DirectoryHelper
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.adapters.system.fsproxy import fsproxy
|
from app.adapters.system.fsproxy import fsproxy
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ from typing import Optional, List, Union
|
|||||||
|
|
||||||
from app.schemas.file import StorageUsage as _SchemaStorageUsage
|
from app.schemas.file import StorageUsage as _SchemaStorageUsage
|
||||||
from app.schemas.workflow import FileItem as _SchemaFileItem
|
from app.schemas.workflow import FileItem as _SchemaFileItem
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.modules.filemanager.storages import StorageBase, transfer_process
|
from app.modules.filemanager.storages import StorageBase, transfer_process
|
||||||
from app.schemas.exception import StorageQueryError
|
from app.schemas.exception import StorageQueryError
|
||||||
|
|||||||
@@ -14,7 +14,10 @@ from smbprotocol.exceptions import (
|
|||||||
|
|
||||||
from app.schemas.file import StorageUsage as _SchemaStorageUsage
|
from app.schemas.file import StorageUsage as _SchemaStorageUsage
|
||||||
from app.schemas.workflow import FileItem as _SchemaFileItem
|
from app.schemas.workflow import FileItem as _SchemaFileItem
|
||||||
from app.runtime.config import settings, global_vars
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
from app.runtime.config import global_vars
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.modules.filemanager import StorageBase
|
from app.modules.filemanager import StorageBase
|
||||||
from app.modules.filemanager.storages import transfer_process
|
from app.modules.filemanager.storages import transfer_process
|
||||||
|
|||||||
@@ -14,7 +14,10 @@ from cryptography.hazmat.primitives import hashes
|
|||||||
|
|
||||||
from app.schemas.file import StorageUsage as _SchemaStorageUsage
|
from app.schemas.file import StorageUsage as _SchemaStorageUsage
|
||||||
from app.schemas.workflow import FileItem as _SchemaFileItem
|
from app.schemas.workflow import FileItem as _SchemaFileItem
|
||||||
from app.runtime.config import settings, global_vars
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
from app.runtime.config import global_vars
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.modules.filemanager import StorageBase
|
from app.modules.filemanager import StorageBase
|
||||||
from app.modules.filemanager.storages import transfer_process
|
from app.modules.filemanager.storages import transfer_process
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ from typing import Optional, List, Tuple
|
|||||||
|
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MediaInfo, MusicInfo
|
from app.domain.context import MediaInfo, MusicInfo
|
||||||
from app.runtime.events import eventmanager
|
from app.runtime.events import eventmanager
|
||||||
from app.domain.meta.metabase import MetaBase
|
from app.domain.meta.metabase import MetaBase
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ from app.domain.meta.metabase import MetaBase
|
|||||||
from app.domain.scraper import MediaScraperHelper
|
from app.domain.scraper import MediaScraperHelper
|
||||||
from app.foundation.text import convert as zhconv_convert
|
from app.foundation.text import convert as zhconv_convert
|
||||||
from app.modules import _ModuleBase
|
from app.modules import _ModuleBase
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.context import MediaCredit, MediaImageSet
|
from app.schemas.context import MediaCredit, MediaImageSet
|
||||||
from app.schemas.media import normalize_media_source
|
from app.schemas.media import normalize_media_source
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ from pydantic import BaseModel, ConfigDict, Field, ValidationError
|
|||||||
|
|
||||||
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
|
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
|
||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|
||||||
TModel = TypeVar("TModel", bound=BaseModel)
|
TModel = TypeVar("TModel", bound=BaseModel)
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ from urllib.parse import urljoin, urlsplit
|
|||||||
|
|
||||||
from requests import Session
|
from requests import Session
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.adapters.network.cloudflare import under_challenge
|
from app.adapters.network.cloudflare import under_challenge
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.adapters.network.http import RequestUtils
|
from app.adapters.network.http import RequestUtils
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ from urllib.parse import urljoin
|
|||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
|
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.adapters.network.http import RequestUtils
|
from app.adapters.network.http import RequestUtils
|
||||||
from app.domain import site as site_rules
|
from app.domain import site as site_rules
|
||||||
from app.foundation import temporal as time_tools
|
from app.foundation import temporal as time_tools
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ from fastapi.concurrency import run_in_threadpool
|
|||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
from pyquery import PyQuery
|
from pyquery import PyQuery
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
from app.adapters.system import rust as rust_accel
|
from app.adapters.system import rust as rust_accel
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import urllib.parse
|
import urllib.parse
|
||||||
from typing import Tuple, List
|
from typing import Tuple, List
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
from typing import Tuple, List, Optional
|
from typing import Tuple, List, Optional
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import re
|
|||||||
from typing import Tuple, List, Optional
|
from typing import Tuple, List, Optional
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import base64
|
|||||||
import json
|
import json
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ import json
|
|||||||
import time
|
import time
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
|
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import re
|
|||||||
from typing import Tuple, List, Optional
|
from typing import Tuple, List, Optional
|
||||||
|
|
||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
|
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
|
||||||
from app.foundation.singleton import SingletonClass
|
from app.foundation.singleton import SingletonClass
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
from typing import List, Tuple, Optional
|
from typing import List, Tuple, Optional
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
|
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import base64
|
|||||||
import json
|
import json
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
|
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ from app.schemas.mediaserver import MediaServerItemUserState as _SchemaMediaServ
|
|||||||
from app.schemas.mediaserver import MediaServerLibrary as _SchemaMediaServerLibrary
|
from app.schemas.mediaserver import MediaServerLibrary as _SchemaMediaServerLibrary
|
||||||
from app.schemas.mediaserver import MediaServerPlayItem as _SchemaMediaServerPlayItem
|
from app.schemas.mediaserver import MediaServerPlayItem as _SchemaMediaServerPlayItem
|
||||||
from app.schemas.mediaserver import WebhookEventInfo as _SchemaWebhookEventInfo
|
from app.schemas.mediaserver import WebhookEventInfo as _SchemaWebhookEventInfo
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.mediaserver import MediaServerIdentityHelper, MusicMediaServerHelper
|
from app.application.mediaserver import MediaServerIdentityHelper, MusicMediaServerHelper
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
from typing import Any, Optional, Tuple, Union
|
from typing import Any, Optional, Tuple, Union
|
||||||
|
|
||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MusicInfo
|
from app.domain.context import MusicInfo
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.modules import _ModuleBase
|
from app.modules import _ModuleBase
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import time
|
|||||||
from typing import Any, Optional, Tuple, Union
|
from typing import Any, Optional, Tuple, Union
|
||||||
|
|
||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MusicInfo, MusicLyrics
|
from app.domain.context import MusicInfo, MusicLyrics
|
||||||
from app.domain.meta.metamusic import MetaMusic
|
from app.domain.meta.metamusic import MetaMusic
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ from typing import Any, Iterable, Optional, Tuple, Union
|
|||||||
from requests import Session
|
from requests import Session
|
||||||
|
|
||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import (
|
from app.domain.context import (
|
||||||
MusicAlbumInfo,
|
MusicAlbumInfo,
|
||||||
MusicArtistInfo,
|
MusicArtistInfo,
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ from time import time
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from app.runtime.cache import FileCache, TTLCache
|
from app.runtime.cache import FileCache, TTLCache
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MusicInfo
|
from app.domain.context import MusicInfo
|
||||||
from app.domain.meta.metamusic import MetaMusic
|
from app.domain.meta.metamusic import MetaMusic
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ from typing import Optional, List, Tuple
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from app.runtime.cache import FileCache
|
from app.runtime.cache import FileCache
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MediaInfo, Context
|
from app.domain.context import MediaInfo, Context
|
||||||
from app.domain.metainfo import MetaInfo
|
from app.domain.metainfo import MetaInfo
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ from slack_bolt import App
|
|||||||
from slack_bolt.adapter.socket_mode import SocketModeHandler
|
from slack_bolt.adapter.socket_mode import SocketModeHandler
|
||||||
from slack_sdk import WebClient
|
from slack_sdk import WebClient
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MediaInfo, Context
|
from app.domain.context import MediaInfo, Context
|
||||||
from app.domain.metainfo import MetaInfo
|
from app.domain.metainfo import MetaInfo
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ from urllib.parse import urljoin, urlparse
|
|||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import Context
|
from app.domain.context import Context
|
||||||
from app.application.site.query import get_configured_site_query_service
|
from app.application.site.query import get_configured_site_query_service
|
||||||
from app.application.site.sites import SitesHelper # pylint: disable=import-error,no-name-in-module
|
from app.application.site.sites import SitesHelper # pylint: disable=import-error,no-name-in-module
|
||||||
|
|||||||
@@ -36,7 +36,9 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from telegramify_markdown.type import ContentTypes, File, Photo, Text # noqa: E402
|
from telegramify_markdown.type import ContentTypes, File, Photo, Text # noqa: E402
|
||||||
|
|
||||||
from app.runtime.config import settings # noqa: E402
|
from app.runtime.settings import RuntimeSettingsCompat # noqa: E402
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MediaInfo, Context # noqa: E402
|
from app.domain.context import MediaInfo, Context # noqa: E402
|
||||||
from app.domain.metainfo import MetaInfo # noqa: E402
|
from app.domain.metainfo import MetaInfo # noqa: E402
|
||||||
from app.application.image import ImageHelper # noqa: E402
|
from app.application.image import ImageHelper # noqa: E402
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
from typing import Any, Optional, Tuple, Union
|
from typing import Any, Optional, Tuple, Union
|
||||||
|
|
||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import (
|
from app.domain.context import (
|
||||||
MusicAlbumInfo,
|
MusicAlbumInfo,
|
||||||
MusicArtistInfo,
|
MusicArtistInfo,
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import cn2an
|
|||||||
from app.schemas.context import MediaPerson as _SchemaMediaPerson
|
from app.schemas.context import MediaPerson as _SchemaMediaPerson
|
||||||
from app.schemas.tmdb import TmdbSeason as _SchemaTmdbSeason
|
from app.schemas.tmdb import TmdbSeason as _SchemaTmdbSeason
|
||||||
from app.schemas.tmdb import TmdbEpisode as _SchemaTmdbEpisode
|
from app.schemas.tmdb import TmdbEpisode as _SchemaTmdbEpisode
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MediaInfo
|
from app.domain.context import MediaInfo
|
||||||
from app.domain.meta.metabase import MetaBase
|
from app.domain.meta.metabase import MetaBase
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ from typing import Union
|
|||||||
import ruamel.yaml
|
import ruamel.yaml
|
||||||
from ruamel.yaml import CommentedMap
|
from ruamel.yaml import CommentedMap
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.category import CategoryConfig
|
from app.schemas.category import CategoryConfig
|
||||||
from app.foundation.singleton import WeakSingleton
|
from app.foundation.singleton import WeakSingleton
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ from pathlib import Path
|
|||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MediaInfo
|
from app.domain.context import MediaInfo
|
||||||
from app.domain.meta.metabase import MetaBase
|
from app.domain.meta.metabase import MetaBase
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ from time import time
|
|||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from app.runtime.cache import FileCache, TTLCache
|
from app.runtime.cache import FileCache, TTLCache
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.meta.metabase import MetaBase
|
from app.domain.meta.metabase import MetaBase
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import MediaSource, MediaType
|
from app.schemas.types import MediaSource, MediaType
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import re
|
|||||||
import traceback
|
import traceback
|
||||||
from typing import Optional, List
|
from typing import Optional, List
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
from app.foundation import text as text_tools
|
from app.foundation import text as text_tools
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from ..tmdb import TMDb
|
from ..tmdb import TMDb
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ import requests
|
|||||||
import requests.exceptions
|
import requests.exceptions
|
||||||
|
|
||||||
from app.runtime.cache import cached, fresh, async_fresh
|
from app.runtime.cache import cached, fresh, async_fresh
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
|
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
|
||||||
from .exceptions import TMDbException, TMDbConnectionError
|
from .exceptions import TMDbException, TMDbConnectionError
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
from threading import Lock
|
from threading import Lock
|
||||||
from typing import Optional, Tuple, Union
|
from typing import Optional, Tuple, Union
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.modules import _ModuleBase
|
from app.modules import _ModuleBase
|
||||||
from app.modules.thetvdb import tvdb_v4_official
|
from app.modules.thetvdb import tvdb_v4_official
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ import urllib.parse
|
|||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
from app.runtime.cache import cached
|
from app.runtime.cache import cached
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.adapters.network.http import RequestUtils
|
from app.adapters.network.http import RequestUtils
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ from enum import Enum
|
|||||||
from typing import List, Optional, Union
|
from typing import List, Optional, Union
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.adapters.network.http import RequestUtils, requests
|
from app.adapters.network.http import RequestUtils, requests
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ from typing import Union, Tuple
|
|||||||
|
|
||||||
from pywebpush import webpush, WebPushException
|
from pywebpush import webpush, WebPushException
|
||||||
|
|
||||||
from app.runtime.config import global_vars, settings
|
from app.runtime.config import global_vars
|
||||||
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.modules import _ModuleBase, _MessageBase
|
from app.modules import _ModuleBase, _MessageBase
|
||||||
from app.schemas.message import Message
|
from app.schemas.message import Message
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ import websocket
|
|||||||
from Crypto.Cipher import AES
|
from Crypto.Cipher import AES
|
||||||
|
|
||||||
from app.runtime.cache import FileCache
|
from app.runtime.cache import FileCache
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import MediaInfo, Context
|
from app.domain.context import MediaInfo, Context
|
||||||
from app.domain.metainfo import MetaInfo
|
from app.domain.metainfo import MetaInfo
|
||||||
from app.application.messaging.agent import matches_channel_admin
|
from app.application.messaging.agent import matches_channel_admin
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ from Crypto.Cipher import AES
|
|||||||
from Crypto.Util.Padding import pad
|
from Crypto.Util.Padding import pad
|
||||||
|
|
||||||
from app.runtime.cache import FileCache
|
from app.runtime.cache import FileCache
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.domain.context import Context, MediaInfo
|
from app.domain.context import Context, MediaInfo
|
||||||
from app.domain.metainfo import MetaInfo
|
from app.domain.metainfo import MetaInfo
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ from app.runtime.capabilities.model import (
|
|||||||
SelectorSchema,
|
SelectorSchema,
|
||||||
)
|
)
|
||||||
from app.runtime.capabilities.registry import CapabilityRegistry
|
from app.runtime.capabilities.registry import CapabilityRegistry
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.extensions.service_config import ServiceConfigHelper
|
from app.runtime.extensions.service_config import ServiceConfigHelper
|
||||||
from app.schemas.types import (
|
from app.schemas.types import (
|
||||||
DownloaderType,
|
DownloaderType,
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ from app.runtime.capabilities.model import (
|
|||||||
CapabilitySpec,
|
CapabilitySpec,
|
||||||
)
|
)
|
||||||
from app.runtime.capabilities.runtime import CapabilityRuntime
|
from app.runtime.capabilities.runtime import CapabilityRuntime
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.events import Event, EventHandlerBinding, eventmanager
|
from app.runtime.events import Event, EventHandlerBinding, eventmanager
|
||||||
from app.runtime.extensions.host_module_adapter import (
|
from app.runtime.extensions.host_module_adapter import (
|
||||||
HOST_MODULE_KIND,
|
HOST_MODULE_KIND,
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ from collections.abc import Callable, Mapping
|
|||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from app.foundation.version import compare_version
|
from app.foundation.version import compare_version
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.extensions.plugin.contracts import supports_plugin_hook
|
from app.runtime.extensions.plugin.contracts import supports_plugin_hook
|
||||||
from app.runtime.extensions.plugin.storage import PluginStorage
|
from app.runtime.extensions.plugin.storage import PluginStorage
|
||||||
from app.runtime.extensions.plugin.system import PluginSystemServices
|
from app.runtime.extensions.plugin.system import PluginSystemServices
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ from app.foundation.singleton import Singleton
|
|||||||
from app.foundation.version import compare_version
|
from app.foundation.version import compare_version
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.runtime.observability import observe_compat_facade
|
from app.runtime.observability import observe_compat_facade
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.events import EventHandlerBinding, eventmanager
|
from app.runtime.events import EventHandlerBinding, eventmanager
|
||||||
from app.runtime.reload import ConfigReloadMixin
|
from app.runtime.reload import ConfigReloadMixin
|
||||||
from app.runtime.extensions.plugin.loader import PluginLoader
|
from app.runtime.extensions.plugin.loader import PluginLoader
|
||||||
|
|||||||
+44
-6
@@ -9,24 +9,63 @@ from typing import Any
|
|||||||
|
|
||||||
RuntimeSettingProvider = Callable[[str], Any]
|
RuntimeSettingProvider = Callable[[str], Any]
|
||||||
_provider: RuntimeSettingProvider | None = None
|
_provider: RuntimeSettingProvider | None = None
|
||||||
|
_runtime_settings_service: Any | None = None
|
||||||
|
# 测试和插件可能临时替换某个模块上的 importlib.import_module;保存原始函数,
|
||||||
|
# 让兼容代理的 legacy Settings 解析不受这类局部替身影响。
|
||||||
|
_import_module = importlib.import_module
|
||||||
|
|
||||||
|
|
||||||
class RuntimeSettingsCompat:
|
class RuntimeSettingsCompat:
|
||||||
"""为旧模块级 Settings 访问提供动态 runtime 配置代理。"""
|
"""为旧模块级 Settings 访问提供动态 runtime 配置代理。"""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _legacy_settings() -> Any:
|
||||||
|
"""返回旧 Settings 实例,供 runtime 尚未装配时的兼容回退使用。"""
|
||||||
|
return _import_module("app.runtime.config").settings
|
||||||
|
|
||||||
def __getattr__(self, key: str) -> Any:
|
def __getattr__(self, key: str) -> Any:
|
||||||
"""读取当前组合根配置;未装配时沿用旧 Settings 回退。"""
|
"""读取当前组合根配置;未装配时沿用旧 Settings 回退。"""
|
||||||
return get_runtime_setting(key)
|
return get_runtime_setting(key)
|
||||||
|
|
||||||
def __setattr__(self, key: str, value: Any) -> None:
|
def __setattr__(self, key: str, value: Any) -> None:
|
||||||
"""把旧模块级覆盖同步到 legacy Settings,保持测试和插件注入语义。"""
|
"""把旧模块级覆盖同步到 legacy Settings,保持测试和插件注入语义。"""
|
||||||
legacy_settings = importlib.import_module("app.runtime.config").settings
|
setattr(self._legacy_settings(), key, value)
|
||||||
setattr(legacy_settings, key, value)
|
|
||||||
|
|
||||||
def __delattr__(self, key: str) -> None:
|
def __delattr__(self, key: str) -> None:
|
||||||
"""删除旧模块级覆盖,使配置对象恢复其原有属性解析。"""
|
"""删除旧模块级覆盖,使配置对象恢复其原有属性解析。"""
|
||||||
legacy_settings = importlib.import_module("app.runtime.config").settings
|
delattr(self._legacy_settings(), key)
|
||||||
delattr(legacy_settings, key)
|
|
||||||
|
def model_dump(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
include: set[str] | None = None,
|
||||||
|
exclude: set[str] | None = None,
|
||||||
|
**kwargs: Any,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
"""导出当前配置快照,保留旧 Settings 的序列化入口。"""
|
||||||
|
if _runtime_settings_service is not None:
|
||||||
|
return _runtime_settings_service.snapshot(include=include, exclude=exclude)
|
||||||
|
return self._legacy_settings().model_dump(
|
||||||
|
include=include, exclude=exclude, **kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
def update_setting(self, key: str, value: Any) -> tuple[Any, str]:
|
||||||
|
"""更新单项配置,兼容插件对模块级 Settings 的公开调用。"""
|
||||||
|
if _runtime_settings_service is not None:
|
||||||
|
return _runtime_settings_service.update(key, value)
|
||||||
|
return self._legacy_settings().update_setting(key, value)
|
||||||
|
|
||||||
|
def update_settings(self, env: dict[str, Any]) -> dict[str, tuple[Any, str]]:
|
||||||
|
"""批量更新配置,兼容旧 Settings 的管理接口。"""
|
||||||
|
if _runtime_settings_service is not None:
|
||||||
|
return _runtime_settings_service.update_many(env)
|
||||||
|
return self._legacy_settings().update_settings(env=env)
|
||||||
|
|
||||||
|
|
||||||
|
def configure_runtime_settings_compat(service: Any) -> None:
|
||||||
|
"""由应用组合根注入可变配置服务,避免低层代理反向导入应用层。"""
|
||||||
|
global _runtime_settings_service
|
||||||
|
_runtime_settings_service = service
|
||||||
|
|
||||||
|
|
||||||
def configure_runtime_setting_provider(provider: RuntimeSettingProvider) -> None:
|
def configure_runtime_setting_provider(provider: RuntimeSettingProvider) -> None:
|
||||||
@@ -39,5 +78,4 @@ def get_runtime_setting(key: str) -> Any:
|
|||||||
"""读取单项运行配置;启动早期未装配时回退旧 Settings ABI。"""
|
"""读取单项运行配置;启动早期未装配时回退旧 Settings ABI。"""
|
||||||
if _provider is not None:
|
if _provider is not None:
|
||||||
return _provider(key)
|
return _provider(key)
|
||||||
legacy_settings = importlib.import_module("app.runtime.config").settings
|
return getattr(RuntimeSettingsCompat._legacy_settings(), key)
|
||||||
return getattr(legacy_settings, key)
|
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ from typing import Optional, Tuple
|
|||||||
import docker
|
import docker
|
||||||
import psutil
|
import psutil
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.runtime.reload import ConfigReloadMixin
|
from app.runtime.reload import ConfigReloadMixin
|
||||||
from app.foundation.environment import is_docker
|
from app.foundation.environment import is_docker
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from contextvars import copy_context
|
from contextvars import copy_context
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.foundation.singleton import Singleton
|
from app.foundation.singleton import Singleton
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ from app.agent.runtime_loader import (
|
|||||||
from app.agent.llm.gateway import register_llm_provider_runtime
|
from app.agent.llm.gateway import register_llm_provider_runtime
|
||||||
from app.application.agent import register_agent_service_providers
|
from app.application.agent import register_agent_service_providers
|
||||||
from app.application.messaging.skill import register_skill_catalog_provider
|
from app.application.messaging.skill import register_skill_catalog_provider
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.events import Event, eventmanager
|
from app.runtime.events import Event, eventmanager
|
||||||
from app.runtime.log import logger
|
from app.runtime.log import logger
|
||||||
from app.schemas.types import EventType
|
from app.schemas.types import EventType
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ from app.db.engine import get_engine
|
|||||||
from app.db.health import probe_database
|
from app.db.health import probe_database
|
||||||
from app.db.maintenance import DatabaseCleanupRepository
|
from app.db.maintenance import DatabaseCleanupRepository
|
||||||
from app.db.session import SessionFactory
|
from app.db.session import SessionFactory
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
|
|
||||||
|
|
||||||
def build_database_governance() -> DatabaseGovernance:
|
def build_database_governance() -> DatabaseGovernance:
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ from alembic.util import CommandError
|
|||||||
from sqlalchemy import inspect
|
from sqlalchemy import inspect
|
||||||
from sqlalchemy.engine import Engine
|
from sqlalchemy.engine import Engine
|
||||||
|
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.db.base import Base
|
from app.db.base import Base
|
||||||
from app.db.engine import get_engine
|
from app.db.engine import get_engine
|
||||||
from app.db.models import load_all_models
|
from app.db.models import load_all_models
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ from app.domain.meta.runtime import configure_recognition_runtime
|
|||||||
from app.domain.meta.words import configure_custom_words_provider
|
from app.domain.meta.words import configure_custom_words_provider
|
||||||
from app.domain.metainfo import clear_rust_parse_options_cache
|
from app.domain.metainfo import clear_rust_parse_options_cache
|
||||||
from app.adapters.system import rust as rust_accelerator
|
from app.adapters.system import rust as rust_accelerator
|
||||||
from app.runtime.config import settings
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.application.recognition import RecognitionRuleService
|
from app.application.recognition import RecognitionRuleService
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ except Exception:
|
|||||||
|
|
||||||
from app.chain.system import SystemChain
|
from app.chain.system import SystemChain
|
||||||
from app.application.plugin.runtime import get_plugin_manager
|
from app.application.plugin.runtime import get_plugin_manager
|
||||||
from app.runtime.config import global_vars, settings
|
from app.runtime.config import global_vars
|
||||||
|
from app.runtime.settings import RuntimeSettingsCompat
|
||||||
|
|
||||||
|
settings = RuntimeSettingsCompat()
|
||||||
from app.runtime.health import get_application_health
|
from app.runtime.health import get_application_health
|
||||||
from app.runtime.topology import validate_process_topology
|
from app.runtime.topology import validate_process_topology
|
||||||
from app.adapters.external.server import MoviePilotServerHelper
|
from app.adapters.external.server import MoviePilotServerHelper
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user