Update engine.py

This commit is contained in:
2026-01-20 13:19:02 +01:00
parent 37f6166b37
commit c89cecd43f

View File

@@ -540,6 +540,11 @@ class SorterEngine:
conn = sqlite3.connect(SorterEngine.DB_PATH)
cursor = conn.cursor()
# Ensure table exists (for existing databases)
cursor.execute('''CREATE TABLE IF NOT EXISTS folder_tags
(folder_path TEXT, filename TEXT, category TEXT, tag_index INTEGER,
PRIMARY KEY (folder_path, filename))''')
saved_count = 0
for orig_path, info in staged.items():
# Only save tags for files that are in this folder (or subfolders)
@@ -572,6 +577,11 @@ class SorterEngine:
conn = sqlite3.connect(SorterEngine.DB_PATH)
cursor = conn.cursor()
# Ensure table exists (for existing databases)
cursor.execute('''CREATE TABLE IF NOT EXISTS folder_tags
(folder_path TEXT, filename TEXT, category TEXT, tag_index INTEGER,
PRIMARY KEY (folder_path, filename))''')
# Get saved tags for this folder
cursor.execute(
"SELECT filename, category, tag_index FROM folder_tags WHERE folder_path = ?",