Sync playlister

This commit is contained in:
2026-04-13 13:53:47 +02:00
parent c3623962c5
commit e86173f7ec
2 changed files with 68 additions and 6 deletions

View File

@@ -266,9 +266,33 @@ def pull(
]
})
# Egne playlister
my_playlists = []
for p in db.query(Project).filter_by(owner_id=me.id).all():
songs_out = []
for ps in p.project_songs:
song = db.query(Song).filter_by(id=ps.song_id).first()
if not song:
continue
songs_out.append({
"title": song.title,
"artist": song.artist,
"position": ps.position,
"status": ps.status,
"is_workshop": ps.is_workshop,
"dance_override": ps.dance_override or "",
})
my_playlists.append({
"server_id": p.id,
"name": p.name,
"description": p.description or "",
"songs": sorted(songs_out, key=lambda x: x["position"]),
})
return {
"levels": levels,
"dances": dances,
"community": community,
"shared": shared,
"levels": levels,
"dances": dances,
"community": community,
"shared": shared,
"my_playlists": my_playlists,
}