fix one-task countdown config crop

This commit is contained in:
Your Name committed 2026-06-23 22:49:30 +08:00
1 parent dc34b7484b
commit 4dea1328ec
5 files changed
+34 -13

No files matched your search

+4 -4
View File
@@ -392,10 +392,10 @@
1735
],
"countdown_full": [
769,
1384,
1029,
1442
700,
1390,
990,
1470
],
"info_line": [
430,
+3 -2
View File
@@ -138,7 +138,7 @@ DETAIL_UI_V2_0_ONE_TASK = {
"variant": "one_task",
"content": (360, 1460, 1035, 1545),
"value": (350, 1640, 760, 1735),
"countdown_full": (700, 1320, 930, 1415),
"countdown_full": (700, 1390, 990, 1470),
"info_line": (430, 1315, 1055, 1435),
"task_list": (60, 1845, 885, 2005),
"task_count": (890, 1855, 1040, 1960),
@@ -160,7 +160,7 @@ STALE_DETAIL_REGION_DEFAULTS = {
"countdown_full": (760, 1328, 1038, 1398),
},
"v2_0_one_task": {
"countdown_full": (769, 1384, 1029, 1442),
"countdown_full": (700, 1320, 930, 1415),
},
}
@@ -169,6 +169,7 @@ STALE_DETAIL_REGION_OVERRIDES = {
"countdown_full": (
(730, 1338, 1038, 1418),
(769, 1384, 1029, 1442),
(700, 1320, 930, 1415),
),
},
}
@@ -74,8 +74,8 @@ def cut_detail_regions(
digit_y2 = min(y2, max(digit_y1 + 2, y1 + max(2, int(h * 0.96))))
mm_x1 = min(x2 - 1, x1 + max(1, int(w * 0.08)))
mm_x2 = min(x2, max(mm_x1 + 1, x1 + max(2, int(w * 0.31))))
ss_x1 = min(x2 - 1, x1 + max(1, int(w * 0.48)))
ss_x2 = min(x2, max(ss_x1 + 1, x1 + max(2, int(w * 0.71))))
ss_x1 = min(x2 - 1, x1 + max(1, int(w * 0.40)))
ss_x2 = min(x2, max(ss_x1 + 1, x1 + max(2, int(w * 0.67))))
else:
digit_y1 = min(y2 - 2, y1 + max(1, int(h * 0.44)))
digit_y2 = y2
+4 -4
View File
@@ -149,14 +149,14 @@ class TestCutDetailRegions:
def test_one_task_profile_countdown_box_uses_new_coords(self):
a = _mk_analyser()
profile = {"countdown_full": (700, 1320, 930, 1415)}
profile = {"countdown_full": (700, 1390, 990, 1470)}
result = cut_detail_regions(a, renwu=1, profile=profile)
assert result == (700, 1320, 930, 1415)
assert result == (700, 1390, 990, 1470)
mm_call = a.cut_pic.call_args_list[1]
ss_call = a.cut_pic.call_args_list[2]
assert mm_call.args[:4] == (718, 1346, 771, 1411)
assert ss_call.args[:4] == (810, 1346, 863, 1411)
assert mm_call.args[:4] == (723, 1412, 789, 1466)
assert ss_call.args[:4] == (816, 1412, 894, 1466)
def test_renwu_3_uses_correct_box(self):
a = _mk_analyser()
+21 -1
View File
@@ -37,7 +37,7 @@ def test_v2_profile_keeps_legacy_and_adds_expected_regions(monkeypatch):
assert DETAIL_UI_V2_0["button"] == (70, 2020, 1010, 2165)
assert DETAIL_UI_V2_0_ONE_TASK["content"] == (360, 1460, 1035, 1545)
assert DETAIL_UI_V2_0_ONE_TASK["value"] == (350, 1640, 760, 1735)
assert DETAIL_UI_V2_0_ONE_TASK["countdown_full"] == (700, 1320, 930, 1415)
assert DETAIL_UI_V2_0_ONE_TASK["countdown_full"] == (700, 1390, 990, 1470)
assert DETAIL_UI_V2_0_ONE_TASK["info_line"] == (430, 1315, 1055, 1435)
assert DETAIL_UI_V2_0_ONE_TASK["task_list"] == (60, 1845, 885, 2005)
assert DETAIL_UI_V2_0_ONE_TASK["task_count"] == (890, 1855, 1040, 1960)
@@ -170,6 +170,26 @@ def test_detail_profile_ignores_previous_default_v2_one_task_countdown(monkeypat
assert profile["countdown_full"] == coords.DETAIL_UI_V2_0_ONE_TASK["countdown_full"]
def test_detail_profile_ignores_high_v2_one_task_countdown(monkeypatch):
from douyin.fudai.core import coords
monkeypatch.setattr(
coords,
"_read_runtime_region_config",
lambda: {
"fudai_detail_regions": {
"v2_0_one_task": {
"countdown_full": [700, 1320, 930, 1415],
}
}
},
)
profile = coords.get_fudai_detail_profile("v2_0", task_count=1)
assert profile["countdown_full"] == coords.DETAIL_UI_V2_0_ONE_TASK["countdown_full"]
def test_v2_two_task_profile_covers_batu_4999_sample_regions():
from PIL import Image
from pathlib import Path