This commit is contained in:
mike
2025-12-12 23:04:51 +01:00
parent 56b2db82fc
commit 87550e426a
14 changed files with 132 additions and 122 deletions

View File

@@ -70,13 +70,13 @@ class ClassificationEngine:
if disk:
cursor.execute("""
SELECT path, checksum
FROM files_bak
WHERE disk = %s AND category IS NULL
FROM files
WHERE disk_label = %s AND category IS NULL
""", (disk,))
else:
cursor.execute("""
SELECT path, checksum
FROM files_bak
FROM files
WHERE category IS NULL
""")
@@ -149,7 +149,7 @@ class ClassificationEngine:
from psycopg2.extras import execute_batch
query = """
UPDATE files_bak
UPDATE files
SET category = %s
WHERE path = %s
"""
@@ -188,7 +188,7 @@ class ClassificationEngine:
category,
COUNT(*) as file_count,
SUM(size) as total_size
FROM files_bak
FROM files
WHERE category IS NOT NULL
GROUP BY category
ORDER BY total_size DESC
@@ -214,7 +214,7 @@ class ClassificationEngine:
conn = self._get_connection()
cursor = conn.cursor()
cursor.execute("SELECT COUNT(*) FROM files_bak WHERE category IS NULL")
cursor.execute("SELECT COUNT(*) FROM files WHERE category IS NULL")
count = cursor.fetchone()[0]
cursor.close()
@@ -241,7 +241,7 @@ class ClassificationEngine:
cursor = conn.cursor()
cursor.execute("""
UPDATE files_bak
UPDATE files
SET category = %s
WHERE category = %s
""", (new_category, old_category))
@@ -278,7 +278,7 @@ class ClassificationEngine:
# Get categorized files
cursor.execute("""
SELECT path, category
FROM files_bak
FROM files
WHERE category IS NOT NULL
""")
@@ -326,7 +326,7 @@ class ClassificationEngine:
cursor.execute("""
SELECT DISTINCT category
FROM files_bak
FROM files
WHERE category IS NOT NULL
ORDER BY category
""")