Skip to content

Commit 85d62e6

Browse files
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>
1 parent 341aa92 commit 85d62e6

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

tagstudio/src/core/library.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,7 @@ def add_generic_data_to_entry(self, data, entry_id: int):
20242024
# elif meta_tags_field_indices:
20252025
# priority_field_index = meta_tags_field_indices[0]
20262026

2027-
if priority_field_index > 0:
2027+
if priority_field_index >= 0:
20282028
self.update_entry_field(
20292029
entry_id, priority_field_index, [matching[0]], "append"
20302030
)

tagstudio/src/core/ts_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def get_gdl_sidecar(self, filepath: str | Path, source: str = "") -> dict:
3131
json_dump = {}
3232
info = {}
3333
_filepath: Path = Path(filepath)
34-
_filepath = _filepath.parent / (_filepath.stem + ".json")
34+
_filepath = _filepath.parent / (_filepath.name + ".json")
3535

3636
# NOTE: This fixes an unknown (recent?) bug in Gallery-DL where Instagram sidecar
3737
# files may be downloaded with indices starting at 1 rather than 0, unlike the posts.

tagstudio/src/qt/ts_qt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ def run_macro(self, name: str, entry_id: int):
968968
"""Runs a specific Macro on an Entry given a Macro name."""
969969
entry = self.lib.get_entry(entry_id)
970970
path = self.lib.library_dir / entry.path / entry.filename
971-
source = entry.path.parts[0]
971+
source = "" if entry.path == Path(".") else entry.path.parts[0].lower()
972972
if name == "sidecar":
973973
self.lib.add_generic_data_to_entry(
974974
self.core.get_gdl_sidecar(path, source), entry_id

0 commit comments

Comments
 (0)