Rettelser og reset
This commit is contained in:
@@ -646,10 +646,11 @@ def get_playlist_with_songs(playlist_id: int) -> dict:
|
||||
|
||||
songs = conn.execute("""
|
||||
SELECT ps.id as ps_id, ps.position, ps.status,
|
||||
s.*, GROUP_CONCAT(sd.dance_name ORDER BY sd.dance_order) as dances
|
||||
s.*, GROUP_CONCAT(d.name ORDER BY sd.dance_order) as dances
|
||||
FROM playlist_songs ps
|
||||
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 = ?
|
||||
GROUP BY ps.id
|
||||
ORDER BY ps.position
|
||||
|
||||
@@ -54,10 +54,10 @@ class SyncManager:
|
||||
def _run():
|
||||
try:
|
||||
payload = self._build_push_payload()
|
||||
logger.info(f"Push: {len(payload['songs'])} sange, {len(payload['playlists'])} playlister")
|
||||
logger.info(f"Push OK: {len(payload['songs'])} sange")
|
||||
result = self._post("/sync/push", payload)
|
||||
self._save_playlist_ids(result.get("playlist_id_map", {}))
|
||||
logger.info(f"Push OK: {result}")
|
||||
logger.info(f"Push OK: {result.get('songs_synced', '?')} sange synkroniseret")
|
||||
if on_done:
|
||||
on_done(result)
|
||||
except Exception as e:
|
||||
@@ -88,9 +88,7 @@ class SyncManager:
|
||||
try:
|
||||
result = self._get("/sync/pull")
|
||||
pl_count = len(result.get("my_playlists", []))
|
||||
logger.info(f"Pull: {len(result.get('dances', []))} danse, {pl_count} playlister")
|
||||
for pl in result.get("my_playlists", []):
|
||||
logger.info(f" Playliste fra server: '{pl['name']}' ({len(pl.get('songs',[]))} sange)")
|
||||
logger.info(f"Pull OK: {pl_count} playlister")
|
||||
self._apply_pull(result)
|
||||
if on_done:
|
||||
on_done(result)
|
||||
@@ -104,16 +102,15 @@ class SyncManager:
|
||||
"""Push og derefter pull i samme tråd."""
|
||||
def _run():
|
||||
try:
|
||||
logger.info("push_and_pull: bygger payload...")
|
||||
payload = self._build_push_payload()
|
||||
logger.info(f"push_and_pull: sender {len(payload['songs'])} sange, {len(payload['playlists'])} playlister")
|
||||
push_result = self._post("/sync/push", payload)
|
||||
logger.info(f"push_and_pull: push OK — {push_result}")
|
||||
pull_result = self._get("/sync/pull")
|
||||
pl_count = len(pull_result.get("my_playlists", []))
|
||||
logger.info(f"push_and_pull: pull OK — {pl_count} playlister")
|
||||
for pl in pull_result.get("my_playlists", []):
|
||||
logger.info(f" Playliste: '{pl['name']}' ({len(pl.get('songs',[]))} sange)")
|
||||
logger.info(
|
||||
f"Sync OK — {len(payload['songs'])} sange, "
|
||||
f"{len(payload['playlists'])} playlister, "
|
||||
f"{pl_count} server-playlister"
|
||||
)
|
||||
self._apply_pull(pull_result)
|
||||
if on_done:
|
||||
on_done({"push": push_result, "pull": pull_result})
|
||||
|
||||
Reference in New Issue
Block a user