|
15 | 15 |
|
16 | 16 | MINIMUM_FILE_COUNT = 8 |
17 | 17 | MINIMUM_CONCATENATED_NAME_LENGTH = 32 |
18 | | -MINIMUM_FILE_NAME_LENGTH = 64 |
| 18 | +MAXIMUM_FILE_NAME_LENGTH = 32 |
19 | 19 |
|
20 | 20 |
|
21 | 21 | class DirectoryNode: |
@@ -140,7 +140,7 @@ def _build_root_node(self, path: str) -> DirectoryNode: |
140 | 140 | root_node = DirectoryNode(str(root)) |
141 | 141 |
|
142 | 142 | all_files = [ |
143 | | - f for f in root.rglob('*') if f.is_file() and len(f.name.encode('utf-8')) <= MINIMUM_FILE_NAME_LENGTH |
| 143 | + f for f in root.rglob('*') if f.is_file() and len(f.name.encode('utf-8')) <= MAXIMUM_FILE_NAME_LENGTH |
144 | 144 | ] |
145 | 145 | filtered_files = self.file_filters.get_filtered_files_from_files(all_files, str(root)) |
146 | 146 |
|
@@ -249,11 +249,15 @@ def _hash_calc(self, node: DirectoryNode) -> dict: |
249 | 249 | ext_without_dot = extension[1:] |
250 | 250 | extension_map[ext_without_dot] = extension_map.get(ext_without_dot, 0) + 1 |
251 | 251 |
|
252 | | - last_directory = Path(current_directory).name or Path(self.scan_dir).name |
| 252 | + current_directory.removeprefix(self.scan_dir) |
| 253 | + parts = current_directory.split(os.path.sep) |
| 254 | + for d in parts: |
| 255 | + if d in {'', '.', '..'}: |
| 256 | + continue |
| 257 | + unique_directories.add(d) |
253 | 258 |
|
254 | 259 | processed_hashes.add(key_str) |
255 | 260 | unique_file_names.add(file_name_without_extension) |
256 | | - unique_directories.add(last_directory) |
257 | 261 | selected_names.append(file_name) |
258 | 262 | file_hashes.append(file.key) |
259 | 263 |
|
|
0 commit comments