Playlist fejl
This commit is contained in:
@@ -646,13 +646,11 @@ def get_playlist_with_songs(playlist_id: int) -> dict:
|
|||||||
|
|
||||||
songs = conn.execute("""
|
songs = conn.execute("""
|
||||||
SELECT ps.id as ps_id, ps.position, ps.status,
|
SELECT ps.id as ps_id, ps.position, ps.status,
|
||||||
s.*, GROUP_CONCAT(d.name ORDER BY sd.dance_order) as dances
|
ps.is_workshop, ps.dance_override,
|
||||||
|
s.*
|
||||||
FROM playlist_songs ps
|
FROM playlist_songs ps
|
||||||
JOIN songs s ON s.id = ps.song_id
|
JOIN songs s ON s.id = ps.song_id
|
||||||
LEFT JOIN song_dances sd ON sd.song_id = s.id
|
|
||||||
LEFT JOIN dances d ON d.id = sd.dance_id
|
|
||||||
WHERE ps.playlist_id = ?
|
WHERE ps.playlist_id = ?
|
||||||
GROUP BY ps.id
|
|
||||||
ORDER BY ps.position
|
ORDER BY ps.position
|
||||||
""", (playlist_id,)).fetchall()
|
""", (playlist_id,)).fetchall()
|
||||||
|
|
||||||
|
|||||||
@@ -967,10 +967,15 @@ class MainWindow(QMainWindow):
|
|||||||
dialog.playlist_loaded.connect(self._on_playlist_loaded)
|
dialog.playlist_loaded.connect(self._on_playlist_loaded)
|
||||||
dialog.exec()
|
dialog.exec()
|
||||||
|
|
||||||
def _on_playlist_loaded(self, name: str, songs: list[dict]):
|
def _on_playlist_loaded(self, name: str, songs: list[dict], pl_id: int):
|
||||||
self._stop()
|
self._stop()
|
||||||
self._playlist_panel.load_songs(songs)
|
self._playlist_panel.load_songs(songs)
|
||||||
self._playlist_panel.set_playlist_name(name)
|
self._playlist_panel.set_playlist_name(name)
|
||||||
|
if pl_id:
|
||||||
|
self._playlist_panel._named_playlist_id = pl_id
|
||||||
|
self._playlist_panel._save_named_playlist_id(pl_id)
|
||||||
|
self._playlist_panel._btn_save_current.setEnabled(True)
|
||||||
|
self._playlist_panel._btn_save_current.setToolTip(f"Gem ændringer til '{name}'")
|
||||||
self._set_status(f"Indlæst: {name} ({len(songs)} sange)", 3000)
|
self._set_status(f"Indlæst: {name} ({len(songs)} sange)", 3000)
|
||||||
|
|
||||||
def _open_tag_editor(self, song: dict):
|
def _open_tag_editor(self, song: dict):
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class PlaylistManagerDialog(QDialog):
|
|||||||
2. Indlæs gemt liste
|
2. Indlæs gemt liste
|
||||||
3. Importer fra fil (M3U / M3U8 / tekst)
|
3. Importer fra fil (M3U / M3U8 / tekst)
|
||||||
"""
|
"""
|
||||||
playlist_loaded = pyqtSignal(str, list) # (navn, liste af dict)
|
playlist_loaded = pyqtSignal(str, list, int) # (navn, sange, pl_id)
|
||||||
|
|
||||||
def __init__(self, current_songs: list[dict], parent=None):
|
def __init__(self, current_songs: list[dict], parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
@@ -161,7 +161,7 @@ class PlaylistManagerDialog(QDialog):
|
|||||||
"file_missing": bool(row.get("file_missing", False)),
|
"file_missing": bool(row.get("file_missing", False)),
|
||||||
"dances": [d["name"] for d in dances],
|
"dances": [d["name"] for d in dances],
|
||||||
})
|
})
|
||||||
self.playlist_loaded.emit(pl["name"], songs)
|
self.playlist_loaded.emit(pl["name"], songs, pl["id"])
|
||||||
self._load_status.setText(f"✓ Indlæst: {pl['name']} ({len(songs)} sange)")
|
self._load_status.setText(f"✓ Indlæst: {pl['name']} ({len(songs)} sange)")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._load_status.setText(f"Fejl: {e}")
|
self._load_status.setText(f"Fejl: {e}")
|
||||||
@@ -316,7 +316,7 @@ class PlaylistManagerDialog(QDialog):
|
|||||||
missing.append(p)
|
missing.append(p)
|
||||||
|
|
||||||
if found:
|
if found:
|
||||||
self.playlist_loaded.emit(name, found)
|
self.playlist_loaded.emit(name, found, 0)
|
||||||
status = f"✓ Importeret {len(found)} sange som \"{name}\""
|
status = f"✓ Importeret {len(found)} sange som \"{name}\""
|
||||||
if missing:
|
if missing:
|
||||||
status += f"\n⚠ {len(missing)} filer ikke fundet"
|
status += f"\n⚠ {len(missing)} filer ikke fundet"
|
||||||
|
|||||||
Reference in New Issue
Block a user