Skip to content

Commit de7face

Browse files
feat: add ability to configure automatic loading of new files over 10000 (#1349)
* feat: add ability to configure automatic loading of new files over 10000 * Renaming things * rename and reorder * fix: remove duplicated add_new_files_callback() call
1 parent cdd399e commit de7face

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/tagstudio/qt/global_settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class GlobalSettings(BaseModel):
6363
cached_thumb_quality: int = Field(default=DEFAULT_CACHED_IMAGE_QUALITY)
6464
cached_thumb_resolution: int = Field(default=DEFAULT_CACHED_IMAGE_RES)
6565
autoplay: bool = Field(default=True)
66+
scan_files_on_open: bool = Field(default=True)
6667
loop: bool = Field(default=True)
6768
show_filenames_in_grid: bool = Field(default=True)
6869
page_size: int = Field(default=100)

src/tagstudio/qt/mixed/settings_panel.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ def __build_global_settings(self):
176176
self.autoplay_checkbox.setChecked(self.driver.settings.autoplay)
177177
form_layout.addRow(Translations["media_player.autoplay"], self.autoplay_checkbox)
178178

179+
# Scan for new files when a library is opened
180+
self.scan_files_on_open_checkbox = QCheckBox()
181+
self.scan_files_on_open_checkbox.setChecked(self.driver.settings.scan_files_on_open)
182+
form_layout.addRow(
183+
Translations["settings.scan_files_on_open"], self.scan_files_on_open_checkbox
184+
)
185+
179186
# Show Filenames in Grid
180187
self.show_filenames_checkbox = QCheckBox()
181188
self.show_filenames_checkbox.setChecked(self.driver.settings.show_filenames_in_grid)
@@ -295,6 +302,7 @@ def get_settings(self) -> dict[str, Any]: # pyright: ignore[reportExplicitAny]
295302
MIN_THUMB_CACHE_SIZE,
296303
),
297304
"autoplay": self.autoplay_checkbox.isChecked(),
305+
"scan_files_on_open": self.scan_files_on_open_checkbox.isChecked(),
298306
"show_filenames_in_grid": self.show_filenames_checkbox.isChecked(),
299307
"page_size": int(self.page_size_line_edit.text()),
300308
"infinite_scroll": self.infinite_scroll.isChecked(),
@@ -313,6 +321,7 @@ def update_settings(self, driver: "QtDriver"):
313321
driver.settings.language = settings["language"]
314322
driver.settings.open_last_loaded_on_startup = settings["open_last_loaded_on_startup"]
315323
driver.settings.autoplay = settings["autoplay"]
324+
driver.settings.scan_files_on_open = settings["scan_files_on_open"]
316325
driver.settings.generate_thumbs = settings["generate_thumbs"]
317326
driver.settings.thumb_cache_size = settings["thumb_cache_size"]
318327
driver.settings.show_filenames_in_grid = settings["show_filenames_in_grid"]

src/tagstudio/qt/ts_qt.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,8 +1650,7 @@ def _init_library(self, path: Path, open_status: LibraryStatus):
16501650
Ignore.get_patterns(self.lib.library_dir, include_global=True)
16511651
self.__reset_navigation()
16521652

1653-
# TODO - make this call optional
1654-
if self.lib.entries_count < 10000:
1653+
if self.settings.scan_files_on_open:
16551654
self.add_new_files_callback()
16561655

16571656
if self.settings.show_filepath == ShowFilepathOption.SHOW_FULL_PATHS:

src/tagstudio/resources/translations/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@
272272
"settings.open_library_on_start": "Open Library on Start",
273273
"settings.page_size": "Page Size",
274274
"settings.restart_required": "Please restart TagStudio for changes to take effect.",
275+
"settings.scan_files_on_open": "Automatically Load New Files",
275276
"settings.show_filenames_in_grid": "Show Filenames in Grid",
276277
"settings.show_recent_libraries": "Show Recent Libraries",
277278
"settings.splash.label": "Splash Screen",

0 commit comments

Comments
 (0)