(self, items, space_type="0")
| 2616 | return matched |
| 2617 | |
| 2618 | def delete_root_files_cloud(self, items, space_type="0"): |
| 2619 | targets = [] |
| 2620 | for item in items or []: |
| 2621 | item_id = str(item.get('id', '')).strip() |
| 2622 | if not item_id: |
| 2623 | continue |
| 2624 | targets.append((item_id, str(item.get('type', '1')) == '0')) |
| 2625 | deleted = 0 |
| 2626 | for offset in range(0, len(targets), 100): |
| 2627 | batch = targets[offset:offset + 100] |
| 2628 | dir_list = [item_id for item_id, is_dir in batch if is_dir] |
| 2629 | file_list = [item_id for item_id, is_dir in batch if not is_dir] |
| 2630 | if not dir_list and not file_list: |
| 2631 | continue |
| 2632 | res = self.request_wohome_dispatcher_cloud("DeleteFile", { |
| 2633 | "spaceType": str(space_type), |
| 2634 | "vipLevel": "0", |
| 2635 | "dirList": dir_list, |
| 2636 | "fileList": file_list, |
| 2637 | "clientId": "1001000035", |
| 2638 | }, timeout=20) |
| 2639 | rsp = res.get('RSP', {}) |
| 2640 | batch_idx = offset // 100 + 1 |
| 2641 | if str(rsp.get('RSP_CODE')) == '0000': |
| 2642 | deleted += len(batch) |
| 2643 | self.log(f"云盘任务: 第{batch_idx}批根目录删除成功,共{len(batch)}个文件") |
| 2644 | else: |
| 2645 | self.log(f"云盘任务: 第{batch_idx}批根目录删除失败: {rsp.get('RSP_DESC') or res}") |
| 2646 | time.sleep(1) |
| 2647 | return deleted |
| 2648 | |
| 2649 | def clean_duplicate_files_cloud(self): |
| 2650 | token = getattr(self.cloudDisk, 'userToken', '') |
no test coverage detected