diff --git a/engine.py b/engine.py index e0e1c27..ef6d587 100644 --- a/engine.py +++ b/engine.py @@ -416,4 +416,14 @@ class SorterEngine: # New name already exists pass finally: - conn.close() \ No newline at end of file + conn.close() + + @staticmethod + def delete_category(name): + """Deletes a category and clears any staged tags associated with it.""" + conn = sqlite3.connect(SorterEngine.DB_PATH) + cursor = conn.cursor() + cursor.execute("DELETE FROM categories WHERE name = ?", (name,)) + cursor.execute("DELETE FROM staging_area WHERE target_category = ?", (name,)) + conn.commit() + conn.close() \ No newline at end of file