Synk virker

This commit is contained in:
2026-04-20 01:41:24 +02:00
parent f92af40dd7
commit 8a4c879213
4 changed files with 163 additions and 98 deletions

View File

@@ -419,13 +419,13 @@ def get_all_songs_with_files(limit: int = 5000) -> list:
# ── Playlister ────────────────────────────────────────────────────────────────
def create_playlist(name: str, description: str = "") -> str:
def create_playlist(name: str, description: str = "", tags: str = "") -> str:
import uuid as _uuid
pl_id = str(_uuid.uuid4())
with get_db() as conn:
conn.execute(
"INSERT INTO playlists (id, name, description) VALUES (?,?,?)",
(pl_id, name, description)
"INSERT INTO playlists (id, name, description, tags) VALUES (?,?,?,?)",
(pl_id, name, description, tags)
)
return pl_id
@@ -434,7 +434,9 @@ def get_playlists(tag_filter: str | None = None) -> list:
with get_db() as conn:
if tag_filter:
return conn.execute("""
SELECT p.*, COUNT(ps.id) as song_count
SELECT p.id, p.name, p.description, p.tags, p.api_project_id,
p.is_linked, p.server_permission, p.is_deleted, p.created_at,
COUNT(ps.position) as song_count
FROM playlists p
LEFT JOIN playlist_songs ps ON ps.playlist_id = p.id
WHERE p.name != '__aktiv__' AND p.is_deleted = 0
@@ -444,7 +446,9 @@ def get_playlists(tag_filter: str | None = None) -> list:
f"%, {tag_filter}", tag_filter)).fetchall()
else:
return conn.execute("""
SELECT p.*, COUNT(ps.id) as song_count
SELECT p.id, p.name, p.description, p.tags, p.api_project_id,
p.is_linked, p.server_permission, p.is_deleted, p.created_at,
COUNT(ps.position) as song_count
FROM playlists p
LEFT JOIN playlist_songs ps ON ps.playlist_id = p.id
WHERE p.name != '__aktiv__' AND p.is_deleted = 0
@@ -506,6 +510,10 @@ def add_song_to_playlist(playlist_id: str, song_id: str,
# ── Dans-tags ─────────────────────────────────────────────────────────────────
def get_all_playlist_tags() -> list[str]:
return get_playlist_tags()
def get_playlist_tags() -> list[str]:
with get_db() as conn:
rows = conn.execute(