Update engine.py

This commit is contained in:
2026-01-20 13:21:11 +01:00
parent c89cecd43f
commit c56b07f999

View File

@@ -574,6 +574,7 @@ class SorterEngine:
Call this when loading/reloading a folder. Call this when loading/reloading a folder.
Returns the number of tags restored. Returns the number of tags restored.
""" """
try:
conn = sqlite3.connect(SorterEngine.DB_PATH) conn = sqlite3.connect(SorterEngine.DB_PATH)
cursor = conn.cursor() cursor = conn.cursor()
@@ -581,6 +582,7 @@ class SorterEngine:
cursor.execute('''CREATE TABLE IF NOT EXISTS folder_tags cursor.execute('''CREATE TABLE IF NOT EXISTS folder_tags
(folder_path TEXT, filename TEXT, category TEXT, tag_index INTEGER, (folder_path TEXT, filename TEXT, category TEXT, tag_index INTEGER,
PRIMARY KEY (folder_path, filename))''') PRIMARY KEY (folder_path, filename))''')
conn.commit()
# Get saved tags for this folder # Get saved tags for this folder
cursor.execute( cursor.execute(
@@ -620,6 +622,9 @@ class SorterEngine:
conn.commit() conn.commit()
conn.close() conn.close()
return restored return restored
except Exception as e:
print(f"Error restoring folder tags: {e}")
return 0
@staticmethod @staticmethod
def clear_folder_tags(folder_path): def clear_folder_tags(folder_path):