From 85d62e65191880ebe56fc187a236b5ce5b29beeb Mon Sep 17 00:00:00 2001 From: Jann Stute <46534683+Computerdores@users.noreply.github.com> Date: Sun, 1 Sep 2024 02:17:29 +0200 Subject: [PATCH] fix: gdl sidecar files load properly * fix: run_macro didn't work for files that aren't in a sub directory * fix: add_generic_data_to_entry would add a new Content Tags Field if the Content Tags field was the first field * fix: get_gdl_sidecar used wrong file extension for discovering gdl side car files * run_macro: ensure that source folder parameter is case insensitive Co-authored-by: Travis Abendshien <46939827+CyanVoxel@users.noreply.github.com> --------- Co-authored-by: Travis Abendshien <46939827+CyanVoxel@users.noreply.github.com> --- tagstudio/src/core/library.py | 2 +- tagstudio/src/core/ts_core.py | 2 +- tagstudio/src/qt/ts_qt.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tagstudio/src/core/library.py b/tagstudio/src/core/library.py index 9d2e48f6..3fb2dc90 100644 --- a/tagstudio/src/core/library.py +++ b/tagstudio/src/core/library.py @@ -2024,7 +2024,7 @@ class Library: # elif meta_tags_field_indices: # priority_field_index = meta_tags_field_indices[0] - if priority_field_index > 0: + if priority_field_index >= 0: self.update_entry_field( entry_id, priority_field_index, [matching[0]], "append" ) diff --git a/tagstudio/src/core/ts_core.py b/tagstudio/src/core/ts_core.py index 63ac30e6..0cd27d67 100644 --- a/tagstudio/src/core/ts_core.py +++ b/tagstudio/src/core/ts_core.py @@ -31,7 +31,7 @@ class TagStudioCore: json_dump = {} info = {} _filepath: Path = Path(filepath) - _filepath = _filepath.parent / (_filepath.stem + ".json") + _filepath = _filepath.parent / (_filepath.name + ".json") # NOTE: This fixes an unknown (recent?) bug in Gallery-DL where Instagram sidecar # files may be downloaded with indices starting at 1 rather than 0, unlike the posts. diff --git a/tagstudio/src/qt/ts_qt.py b/tagstudio/src/qt/ts_qt.py index c298dd31..41874188 100644 --- a/tagstudio/src/qt/ts_qt.py +++ b/tagstudio/src/qt/ts_qt.py @@ -968,7 +968,7 @@ class QtDriver(QObject): """Runs a specific Macro on an Entry given a Macro name.""" entry = self.lib.get_entry(entry_id) path = self.lib.library_dir / entry.path / entry.filename - source = entry.path.parts[0] + source = "" if entry.path == Path(".") else entry.path.parts[0].lower() if name == "sidecar": self.lib.add_generic_data_to_entry( self.core.get_gdl_sidecar(path, source), entry_id