db struktur

This commit is contained in:
2026-04-20 00:01:41 +02:00
parent efc30cdbb2
commit f92af40dd7
4 changed files with 90 additions and 40 deletions

View File

@@ -505,19 +505,19 @@ class MainWindow(QMainWindow):
conn.row_factory = sqlite3.Row
rows = conn.execute("""
SELECT s.id, s.title, s.artist, s.album, s.bpm,
s.duration_sec, s.local_path, s.file_format,
s.file_missing,
s.duration_sec,
f.id as file_id, f.local_path, f.file_format, f.file_missing,
GROUP_CONCAT(d.name, ',') AS dance_names,
GROUP_CONCAT(COALESCE(dl.name,''), ',') AS dance_levels,
GROUP_CONCAT(COALESCE(d.choreographer,''), ',') AS dance_choreographers,
GROUP_CONCAT(DISTINCT ad.name) AS alt_dance_names
FROM songs s
JOIN files f ON f.song_id = s.id AND f.file_missing = 0
LEFT JOIN song_dances sd ON sd.song_id = s.id
LEFT JOIN dances d ON d.id = sd.dance_id
LEFT JOIN dance_levels dl ON dl.id = d.level_id
LEFT JOIN song_alt_dances sad ON sad.song_id = s.id
LEFT JOIN dances ad ON ad.id = sad.dance_id
WHERE s.file_missing = 0
GROUP BY s.id
ORDER BY s.artist, s.title
""").fetchall()
@@ -536,6 +536,7 @@ class MainWindow(QMainWindow):
"album": row["album"],
"bpm": row["bpm"],
"duration_sec": row["duration_sec"],
"file_id": row["file_id"],
"local_path": row["local_path"],
"file_format": row["file_format"],
"file_missing": bool(row["file_missing"]),
@@ -1476,4 +1477,4 @@ class MainWindow(QMainWindow):
self._watchdog_proc.terminate()
except Exception:
pass
event.accept()
event.accept()