Refactor code structure for improved readability and maintainability

This commit is contained in:
Your Name committed 2026-01-04 21:45:19 +08:00
1 parent 4620d28364
commit 41e0563114
3 files changed
+45 -1

No files matched your search

@@ -1739,7 +1739,9 @@ def process_reservation_attend_window(
ok2 = False
try:
if seek_reservation_room_callback:
ok2 = bool(seek_reservation_room_callback(target))
ok2 = bool(
seek_reservation_room_callback(target)
)
except Exception:
ok2 = False
+14
View File
@@ -244,6 +244,20 @@ class ConfigManager:
if "reset_after_swipes" in config:
analyser.reset_after_swipes = int(config["reset_after_swipes"] or 10)
# 新增:下滑达到阈值后按返回并重新进入直播间的配置
if "swipe_down_back_enabled" in config:
analyser.swipe_down_back_enabled = bool(
config["swipe_down_back_enabled"]
)
if "swipe_down_back_count" in config:
try:
analyser.swipe_down_back_count = max(
1, int(config["swipe_down_back_count"] or 3)
)
except Exception:
analyser.swipe_down_back_count = 3
if "fudai_click_wait_seconds" in config:
analyser.fudai_click_wait_seconds = float(
config["fudai_click_wait_seconds"] or 1.0
+28
View File
@@ -183,6 +183,23 @@ def parse_args(argv: list[str]) -> argparse.Namespace:
help="关闭切换次数阈值回退到第一个直播间",
)
p.add_argument(
"--swipe-down-back-count",
type=int,
default=None,
help="在直播间下滑达到该次数后按返回并重新进入直播间(需配合 --swipe-down-back-enabled)",
)
p.add_argument(
"--swipe-down-back-enabled",
action="store_true",
help="启用下滑达到阈值后按返回并重新进入直播间",
)
p.add_argument(
"--swipe-down-back-disabled",
action="store_true",
help="禁用下滑达到阈值后按返回并重新进入直播间",
)
# 高价值直播间回访运行时开关(GUI 可在启动时传参覆盖)
p.add_argument(
"--high-value-room-revisit-enabled",
@@ -454,6 +471,17 @@ def main(argv: list[str]) -> int:
analyser.reset_after_swipes_enabled = True
if args.reset_after_swipes_disabled:
analyser.reset_after_swipes_enabled = False
# 下滑后返回并重新进入直播间的命令行覆盖(优先级高于 config.json)
if getattr(args, "swipe_down_back_count", None) is not None:
try:
analyser.swipe_down_back_count = max(1, int(args.swipe_down_back_count))
analyser.swipe_down_back_enabled = True
except Exception:
pass
if getattr(args, "swipe_down_back_enabled", False):
analyser.swipe_down_back_enabled = True
if getattr(args, "swipe_down_back_disabled", False):
analyser.swipe_down_back_enabled = False
if args.auto_join_fansclub:
setattr(analyser, "auto_join_fansclub", True)
if args.fansclub_fail_action is not None: