mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-01 05:27:02 +08:00
refactor: migrate rss helper configuration
This commit is contained in:
@@ -148,6 +148,8 @@ class ChainRuntimeConfig:
|
||||
media_recognize_share: bool = False
|
||||
auxiliary_auth_enable: bool = False
|
||||
global_image_cache: bool = False
|
||||
encoding_detection_performance_mode: bool = False
|
||||
encoding_detection_min_confidence: float = 0.5
|
||||
download_subtitle: bool = True
|
||||
music_metadata_to_simplified: bool = True
|
||||
recognize_plugin_first: bool = False
|
||||
|
||||
@@ -5,7 +5,7 @@ from urllib.parse import urljoin, urlparse
|
||||
import dateutil.parser
|
||||
from lxml import etree
|
||||
|
||||
from app.runtime.config import settings
|
||||
from app.application.configuration import get_chain_runtime_config_snapshot
|
||||
from app.adapters.network.browser import PlaywrightHelper
|
||||
from app.runtime.log import logger
|
||||
from app.adapters.system import rust as rust_accel
|
||||
@@ -279,8 +279,9 @@ class RssHelper:
|
||||
return False
|
||||
|
||||
try:
|
||||
config = get_chain_runtime_config_snapshot()
|
||||
ret = RequestUtils(ua=ua,
|
||||
proxies=settings.PROXY if proxy else None,
|
||||
proxies=config.proxy if proxy else None,
|
||||
timeout=timeout or 30, headers=headers).get_res(url)
|
||||
if not ret:
|
||||
logger.error(f"获取RSS失败:请求返回空值,URL: {url}")
|
||||
@@ -306,8 +307,8 @@ class RssHelper:
|
||||
if raw_data:
|
||||
ret_xml = RequestUtils.get_decoded_xml_content(
|
||||
ret,
|
||||
performance_mode=settings.ENCODING_DETECTION_PERFORMANCE_MODE,
|
||||
confidence_threshold=settings.ENCODING_DETECTION_MIN_CONFIDENCE
|
||||
performance_mode=config.encoding_detection_performance_mode,
|
||||
confidence_threshold=config.encoding_detection_min_confidence
|
||||
)
|
||||
rust_items = self.__parse_with_rust(ret_xml)
|
||||
if rust_items is not None:
|
||||
@@ -494,7 +495,7 @@ class RssHelper:
|
||||
url=rss_url,
|
||||
cookies=cookie,
|
||||
ua=ua,
|
||||
proxies=settings.PROXY_SERVER if proxy else None,
|
||||
proxies=get_chain_runtime_config_snapshot().proxy_server if proxy else None,
|
||||
timeout=timeout or 60
|
||||
)
|
||||
else:
|
||||
@@ -502,7 +503,7 @@ class RssHelper:
|
||||
cookies=cookie,
|
||||
timeout=timeout or 30,
|
||||
ua=ua,
|
||||
proxies=settings.PROXY if proxy else None
|
||||
proxies=get_chain_runtime_config_snapshot().proxy if proxy else None
|
||||
).post_res(url=rss_url, data=rss_params)
|
||||
if res:
|
||||
html_text = res.text
|
||||
|
||||
@@ -95,6 +95,8 @@ def build_chain_runtime_config(settings: Settings) -> ChainRuntimeConfig:
|
||||
media_recognize_share=settings.MEDIA_RECOGNIZE_SHARE,
|
||||
auxiliary_auth_enable=settings.AUXILIARY_AUTH_ENABLE,
|
||||
global_image_cache=settings.GLOBAL_IMAGE_CACHE,
|
||||
encoding_detection_performance_mode=settings.ENCODING_DETECTION_PERFORMANCE_MODE,
|
||||
encoding_detection_min_confidence=settings.ENCODING_DETECTION_MIN_CONFIDENCE,
|
||||
download_subtitle=settings.DOWNLOAD_SUBTITLE,
|
||||
music_metadata_to_simplified=settings.MUSIC_METADATA_TO_SIMPLIFIED,
|
||||
recognize_plugin_first=settings.RECOGNIZE_PLUGIN_FIRST,
|
||||
|
||||
@@ -978,6 +978,7 @@ Outbox adapter、DB 装饰器、Base 与 UoW,strict 清单扩大到 37 个源
|
||||
`ChainRuntimeConfig`,canonical `settings` 直接读取文件数从 137 降至 136;配置/依赖基线已更新,壁纸与图片专项测试通过。
|
||||
随后将 `app/application/torrent.py` 的代理和媒体后缀读取迁移到同一快照,canonical 配置债务进一步降至 134 个文件;
|
||||
下载/种子专项测试与架构门禁通过。
|
||||
`app/application/rss.py` 的代理和编码检测选项也已迁移到快照,配置债务降至 133 个文件;RSS、Rust 解析和音乐资源专项测试通过。
|
||||
|
||||
#### ARCH-272:异步阻塞检测
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"root": "app"
|
||||
},
|
||||
"settings_imports": {
|
||||
"count": 134,
|
||||
"count": 133,
|
||||
"files": [
|
||||
"app/adapters/cache/backends.py",
|
||||
"app/adapters/cache/redis.py",
|
||||
@@ -48,7 +48,6 @@
|
||||
"app/agent/tools/impl/update_agent_task.py",
|
||||
"app/agent/tools/impl/update_system_settings.py",
|
||||
"app/application/maintenance.py",
|
||||
"app/application/rss.py",
|
||||
"app/application/security/auth.py",
|
||||
"app/application/security/passkey.py",
|
||||
"app/application/security/token.py",
|
||||
|
||||
+4
-3
@@ -13,8 +13,8 @@
|
||||
"runtime_to_db": [],
|
||||
"workflow_to_db": []
|
||||
},
|
||||
"edge_count": 6396,
|
||||
"edge_sha256": "343715ec8f599f096a45de0dd279d493e7eea7bcde70079f0df0446019578073",
|
||||
"edge_count": 6397,
|
||||
"edge_sha256": "7d10fe3157a2e2e0de2b8e7caf0edbbbb1c8302a58c9faf78812dba8a19e2d7a",
|
||||
"edges": [
|
||||
"app -> app.runtime",
|
||||
"app -> app.runtime.compat",
|
||||
@@ -2647,8 +2647,9 @@
|
||||
"app.application.rss -> app.adapters.network.http",
|
||||
"app.application.rss -> app.adapters.system",
|
||||
"app.application.rss -> app.adapters.system.rust",
|
||||
"app.application.rss -> app.application",
|
||||
"app.application.rss -> app.application.configuration",
|
||||
"app.application.rss -> app.runtime",
|
||||
"app.application.rss -> app.runtime.config",
|
||||
"app.application.rss -> app.runtime.log",
|
||||
"app.application.rules -> app.adapters",
|
||||
"app.application.rules -> app.adapters.system",
|
||||
|
||||
Reference in New Issue
Block a user