From b0a842ea0fee7beb998b40e62ee24881aa069c5c Mon Sep 17 00:00:00 2001 From: warzook Date: Wed, 18 Nov 2026 11:16:12 +0800 Subject: [PATCH 1/2] fix: map hddolby hr flag to hit_and_run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HDDolby 搜索接口每条记录带 hr 字段(0/1),但适配器组装通用种子字典时未输出 hit_and_run,导致浏览资源时前端不显示 H&R 标签、刷流插件与下载通知的 H&R 判断 始终为否。按站点接口语义把 hr 映射为 hit_and_run,并复用文本工具的布尔解析以 兼容数值、字符串与字段缺失。 --- app/modules/indexer/spider/hddolby.py | 2 ++ tests/test_hddolby_spider.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/app/modules/indexer/spider/hddolby.py b/app/modules/indexer/spider/hddolby.py index acca30046..8db2ee69f 100644 --- a/app/modules/indexer/spider/hddolby.py +++ b/app/modules/indexer/spider/hddolby.py @@ -8,6 +8,7 @@ from urllib.parse import urlparse from app.adapters.network.http import AsyncRequestUtils, RequestUtils from app.application.configuration import get_configured_system_config from app.domain import site as site_rules +from app.foundation import text as text_tools from app.runtime.log import logger from app.runtime.settings import get_runtime_setting from app.schemas.types import MediaType @@ -196,6 +197,7 @@ class HddolbySpider: 'freedate': result.get('promotion_until'), 'page_url': self._pageurl % result.get('id') if self._pageurl else '', 'labels': torrentLabels, + 'hit_and_run': text_tools.parse_bool(result.get('hr')), 'category': category } torrents.append(torrent) diff --git a/tests/test_hddolby_spider.py b/tests/test_hddolby_spider.py index 304878830..a7ae36909 100644 --- a/tests/test_hddolby_spider.py +++ b/tests/test_hddolby_spider.py @@ -76,6 +76,20 @@ def test_parse_result_marks_music_torrents(hddolby_spider): ] +def test_parse_result_maps_hit_and_run(hddolby_spider): + """ + hr 标记应映射为 hit_and_run,兼容数值、字符串和缺失字段。 + """ + results = hddolby_spider._HddolbySpider__parse_result([ + {"id": 1, "name": "The Odyssey 2026 2160p", "category": 401, "size": 1024, "hr": 1}, + {"id": 2, "name": "Example Movie 1080p", "category": 401, "size": 1024, "hr": 0}, + {"id": 3, "name": "Example TV 1080p", "category": 402, "size": 1024, "hr": "1"}, + {"id": 4, "name": "Example TV 2160p", "category": 402, "size": 1024}, + ]) + + assert [torrent["hit_and_run"] for torrent in results] == [True, False, True, False] + + @pytest.mark.parametrize("asynchronous", [False, True]) @pytest.mark.parametrize( ("domain", "api_url", "expected_url"), From 183c8d514b77ef06ce55414944caf16a97a65706 Mon Sep 17 00:00:00 2001 From: zhuek Date: Wed, 18 Nov 2026 11:35:30 +0800 Subject: [PATCH 2/2] test: sync host architecture baseline with hddolby import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 复用 app.foundation.text.parse_bool 后新增 app.modules.indexer.spider.hddolby -> app.foundation(.text) 两条内部导入边,按 architecture 门禁要求刷新依赖基线, 并同步 docs/architecture-overview.md 的依赖边数(10,329 -> 10,331)。 --- docs/architecture-overview.md | 2 +- tests/fixtures/architecture/dependency-baseline.json | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/architecture-overview.md b/docs/architecture-overview.md index fddb28f09..2fd8c2369 100644 --- a/docs/architecture-overview.md +++ b/docs/architecture-overview.md @@ -851,7 +851,7 @@ flowchart LR | 指标 | 当前值 | |---|---:| | Python 模块 | 1178 | -| 内部导入边 | 10,333 | +| 内部导入边 | 10,335 | | 非平凡 SCC | 1(29 个模块的 TMDB vendor 精确 containment) | | Application / Chain 具体 Adapter 直连 | 0 / 0 | | Direct egress | 51(精确 policy 准入,Application / Chain 均为 0) | diff --git a/tests/fixtures/architecture/dependency-baseline.json b/tests/fixtures/architecture/dependency-baseline.json index f48024add..05543008f 100644 --- a/tests/fixtures/architecture/dependency-baseline.json +++ b/tests/fixtures/architecture/dependency-baseline.json @@ -977,8 +977,8 @@ "runtime_only": true } }, - "edge_count": 10333, - "edge_sha256": "2fcd2139eeb96786c233172e5529094016404aaf87bd15711174c65dea2eb066", + "edge_count": 10335, + "edge_sha256": "5718f6bd1f1f823a40222a7695ea32056aea169e5082271da7ccc39d4d3cf198", "edges": [ "app -> app.foundation", "app -> app.foundation.environment", @@ -8369,6 +8369,8 @@ "app.modules.indexer.spider.hddolby -> app.application.configuration", "app.modules.indexer.spider.hddolby -> app.domain", "app.modules.indexer.spider.hddolby -> app.domain.site", + "app.modules.indexer.spider.hddolby -> app.foundation", + "app.modules.indexer.spider.hddolby -> app.foundation.text", "app.modules.indexer.spider.hddolby -> app.runtime", "app.modules.indexer.spider.hddolby -> app.runtime.log", "app.modules.indexer.spider.hddolby -> app.runtime.settings",