Files
furumi-web/src/player/playlist_cover.sql
T
ab b584e660a4
Build and Publish / Build and Publish Docker Image (push) Successful in 3m58s
Unify catalog navigation and playlist editing, align track actions and repair listening totals
2026-11-24 01:39:34 +02:00

13 lines
656 B
SQL

SELECT CASE
WHEN p.cover_hash IS NOT NULL THEN ARRAY['/api/player/playlists/' || p.id || '/cover?v=' || p.cover_hash]
WHEN p.cover_file_id IS NOT NULL THEN ARRAY['/api/player/cover/' || p.cover_file_id || '/small']
ELSE (
SELECT COALESCE((array_agg(url ORDER BY choice) FILTER (WHERE choice IS NOT NULL))[1:4],
(array_agg(url ORDER BY position, item_id) FILTER (WHERE automatic))[1:4], ARRAY[]::text[])
FROM (
SELECT '/api/player/cover/' || art || '/small' AS url,
array_position(p.cover_ids, art) AS choice, position, item_id, automatic
FROM ({candidates}) options
) ranked
) END AS urls