Update engine.py
This commit is contained in:
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user