Nova pàgina de llistes

This commit is contained in:
marc
2025-12-21 17:09:59 +01:00
parent ac79785cf0
commit fdcda1b566
37 changed files with 323 additions and 33 deletions

View File

@@ -69,3 +69,35 @@ def get_playlist_name(playlist_id: int, con: Connection | None = None) -> str |
_ = cur.execute(query, data)
row = cur.fetchone()
return row[0] if row else None
def get_all_playlists(logged_in: bool = False, con: Connection | None = None) -> Iterator[model.Playlist]:
if logged_in:
# Show all playlists for logged in users
query = """
SELECT id, name, hidden
FROM playlists
ORDER BY id ASC
"""
else:
# Show only visible playlists for non-logged in users
query = """
SELECT id, name, hidden
FROM playlists
WHERE hidden = 0
ORDER BY id ASC
"""
with get_connection(con) as con:
cur = con.cursor()
_ = cur.execute(query)
rows = cur.fetchall()
for row in rows:
# Convert to Playlist model without sets for list view
yield model.Playlist(
id=row[0],
name=row[1],
sets=[], # Empty sets list for now
hidden=bool(row[2])
)