(self, total_stats, detail_lines)
| 1386 | return cmonth < td_month |
| 1387 | |
| 1388 | def build_preview_text(self, total_stats, detail_lines): |
| 1389 | lines = [] |
| 1390 | lines.append("清理前请确认") |
| 1391 | lines.append(f"预计可释放空间:{format_size(total_stats['total_size'])}") |
| 1392 | lines.append( |
| 1393 | f"将清理:{total_stats['total_files']} 个文件、" |
| 1394 | f"{total_stats.get('total_dirs', 0)} 个空文件夹、" |
| 1395 | f"{total_stats.get('total_month_dirs', 0)} 个旧月份文件夹" |
| 1396 | ) |
| 1397 | lines.append("") |
| 1398 | lines.append("清理内容:") |
| 1399 | for key, name in CATEGORY_NAME.items(): |
| 1400 | item = total_stats["categories"].get(key, {"count": 0, "size": 0}) |
| 1401 | if item["count"] > 0: |
| 1402 | lines.append(f"- {name}:{item['count']} 个,{format_size(item['size'])}") |
| 1403 | if len(lines) == 5: |
| 1404 | lines.append("- 暂无分类数据") |
| 1405 | lines.append("") |
| 1406 | config = getattr(self, "config", {}) or {} |
| 1407 | if config.get("global", {}).get("direct_delete", False): |
| 1408 | lines.append("当前已开启直接删除,文件不会进入回收站。") |
| 1409 | else: |
| 1410 | lines.append("文件会先进入回收站,不会直接永久删除。") |
| 1411 | return "\n".join(lines) |
| 1412 | |
| 1413 | def parse_preview_detail_line(self, line): |
| 1414 | line = line.strip() |
no test coverage detected