feat: 添加自动手机双清脚本,初始化存储库
This commit is contained in:
50
config.py
Normal file
50
config.py
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
配置文件
|
||||
|
||||
该文件包含脚本的所有可配置参数,便于后期维护和调整。
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Config:
|
||||
"""配置类"""
|
||||
|
||||
# ADB相关配置
|
||||
ADB_PATH: str = "adb" # ADB工具路径,默认使用系统PATH中的adb
|
||||
ADB_TIMEOUT: int = 30 # ADB命令超时时间(秒)
|
||||
|
||||
# 操作超时配置
|
||||
RECOVERY_WAIT_TIMEOUT: int = 60 # 等待Recovery模式超时时间(秒)
|
||||
WIPE_DATA_WAIT_TIME: int = 30 # 等待清除数据完成时间(秒)
|
||||
WIPE_CACHE_WAIT_TIME: int = 15 # 等待清除缓存完成时间(秒)
|
||||
|
||||
# 日志配置
|
||||
LOG_LEVEL: str = "INFO" # 日志级别: DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
LOG_FILE: str = "auto_clean.log" # 日志文件路径
|
||||
LOG_MAX_SIZE: int = 10 * 1024 * 1024 # 单个日志文件最大大小(10MB)
|
||||
LOG_BACKUP_COUNT: int = 5 # 保留的日志备份文件数
|
||||
|
||||
# 设备配置
|
||||
DEFAULT_DEVICE_SERIAL: Optional[str] = None # 默认设备序列号
|
||||
|
||||
# 操作配置
|
||||
AUTO_REBOOT_AFTER_CLEAN: bool = True # 双清完成后自动重启
|
||||
CONFIRM_BEFORE_OPERATION: bool = True # 操作前确认
|
||||
|
||||
# 重试配置
|
||||
MAX_RETRY_COUNT: int = 3 # 最大重试次数
|
||||
RETRY_DELAY: int = 2 # 重试间隔时间(秒)
|
||||
|
||||
|
||||
# 环境变量覆盖配置
|
||||
if os.getenv("ADB_PATH"):
|
||||
Config.ADB_PATH = os.getenv("ADB_PATH")
|
||||
|
||||
if os.getenv("LOG_LEVEL"):
|
||||
Config.LOG_LEVEL = os.getenv("LOG_LEVEL")
|
||||
|
||||
if os.getenv("LOG_FILE"):
|
||||
Config.LOG_FILE = os.getenv("LOG_FILE")
|
||||
Reference in New Issue
Block a user