feat: Refactor and reorganize project structure with new modules and files
- Deleted obsolete files including test scripts and configuration files to streamline the project. - Introduced new modules for handling Douyin functionalities, including core operations, logging, and GUI components. - Updated import paths to reflect the new module structure, enhancing code organization and maintainability. - Added configuration files and documentation to support the new structure and improve user guidance.
This commit is contained in:
1 parent
ea7159355b
commit
c67f22f76f
139 files changed
+7571
-7828
No files matched your search
@@ -0,0 +1,189 @@
|
||||
---
|
||||
name: 全面文件夹整理
|
||||
overview: 将根目录中的文件按类型分类整理到相应的子目录中,提高项目结构的清晰度
|
||||
todos:
|
||||
- id: create_docs_dir
|
||||
content: 创建 docs/ 目录并移动所有 .md 文件(保留 README.md)
|
||||
status: pending
|
||||
- id: organize_tests
|
||||
content: 将根目录的 test_*.py 文件移动到 tests/ 目录
|
||||
status: pending
|
||||
- id: create_scripts_dir
|
||||
content: 创建 scripts/ 目录并移动所有 .bat 和 .ps1 文件
|
||||
status: pending
|
||||
- id: create_config_dir
|
||||
content: 创建 config/ 目录并移动配置文件(可选)
|
||||
status: pending
|
||||
- id: organize_gui_files
|
||||
content: 创建 gui/ 目录并移动 GUI 和 Web 相关文件
|
||||
status: pending
|
||||
- id: organize_tools
|
||||
content: 扩展 tools/ 目录,移动工具和检查脚本
|
||||
status: pending
|
||||
- id: organize_code_files
|
||||
content: 按功能分类整理代码文件(方案B:创建多个功能子目录)
|
||||
status: pending
|
||||
- id: update_imports
|
||||
content: 更新所有文件中的导入路径以匹配新的目录结构
|
||||
status: pending
|
||||
dependencies:
|
||||
- organize_code_files
|
||||
- id: create_readme_files
|
||||
content: 在新目录中创建 README.md 说明文件
|
||||
status: pending
|
||||
dependencies:
|
||||
- create_docs_dir
|
||||
- create_scripts_dir
|
||||
- create_config_dir
|
||||
- organize_gui_files
|
||||
- organize_tools
|
||||
- id: verify_imports
|
||||
content: 验证文件移动后所有导入和功能仍然正常
|
||||
status: pending
|
||||
dependencies:
|
||||
- organize_tests
|
||||
- organize_code_files
|
||||
---
|
||||
|
||||
# 全面
|
||||
|
||||
文件夹整理计划
|
||||
|
||||
## 目标
|
||||
|
||||
将根目录中散落的文件按类型分类整理到相应的子目录中,提高项目结构的清晰度和可维护性。
|
||||
|
||||
## 整理方案
|
||||
|
||||
### 1. 创建文档目录 `docs/`
|
||||
|
||||
**移动文件:** 所有 `.md` 文件(保留 `README.md` 在根目录)
|
||||
|
||||
- 将所有文档文件移动到 `docs/` 目录
|
||||
- 保留根目录的 `README.md` 作为项目主文档
|
||||
|
||||
### 2. 整理测试文件
|
||||
|
||||
**移动文件:** 根目录中的 `test_*.py` 文件
|
||||
|
||||
- 将根目录的测试文件移动到 `tests/` 目录
|
||||
- 保持现有的 `tests/` 目录结构
|
||||
|
||||
### 3. 创建脚本目录 `scripts/`
|
||||
|
||||
**移动文件:** 所有 `.bat` 和 `.ps1` 脚本文件
|
||||
|
||||
- 创建 `scripts/` 目录
|
||||
- 移动所有批处理和 PowerShell 脚本
|
||||
|
||||
### 4. 创建配置目录 `config/`(可选)
|
||||
|
||||
**移动文件:** 配置文件
|
||||
|
||||
- `config.json`
|
||||
- `pyrightconfig.json`
|
||||
- `pytest.ini`
|
||||
|
||||
### 5. 整理代码文件(可选,按功能模块组织)
|
||||
|
||||
**方案A:创建 `douyin/` 目录组织核心业务代码**
|
||||
|
||||
- 将所有 `douyin_*.py` 文件移动到 `douyin/` 目录
|
||||
- 创建 `douyin/__init__.py` 包文件
|
||||
- 更新所有导入路径
|
||||
|
||||
**方案B:按功能分类创建子目录(已选择)**具体目录结构和文件分配:
|
||||
|
||||
- `douyin/core/` - 核心调度和流程控制
|
||||
- douyin_fudai.py, douyin_main_flow.py, douyin_flow_control.py
|
||||
- `douyin/stage/` - 阶段处理
|
||||
- douyin_stage.py, douyin_stage_handler.py
|
||||
- `douyin/fudai/` - 福袋相关
|
||||
- douyin_fudai_core.py, douyin_fudai_detail.py, douyin_fudai_finder.py, douyin_fudai_flow.py
|
||||
- `douyin/detection/` - 检测相关
|
||||
- douyin_detection.py, douyin_pixel.py
|
||||
- `douyin/reservation/` - 预约相关
|
||||
- douyin_reservation.py, douyin_reservation_logic.py, douyin_reservation_handler.py,
|
||||
|
||||
douyin_reservation_ops.py, douyin_reservation_verify.py
|
||||
|
||||
- `douyin/handlers/` - 处理器模块
|
||||
- douyin_popup_handler.py, douyin_swipe_handler.py, douyin_screenshot_handler.py,
|
||||
|
||||
douyin_screenshot_manager.py, douyin_swipe_ops.py
|
||||
|
||||
- `douyin/utils/` - 工具函数
|
||||
- douyin_helpers.py, douyin_utils.py, douyin_text_utils.py, douyin_config.py
|
||||
- `douyin/logging/` - 日志相关
|
||||
- douyin_logging.py, douyin_logging_wrapper.py, douyin_logger.py
|
||||
- `douyin/other/` - 其他功能模块
|
||||
- douyin_live_room.py, douyin_lottery.py, douyin_robot.py, douyin_yanghao.py,
|
||||
|
||||
douyin_high_value_room.py, douyin_stuck_guard.py, douyin_guaji.py, douyin_popups.py**实施步骤:**
|
||||
|
||||
1. 创建 `douyin/` 主目录和所有子目录
|
||||
2. 创建各子目录的 `__init__.py` 文件
|
||||
3. 按分类移动文件到对应目录
|
||||
4. 更新所有导入路径(这是关键步骤,需要仔细处理)
|
||||
5. 验证所有功能正常
|
||||
|
||||
**方案C:保持现状,仅整理非核心文件**
|
||||
|
||||
- 保持 `douyin_*.py` 在根目录(因为它们是核心模块,导入频繁)
|
||||
- 仅整理工具、GUI、脚本等文件
|
||||
|
||||
### 6. 整理GUI和Web相关文件
|
||||
|
||||
**创建 `gui/` 目录**
|
||||
|
||||
- gui_app.py, gui_core.py
|
||||
- web_gui.py, webgui_launcher.py
|
||||
|
||||
### 7. 整理工具和检查脚本
|
||||
|
||||
**创建 `tools/` 目录(扩展现有)**
|
||||
|
||||
- check_*.py 文件
|
||||
- cleanup_unused_files.py
|
||||
- install_dependencies.py
|
||||
- 生成WPS流程图.py
|
||||
|
||||
## 目录结构
|
||||
|
||||
整理后的结构:
|
||||
|
||||
```javascript
|
||||
douyin_guaji-main/
|
||||
├── README.md # 保留在根目录
|
||||
├── requirements*.txt # 保留在根目录
|
||||
├── docs/ # 新建:所有文档
|
||||
├── scripts/ # 新建:所有脚本
|
||||
├── config/ # 新建:配置文件(可选)
|
||||
├── tests/ # 现有:测试文件
|
||||
├── tools/ # 扩展:工具和检查脚本
|
||||
├── gui/ # 新建:GUI相关文件
|
||||
├── fudai_detail_modules/ # 现有:模块化文件
|
||||
├── douyin/ # 新建(可选):核心业务代码
|
||||
│ ├── core/ # 核心调度
|
||||
│ ├── stage/ # 阶段处理
|
||||
│ ├── fudai/ # 福袋相关
|
||||
│ ├── detection/ # 检测相关
|
||||
│ ├── reservation/ # 预约相关
|
||||
│ ├── handlers/ # 处理器
|
||||
│ ├── utils/ # 工具函数
|
||||
│ └── logging/ # 日志相关
|
||||
└── [其他核心文件] # 保留在根目录(如果选择方案C)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **保持向后兼容**:确保移动文件后不影响现有功能
|
||||
2. **更新导入路径**:如果有文件引用了移动的文件,需要更新路径
|
||||
3. **保留关键文件**:`README.md` 和 `requirements.txt` 等关键文件保留在根目录
|
||||
4. **创建说明文档**:在新目录中创建 README 说明文件用途
|
||||
5. **代码文件整理注意事项**:
|
||||
|
||||
- 移动代码文件后需要更新所有导入路径
|
||||
- 需要创建 `__init__.py` 文件使目录成为 Python 包
|
||||
Reference in new issue
Block a user