|
5 | 5 |
|
6 | 6 | import structlog
|
7 | 7 |
|
8 |
| -from src.core.constants import TS_FOLDER_NAME, LibraryPrefs |
| 8 | +from src.core.constants import TS_FOLDER_NAME |
9 | 9 | from src.core.library import Library, Entry
|
10 | 10 |
|
11 | 11 | logger = structlog.get_logger(__name__)
|
@@ -44,39 +44,22 @@ def refresh_dir(self, lib_path: Path) -> Iterator[int]:
|
44 | 44 | if self.library.library_dir is None:
|
45 | 45 | raise ValueError("No library directory set.")
|
46 | 46 |
|
47 |
| - is_exclude_list = self.library.prefs(LibraryPrefs.IS_EXCLUDE_LIST) |
48 |
| - exclude_list = set(self.library.prefs(LibraryPrefs.EXTENSION_LIST)) |
49 |
| - |
50 |
| - def skip_suffix(suffix: str) -> bool: |
51 |
| - """Determine if the file extension should be skipped. |
52 |
| -
|
53 |
| - Declared as local function as it's faster. |
54 |
| -
|
55 |
| - - check if the suffix is in the library's "exclude list" |
56 |
| - - if library uses "exclude mode", and extensions is in the list, we skip |
57 |
| - - if library uses "include mode", and extensions is not in the list, we skip |
58 |
| - """ |
59 |
| - return (suffix.lower() in exclude_list) == is_exclude_list |
60 |
| - |
61 | 47 | start_time_total = time()
|
62 | 48 | start_time_loop = time()
|
63 | 49 |
|
64 | 50 | self.files_not_in_library = []
|
65 | 51 | dir_file_count = 0
|
66 | 52 |
|
67 |
| - for path_item in lib_path.glob("**/*"): |
68 |
| - str_path = str(path_item) |
69 |
| - if path_item.is_dir(): |
| 53 | + for path in lib_path.glob("**/*"): |
| 54 | + str_path = str(path) |
| 55 | + if path.is_dir(): |
70 | 56 | continue
|
71 | 57 |
|
72 | 58 | if "$RECYCLE.BIN" in str_path or TS_FOLDER_NAME in str_path:
|
73 | 59 | continue
|
74 | 60 |
|
75 |
| - if skip_suffix(path_item.suffix): |
76 |
| - continue |
77 |
| - |
78 | 61 | dir_file_count += 1
|
79 |
| - relative_path = path_item.relative_to(lib_path) |
| 62 | + relative_path = path.relative_to(lib_path) |
80 | 63 | # TODO - load these in batch somehow
|
81 | 64 | if not self.library.has_path_entry(relative_path):
|
82 | 65 | self.files_not_in_library.append(relative_path)
|
|
0 commit comments