refactor: route media source settings through runtime

This commit is contained in:
jxxghp
2026-08-23 03:20:03 +08:00
parent 061a92eab0
commit c89066d96f
13 changed files with 44 additions and 32 deletions
+3 -1
View File
@@ -6,7 +6,9 @@ import cn2an
from app.schemas.context import MediaPerson as _SchemaMediaPerson
from app.schemas.tmdb import TmdbSeason as _SchemaTmdbSeason
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.meta.metabase import MetaBase
from app.runtime.log import logger
+3 -1
View File
@@ -5,7 +5,9 @@ from typing import Union
import ruamel.yaml
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.schemas.category import CategoryConfig
from app.foundation.singleton import WeakSingleton
+3 -1
View File
@@ -2,7 +2,9 @@ from pathlib import Path
from typing import Optional, Tuple
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.meta.metabase import MetaBase
from app.schemas.types import MediaType
+3 -1
View File
@@ -6,7 +6,9 @@ from time import time
from typing import Any, Optional
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.runtime.log import logger
from app.schemas.types import MediaSource, MediaType
+3 -1
View File
@@ -2,7 +2,9 @@ import re
import traceback
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.schemas.types import MediaType
from app.foundation import text as text_tools
@@ -1,5 +1,7 @@
from app.runtime.cache import cached
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from ..tmdb import TMDb
try:
+3 -1
View File
@@ -10,7 +10,9 @@ import requests
import requests.exceptions
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 .exceptions import TMDbException, TMDbConnectionError
+3 -1
View File
@@ -1,7 +1,9 @@
from threading import Lock
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.modules import _ModuleBase
from app.modules.thetvdb import tvdb_v4_official
+3 -1
View File
@@ -8,7 +8,9 @@ import urllib.parse
from http import HTTPStatus
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
+3 -1
View File
@@ -7,7 +7,9 @@ from enum import Enum
from typing import List, Optional, Union
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.adapters.network.http import RequestUtils, requests
@@ -1068,6 +1068,8 @@ Indexer parser/spider 模块族切换到动态运行时配置,站点搜索 URL
降至 39 个,Indexer 专项测试通过。
QQ、Telegram、WeChat、WeChatClawBot 与字幕模块切换到动态运行时配置,消息回调、代理和字幕下载行为保持;
配置债务由 39 个文件降至 34 个,消息与字幕专项测试通过。
TMDB、TVDB 与 TriMedia 模块切换到动态运行时配置,缓存、重试、媒体源和登录兼容行为保持;配置债务由 34 个
文件降至 24 个,TMDB、媒体源与 TriMedia 专项测试通过。
同日修正适配器配置下沉边界:OCR、CookieCloud、DoH、Rust 和资源签名等低层实现不再直接依赖
`app.application`,由 `app.runtime.settings` 端口承接组合根注入;未启动装配时仍回退旧 Settings ABI
@@ -9,7 +9,7 @@
"root": "app"
},
"settings_imports": {
"count": 34,
"count": 24,
"files": [
"app/adapters/system/fsproxy.py",
"app/cli.py",
@@ -25,17 +25,7 @@
"app/modules/qbittorrent/__init__.py",
"app/modules/redis/__init__.py",
"app/modules/rtorrent/__init__.py",
"app/modules/themoviedb/__init__.py",
"app/modules/themoviedb/category.py",
"app/modules/themoviedb/scraper.py",
"app/modules/themoviedb/tmdb_cache.py",
"app/modules/themoviedb/tmdbapi.py",
"app/modules/themoviedb/tmdbv3api/objs/discover.py",
"app/modules/themoviedb/tmdbv3api/tmdb.py",
"app/modules/thetvdb/__init__.py",
"app/modules/thetvdb/tvdb_v4_official.py",
"app/modules/transmission/__init__.py",
"app/modules/trimemedia/api.py",
"app/modules/webpush/__init__.py",
"app/runtime/extensions/host_module_adapter.py",
"app/startup/agent_initializer.py",
+11 -11
View File
@@ -14,7 +14,7 @@
"workflow_to_db": []
},
"edge_count": 6425,
"edge_sha256": "41afc9f5275b7f406e8ab4dd240d9af5bd01dd2e7537431e221558db2b9e593e",
"edge_sha256": "4d0424aeaa643346981710c4533b4cf546cf07a0d1cb9642707369c60afc4e39",
"edges": [
"app -> app.runtime",
"app -> app.runtime.compat",
@@ -4961,8 +4961,8 @@
"app.modules.themoviedb -> app.modules.themoviedb.tmdbv3api",
"app.modules.themoviedb -> app.modules.themoviedb.tmdbv3api.exceptions",
"app.modules.themoviedb -> app.runtime",
"app.modules.themoviedb -> app.runtime.config",
"app.modules.themoviedb -> app.runtime.log",
"app.modules.themoviedb -> app.runtime.settings",
"app.modules.themoviedb -> app.schemas",
"app.modules.themoviedb -> app.schemas.category",
"app.modules.themoviedb -> app.schemas.context",
@@ -4972,8 +4972,8 @@
"app.modules.themoviedb.category -> app.foundation",
"app.modules.themoviedb.category -> app.foundation.singleton",
"app.modules.themoviedb.category -> app.runtime",
"app.modules.themoviedb.category -> app.runtime.config",
"app.modules.themoviedb.category -> app.runtime.log",
"app.modules.themoviedb.category -> app.runtime.settings",
"app.modules.themoviedb.category -> app.schemas",
"app.modules.themoviedb.category -> app.schemas.category",
"app.modules.themoviedb.scraper -> app.domain",
@@ -4986,7 +4986,7 @@
"app.modules.themoviedb.scraper -> app.modules.themoviedb",
"app.modules.themoviedb.scraper -> app.modules.themoviedb.tmdbapi",
"app.modules.themoviedb.scraper -> app.runtime",
"app.modules.themoviedb.scraper -> app.runtime.config",
"app.modules.themoviedb.scraper -> app.runtime.settings",
"app.modules.themoviedb.scraper -> app.schemas",
"app.modules.themoviedb.scraper -> app.schemas.types",
"app.modules.themoviedb.tmdb_cache -> app.domain",
@@ -4996,8 +4996,8 @@
"app.modules.themoviedb.tmdb_cache -> app.foundation.singleton",
"app.modules.themoviedb.tmdb_cache -> app.runtime",
"app.modules.themoviedb.tmdb_cache -> app.runtime.cache",
"app.modules.themoviedb.tmdb_cache -> app.runtime.config",
"app.modules.themoviedb.tmdb_cache -> app.runtime.log",
"app.modules.themoviedb.tmdb_cache -> app.runtime.settings",
"app.modules.themoviedb.tmdb_cache -> app.schemas",
"app.modules.themoviedb.tmdb_cache -> app.schemas.types",
"app.modules.themoviedb.tmdbapi -> app.foundation",
@@ -5007,8 +5007,8 @@
"app.modules.themoviedb.tmdbapi -> app.modules.themoviedb.tmdbv3api",
"app.modules.themoviedb.tmdbapi -> app.modules.themoviedb.tmdbv3api.exceptions",
"app.modules.themoviedb.tmdbapi -> app.runtime",
"app.modules.themoviedb.tmdbapi -> app.runtime.config",
"app.modules.themoviedb.tmdbapi -> app.runtime.log",
"app.modules.themoviedb.tmdbapi -> app.runtime.settings",
"app.modules.themoviedb.tmdbapi -> app.schemas",
"app.modules.themoviedb.tmdbapi -> app.schemas.types",
"app.modules.themoviedb.tmdbv3api -> app.modules",
@@ -5080,7 +5080,7 @@
"app.modules.themoviedb.tmdbv3api.objs.discover -> app.modules.themoviedb.tmdbv3api.tmdb",
"app.modules.themoviedb.tmdbv3api.objs.discover -> app.runtime",
"app.modules.themoviedb.tmdbv3api.objs.discover -> app.runtime.cache",
"app.modules.themoviedb.tmdbv3api.objs.discover -> app.runtime.config",
"app.modules.themoviedb.tmdbv3api.objs.discover -> app.runtime.settings",
"app.modules.themoviedb.tmdbv3api.objs.episode -> app.modules",
"app.modules.themoviedb.tmdbv3api.objs.episode -> app.modules.themoviedb",
"app.modules.themoviedb.tmdbv3api.objs.episode -> app.modules.themoviedb.tmdbv3api",
@@ -5150,12 +5150,12 @@
"app.modules.themoviedb.tmdbv3api.tmdb -> app.modules.themoviedb.tmdbv3api.exceptions",
"app.modules.themoviedb.tmdbv3api.tmdb -> app.runtime",
"app.modules.themoviedb.tmdbv3api.tmdb -> app.runtime.cache",
"app.modules.themoviedb.tmdbv3api.tmdb -> app.runtime.config",
"app.modules.themoviedb.tmdbv3api.tmdb -> app.runtime.settings",
"app.modules.thetvdb -> app.modules",
"app.modules.thetvdb -> app.modules.thetvdb.tvdb_v4_official",
"app.modules.thetvdb -> app.runtime",
"app.modules.thetvdb -> app.runtime.config",
"app.modules.thetvdb -> app.runtime.log",
"app.modules.thetvdb -> app.runtime.settings",
"app.modules.thetvdb -> app.schemas",
"app.modules.thetvdb -> app.schemas.types",
"app.modules.thetvdb.tvdb_v4_official -> app.adapters",
@@ -5163,7 +5163,7 @@
"app.modules.thetvdb.tvdb_v4_official -> app.adapters.network.http",
"app.modules.thetvdb.tvdb_v4_official -> app.runtime",
"app.modules.thetvdb.tvdb_v4_official -> app.runtime.cache",
"app.modules.thetvdb.tvdb_v4_official -> app.runtime.config",
"app.modules.thetvdb.tvdb_v4_official -> app.runtime.settings",
"app.modules.transmission -> app.domain",
"app.modules.transmission -> app.domain.metainfo",
"app.modules.transmission -> app.foundation",
@@ -5187,8 +5187,8 @@
"app.modules.trimemedia.api -> app.adapters.network",
"app.modules.trimemedia.api -> app.adapters.network.http",
"app.modules.trimemedia.api -> app.runtime",
"app.modules.trimemedia.api -> app.runtime.config",
"app.modules.trimemedia.api -> app.runtime.log",
"app.modules.trimemedia.api -> app.runtime.settings",
"app.modules.trimemedia.module -> app.modules",
"app.modules.trimemedia.module -> app.modules._base",
"app.modules.trimemedia.module -> app.modules.trimemedia",