Refactor and update README files

Updated README files to reflect the modular design of the toolkit and provide detailed descriptions for each tool. Refactored file structure by moving scripts to the 'tools/' directory for better organization.
This commit is contained in:
xixu-me committed 2025-06-04 17:35:32 +08:00
1 parent b37b755b75
commit 2d1cc3c781
5 files changed
+311 -115

No files matched your search

+151 -52
View File
@@ -1,21 +1,38 @@
# CWU7 - Can't Wake Up at 7am
A Python automation toolkit for badminton court reservations and development assistance. The main script automates court reservations at precisely 7:00 AM, while additional utilities help with UI coordination and Copilot session management.
A modular Python automation toolkit featuring multiple independent tools for various automation and development tasks. The toolkit is designed with equal-status tools that can be used individually or together, with easy expansion capabilities for new automation tools.
## 🚀 Features
## 🚀 Toolkit Overview
### Core Reservation Bot
CWU7 consists of multiple standalone tools, each serving a specific automation purpose:
### 🏸 Court Reservation Tool (`tools/court_reservation.py`)
An automated badminton court reservation system with intelligent timing and error handling:
- **⏰ Precise Timing**: Waits until exactly 7:00 AM to start the reservation process
- **🤖 Automated Navigation**: Clicks through the reservation interface automatically
- **🔍 CAPTCHA Solving**: Uses OCR technology to recognize and solve CAPTCHA challenges
- **🔄 Retry Logic**: Automatically retries on failure with configurable attempts
- **📝 Logging**: Logs all actions and errors to file and console
- **📝 Comprehensive Logging**: Logs all actions and errors to file and console
### Utilities
### 🎯 Mouse Position Tracker (`mouse_tracker.py`)
- **🎯 Mouse Tracking**: Helper tool for finding UI coordinates
- **💬 Copilot Resumption**: Tool to resume Copilot sessions by monitoring screen color and automating input
A development utility for UI automation coordinate discovery:
- **📍 Real-time Coordinates**: Displays live mouse position and pixel color information
- **🖱️ Developer-Friendly**: Essential for determining click coordinates for automation scripts
- **⚡ Low Latency**: Configurable refresh rate for optimal performance
- **🎨 Color Detection**: Shows RGB values for precise color-based automation
### 💬 Copilot Resumption Tool (`tools/copilot_resumption.py`)
An intelligent session management tool for automated development assistance:
- **👁️ Screen Monitoring**: Watches specific screen regions for color changes
- **🤖 Auto-Response**: Automatically inputs text when interaction is needed
- **🔄 Session Continuity**: Helps maintain active Copilot sessions without manual intervention
- **📊 Activity Logging**: Tracks all monitoring and response activities
## 📋 Requirements
@@ -38,45 +55,70 @@ cd CWU7
pip install pyautogui ddddocr numpy Pillow
```
## 📖 Usage
## 📖 Tool Usage
### Reservation Bot
Each tool in the CWU7 toolkit can be used independently. Choose the tool that fits your current automation needs:
1. Edit `court_reservation.py` to set reservation time and coordinates if needed.
2. Run:
### 🏸 Court Reservation Tool
Automate badminton court reservations at precise timing:
1. Configure reservation settings in `tools/court_reservation.py` if needed
2. Run the tool:
```powershell
python court_reservation.py
python tools/court_reservation.py
```
The tool will wait until the configured time and automatically handle the entire reservation process.
### 🎯 Mouse Position Tracker
Discover UI coordinates for automation scripts:
```powershell
python tools/mouse_tracker.py
```
The tracker displays real-time mouse position and pixel color information. Press Ctrl+C to exit when you've found the coordinates you need.
### 💬 Copilot Resumption Tool
Automatically maintain active Copilot sessions:
```powershell
python tools/copilot_resumption.py
```
The tool monitors screen regions and automatically responds to interaction prompts to keep Copilot sessions active.
## ⚙️ Tool Configuration
Each tool has its own configuration options. Refer to the specific tool's documentation within its source file:
### Court Reservation Tool
- **Timing**: Edit `RESERVATION_HOUR` and `RESERVATION_MINUTE` in `tools/court_reservation.py`
- **UI Coordinates**: Update the `COORDINATES` dictionary using coordinates found with the tracker tool
- **Retry Settings**: Configure `MAX_RETRY_ATTEMPTS` for error handling
### Mouse Position Tracker
Find UI coordinates:
```powershell
python tracker.py
```
Shows mouse position and pixel color in real-time. Press Ctrl+C to exit.
- **Refresh Rate**: Modify the `refresh_rate` parameter for update frequency
- **Display Format**: Customize output format in the tracker function
### Copilot Resumption Tool
Resume Copilot sessions automatically:
```powershell
python copilot_resumption.py
```
Monitors a screen region for color changes and inputs text to help resume Copilot sessions when interaction is needed.
## ⚙️ Configuration
- **Time**: Edit `RESERVATION_HOUR` and `RESERVATION_MINUTE` in `court_reservation.py`.
- **Coordinates**: Update the `COORDINATES` dictionary in `court_reservation.py` using `tracker.py`.
- **Retry**: Set `MAX_RETRY_ATTEMPTS` in `court_reservation.py`.
- **Monitor Region**: Set the screen coordinates for color monitoring
- **Target Colors**: Configure the RGB values to detect interaction needs
- **Response Text**: Customize the automated input text
## 🔧 How It Works
The toolkit employs different automation strategies for each tool:
### Court Reservation Workflow
1. Waits for the target time
2. Opens the reservation interface
3. Navigates steps automatically
@@ -84,29 +126,69 @@ Monitors a screen region for color changes and inputs text to help resume Copilo
5. Retries on failure
6. Logs all actions and results
## 📁 File Structure
### Mouse Tracker Operation
- `court_reservation.py` - Main reservation bot
- `tracker.py` - Mouse position tracker
- `copilot_resumption.py` - Copilot session resumption tool
- `captcha.png` - Sample CAPTCHA image
- `LICENSE` - License
- `.gitignore` - Git ignore file
- `reservation.log` - Reservation log (created at runtime)
- `copilot_resumption.log` - Copilot tool log (created at runtime)
1. Captures mouse position continuously
2. Reads pixel color at cursor location
3. Displays formatted coordinate and color data
4. Updates at configurable intervals
### Copilot Resumption Process
1. Monitors specified screen region
2. Detects color changes indicating interaction needs
3. Automatically inputs configured response text
4. Logs all monitoring activities
## 🔧 Troubleshooting
- **Wrong Coordinates**: Use `tracker.py` to find correct positions
- **CAPTCHA Failures**: OCR may need adjustment for different styles
- **Timing Issues**: Adjust `check_interval` in code
- **Screen Resolution**: Update coordinates for your display
### General Issues
Logs: See `reservation.log` and `copilot_resumption.log` for details.
- **Python Dependencies**: Ensure all required packages are installed via pip
- **Screen Resolution**: Update coordinates for your specific display configuration
- **Permission Issues**: Run with appropriate privileges if automation is blocked
### Tool-Specific Issues
#### Court Reservation Tool
- **Wrong Coordinates**: Use `mouse_tracker.py` to find correct UI element positions
- **CAPTCHA Failures**: OCR may need adjustment for different CAPTCHA styles
- **Timing Issues**: Adjust `check_interval` in the tool configuration
#### Mouse Position Tracker
- **High CPU Usage**: Increase refresh rate interval for lower resource consumption
- **Coordinate Accuracy**: Ensure display scaling is considered in measurements
#### Copilot Resumption Tool
- **Color Detection**: Verify RGB values match the actual screen colors
- **Response Timing**: Adjust monitoring intervals for better responsiveness
For detailed logs, check the respective log files: `reservation.log` and `copilot_resumption.log`.
## 🚀 Extending the Toolkit
CWU7 is designed for easy expansion. To add new automation tools:
### Adding New Tools
1. **Create Tool File**: Add your new tool to the `tools/` directory
2. **Follow Structure**: Use existing tools as templates for logging and configuration
3. **Update Documentation**: Add tool description to both README files
4. **Test Integration**: Ensure the tool works independently and with others
### Development Guidelines
- **Modular Design**: Each tool should be self-contained and independently executable
- **Consistent Logging**: Use the established logging format for consistency
- **Configuration**: Make settings easily configurable for different use cases
- **Error Handling**: Implement robust error handling and retry mechanisms
## ⚖️ Legal Notice
This software is for educational purposes only. Users are responsible for compliance with the reservation system's terms. The authors are not responsible for misuse.
This software is for educational purposes only. Users are responsible for compliance with the terms of service of any systems they interact with. The authors are not responsible for misuse or any consequences of using this toolkit.
## 📄 License
@@ -114,12 +196,29 @@ GNU General Public License v3.0 - see [LICENSE](LICENSE).
## 🤝 Contributing
We welcome contributions to expand the CWU7 toolkit:
1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to your branch
5. Create a Pull Request
2. Create a feature branch (`git checkout -b feature/new-tool`)
3. Commit your changes with clear messages
4. Push to your branch (`git push origin feature/new-tool`)
5. Create a Pull Request with detailed description
### Contribution Guidelines
- Follow the existing code style and structure
- Add comprehensive documentation for new tools
- Include error handling and logging
- Test thoroughly on Windows environments
- Update both English and Chinese README files
## ⚠️ Disclaimer
This tool is for legitimate reservations only. Use responsibly and follow the reservation system's terms of service.
This toolkit is designed for legitimate automation purposes only. Users must:
- Respect terms of service of target systems
- Use tools responsibly and ethically
- Comply with applicable laws and regulations
- Take full responsibility for their usage
The authors assume no liability for misuse or any consequences arising from the use of this toolkit.
+160 -63
View File
@@ -1,21 +1,38 @@
# CWU7 - 7 点起床困难户
一个用于在早上 7:00 准时预约羽毛球场地的 Python 自动化脚本。该工具集还包含 UI 坐标辅助工具和 Copilot 会话恢复工具。
一个模块化的 Python 自动化工具包,包含多个独立工具,用于各种自动化和开发任务。该工具包采用平等状态的工具设计,可以单独使用或组合使用,并具有易于扩展新自动化工具的能力。
## 功能特性
## 🚀 工具包概览
### 核心预约机器人
CWU7 由多个独立工具组成,每个工具都有特定的自动化用途:
- **精确计时**:等到早上 7:00 准时开始预约流程
- **自动导航**:自动点击预约界面的各个步骤
- **验证码识别**:使用 OCR 技术识别并解决验证码挑战
- **重试机制**:失败时自动重试,可配置重试次数
- **完整日志**:将所有操作和错误记录到文件和控制台
### 🏸 羽毛球场预约工具 (`tools/court_reservation.py`)
### 辅助工具
具有智能计时和错误处理的自动化羽毛球场预约系统:
- **鼠标跟踪工具**:用于查找 UI 坐标的辅助工具
- **Copilot 恢复工具**:自动化工具,用于在需要交互时恢复 Copilot 会话
- **⏰ 精确计时**:等到早上 7:00 准时开始预约流程
- **🤖 自动导航**:自动点击预约界面的各个步骤
- **🔍 验证码识别**:使用 OCR 技术识别并解决验证码挑战
- **🔄 重试机制**:失败时自动重试,可配置重试次数
- **📝 完整日志**:将所有操作和错误记录到文件和控制台
### 🎯 鼠标位置跟踪器 (`mouse_tracker.py`)
用于 UI 自动化坐标发现的开发工具:
- **📍 实时坐标**:显示实时鼠标位置和像素颜色信息
- **🖱️ 开发友好**:对于确定自动化脚本的点击坐标至关重要
- **⚡ 低延迟**:可配置刷新率以获得最佳性能
- **🎨 颜色检测**:显示 RGB 值以进行精确的基于颜色的自动化
### 💬 Copilot 会话恢复工具 (`tools/copilot_resumption.py`)
用于自动化开发辅助的智能会话管理工具:
- **👁️ 屏幕监控**:监控特定屏幕区域的颜色变化
- **🤖 自动响应**:在需要交互时自动输入文本
- **🔄 会话连续性**:帮助在无需手动干预的情况下保持活跃的 Copilot 会话
- **📊 活动日志**:跟踪所有监控和响应活动
## 系统要求
@@ -38,46 +55,69 @@ cd CWU7
pip install pyautogui ddddocr numpy Pillow
```
## 使用方法
## 📖 工具使用方法
### 运行预约机器人
CWU7 工具包中的每个工具都可以独立使用。选择适合您当前自动化需求的工具:
1. 如需要,在 `court_reservation.py` 中配置预约时间和坐标
2. 运行主脚本:
### 🏸 羽毛球场预约工具
在精确时间自动化羽毛球场预约:
1. 如需要,在 `tools/court_reservation.py` 中配置预约设置
2. 运行工具:
```powershell
python court_reservation.py
python tools/court_reservation.py
```
机器人将等到早上 7:00,然后自动尝试预约羽毛球场地。
工具将等到配置的时间并自动处理整个预约流程。
### 🎯 鼠标位置跟踪器
为自动化脚本发现 UI 坐标:
```powershell
python tools/mouse_tracker.py
```
跟踪器显示实时鼠标位置和像素颜色信息。当您找到所需坐标时,按 Ctrl+C 退出。
### 💬 Copilot 会话恢复工具
自动维护活跃的 Copilot 会话:
```powershell
python tools/copilot_resumption.py
```
该工具监控屏幕区域并自动响应交互提示以保持 Copilot 会话活跃。
## ⚙️ 工具配置
每个工具都有自己的配置选项。请参考其源文件内的特定工具文档:
### 羽毛球场预约工具
- **时间设置**:在 `tools/court_reservation.py` 中修改 `RESERVATION_HOUR` 和 `RESERVATION_MINUTE`
- **UI 坐标**:使用跟踪器工具找到的坐标更新 `COORDINATES` 字典
- **重试设置**:配置 `MAX_RETRY_ATTEMPTS` 进行错误处理
### 鼠标位置跟踪器
查找 UI 元素的坐标:
- **刷新率**:修改 `refresh_rate` 参数以调整更新频率
- **显示格式**:在跟踪器函数中自定义输出格式
```powershell
python tracker.py
```
### Copilot 会话恢复工具
实时显示当前鼠标位置和像素颜色。按 Ctrl+C 退出。
- **监控区域**:设置颜色监控的屏幕坐标
- **目标颜色**:配置用于检测交互需求的 RGB 值
- **响应文本**:自定义自动输入文本
### Copilot 恢复工具
## 🔧 工作原理
自动继续 Copilot 会话:
工具包为每个工具采用不同的自动化策略:
```powershell
python copilot_resumption.py
```
该工具监控特定屏幕区域的颜色变化,并在检测到目标颜色时自动输入文本,帮助在需要交互时恢复或继续 Copilot 会话。
## 配置说明
- **时间设置**:修改 `court_reservation.py` 中的 `RESERVATION_HOUR` 和 `RESERVATION_MINUTE`
- **坐标配置**:`court_reservation.py` 中的 `COORDINATES` 字典包含所有点击位置。用 `tracker.py` 获取正确坐标
- **重试设置**:`court_reservation.py` 中设置 `MAX_RETRY_ATTEMPTS`
## 工作原理
### 羽毛球场预约工作流程
1. 等待目标时间
2. 打开预约界面
@@ -86,42 +126,99 @@ python copilot_resumption.py
5. 失败自动重试
6. 记录所有操作和结果
## 文件结构
### 鼠标跟踪器操作
- `court_reservation.py` - 主要预约机器人脚本
- `tracker.py` - 鼠标位置跟踪工具
- `copilot_resumption.py` - Copilot 会话恢复工具
- `captcha.png` - 验证码样例图片
- `LICENSE` - 许可证
- `.gitignore` - Git 忽略文件
- `reservation.log` - 预约日志(运行时生成)
- `copilot_resumption.log` - Copilot 工具日志(运行时生成)
1. 持续捕获鼠标位置
2. 读取光标位置的像素颜色
3. 显示格式化的坐标和颜色数据
4. 以可配置的间隔更新
## 故障排除
### Copilot 恢复流程
- **坐标错误**:用 `tracker.py` 查找正确点击位置
- **验证码失败**:OCR 可能需针对不同验证码样式调整
- **时序问题**:调整代码中的 `check_interval`
- **屏幕分辨率**:根据显示器调整坐标
1. 监控指定的屏幕区域
2. 检测表明交互需求的颜色变化
3. 自动输入配置的响应文本
4. 记录所有监控活动
日志:详见 `reservation.log` 和 `copilot_resumption.log`
## 🔧 故障排除
## 法律声明
### 通用问题
本软件仅供教育目的。用户有责任遵守预约系统的服务条款。作者不对任何误用或违规行为负责。
- **Python 依赖**:确保通过 pip 安装所有必需的包
- **屏幕分辨率**:根据您的特定显示配置更新坐标
- **权限问题**:如果自动化被阻止,请以适当的权限运行
## 许可证
### 特定工具问题
本项目采用 GNU 通用公共许可证 v3.0 - 详见 [LICENSE](LICENSE) 文件。
#### 羽毛球场预约工具
## 贡献
- **坐标错误**:使用 `mouse_tracker.py` 找到正确的 UI 元素位置
- **验证码失败**:OCR 可能需要针对不同验证码样式进行调整
- **时序问题**:在工具配置中调整 `check_interval`
#### 鼠标位置跟踪器
- **高 CPU 使用率**:增加刷新率间隔以降低资源消耗
- **坐标精度**:确保在测量中考虑显示缩放
#### Copilot 会话恢复工具
- **颜色检测**:验证 RGB 值与实际屏幕颜色匹配
- **响应时间**:调整监控间隔以获得更好的响应性
详细日志请检查相应的日志文件:`reservation.log` 和 `copilot_resumption.log`。
## 🚀 扩展工具包
CWU7 设计为易于扩展。要添加新的自动化工具:
### 添加新工具
1. **创建工具文件**:将新工具添加到 `tools/` 目录
2. **遵循结构**:使用现有工具作为日志和配置的模板
3. **更新文档**:在两个 README 文件中添加工具描述
4. **测试集成**:确保工具能独立工作并与其他工具协同
### 开发指南
- **模块化设计**:每个工具应该是自包含的并可独立执行
- **一致的日志**:使用已建立的日志格式以保持一致性
- **配置**:使设置易于配置以适应不同用例
- **错误处理**:实现健壮的错误处理和重试机制
## ⚖️ 法律声明
本软件仅供教育目的。用户有责任遵守他们交互的任何系统的服务条款。作者不对误用或使用本工具包的任何后果负责。
## 📄 许可证
GNU 通用公共许可证 v3.0 - 详见 [LICENSE](LICENSE) 文件。
## 🤝 贡献
我们欢迎为扩展 CWU7 工具包做出贡献:
1. Fork 仓库
2. 创建功能分支
3. 提交更改
4. 推送到分支
5. 创建 Pull Request
2. 创建功能分支 (`git checkout -b feature/new-tool`)
3. 提交带有清晰消息的更改
4. 推送到您的分支 (`git push origin feature/new-tool`)
5. 创建带有详细描述的 Pull Request
## 免责声明
### 贡献指南
这是一个旨在帮助合法预约的自动化工具。请负责任地使用,并遵守预约系统的服务条款。
- 遵循现有的代码风格和结构
- 为新工具添加全面的文档
- 包含错误处理和日志记录
- 在 Windows 环境中充分测试
- 更新英文和中文 README 文件
## ⚠️ 免责声明
此工具包仅设计用于合法的自动化目的。用户必须:
- 尊重目标系统的服务条款
- 负责任和道德地使用工具
- 遵守适用的法律法规
- 对其使用承担全部责任
作者对误用或因使用此工具包而产生的任何后果不承担任何责任。
File renamed without changes.
File renamed without changes.
File renamed without changes.