Merge pull request #39 from Thesacraft/main

Update library.py to not duplicate default tags on save
This commit is contained in:
Travis Abendshien 2024-04-24 15:26:46 -07:00 committed by GitHub
commit ac00890c90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -576,7 +576,7 @@ class Library:
if not os.path.isdir(full_collage_path):
os.mkdir(full_collage_path)
def verify_default_tags(self, tag_list: list) -> dict:
def verify_default_tags(self, tag_list: list) -> list:
"""
Ensures that the default builtin tags are present in the Library's
save file. Takes in and returns the tag dictionary from the JSON file.
@ -856,10 +856,10 @@ class Library:
}
print('[LIBRARY] Formatting Tags to JSON...')
file_to_save['tags'] = self.verify_default_tags(file_to_save['tags'])
for tag in self.tags:
file_to_save["tags"].append(tag.compressed_dict())
file_to_save['tags'] = self.verify_default_tags(file_to_save['tags'])
print('[LIBRARY] Formatting Entries to JSON...')
for entry in self.entries:
file_to_save["entries"].append(entry.compressed_dict())