Use embedded player from artist, label, & tracks

This commit is contained in:
Cadence Ember 2025-04-06 23:20:22 +12:00
parent aa1095eef2
commit 61f3dbeb5f
4 changed files with 4 additions and 4 deletions

View file

@ -27,5 +27,5 @@ block view
span.s-tag--sponsor!= icons.get("flower", 16) span.s-tag--sponsor!= icons.get("flower", 16)
= label = label
each preview in item.previews each preview in item.previews
a.d-flex(href=preview.item_url target="_blank") a.d-flex(href=`/api/play/${preview.item_type}/${preview.item_id}` hx-target="#player" hx-select="#player" hx-indicator="null" hx-push-url="false")
img(loading="lazy" src=preview.item_art_url width=210 height=210 style="height: auto; width: auto; max-height: 70px") img(loading="lazy" src=preview.item_art_url width=210 height=210 style="height: auto; width: auto; max-height: 70px")

View file

@ -27,5 +27,5 @@ block view
span.s-tag--sponsor!= icons.get("compact-disc", 16) span.s-tag--sponsor!= icons.get("compact-disc", 16)
= item.total_duration = item.total_duration
each preview in item.previews each preview in item.previews
a.d-flex(href=preview.item_url target="_blank") a.d-flex(href=`/api/play/${preview.item_type}/${preview.item_id}` hx-target="#player" hx-select="#player" hx-indicator="null" hx-push-url="false")
img(loading="lazy" src=preview.item_art_url width=210 height=210 style="height: auto; width: auto; max-height: 70px") img(loading="lazy" src=preview.item_art_url width=210 height=210 style="height: auto; width: auto; max-height: 70px")

View file

@ -21,7 +21,7 @@ block view
| ☆ | ☆
else else
= item.track_number || "-" = item.track_number || "-"
td: a(href=item.item_url target="_blank")= item.title td: a(href=`/api/play/${item.item_type}/${item.item_id}` hx-target="#player" hx-select="#player" hx-indicator="null" hx-push-url="false")= item.title
td= item.artist td= item.artist
td= item.item_title td= item.item_title
- let label = item.band_url.replace(/https?:\/\/(.*?)\.bandcamp\.com.*/, "$1") - let label = item.band_url.replace(/https?:\/\/(.*?)\.bandcamp\.com.*/, "$1")

View file

@ -36,7 +36,7 @@ const sqls = {
function loadPreviews(locals, field, number, whereClause, account, filter_field, filter, filter_fuzzy) { function loadPreviews(locals, field, number, whereClause, account, filter_field, filter, filter_fuzzy) {
const params = [account, number] const params = [account, number]
let sql = `SELECT ${field}, item_url, item_art_url FROM (SELECT ${field}, item_url, item_art_url, row_number() OVER (PARTITION BY ${field} ORDER BY purchased DESC) AS row_number FROM item {JOIN TAG} WHERE account = ? {WHERE}) WHERE row_number <= ?` let sql = `SELECT ${field}, item_id, item_type, item_art_url FROM (SELECT ${field}, item_id, item_type, item_art_url, row_number() OVER (PARTITION BY ${field} ORDER BY purchased DESC) AS row_number FROM item {JOIN TAG} WHERE account = ? {WHERE}) WHERE row_number <= ?`
sql = sql.replace("{WHERE}", whereClause) sql = sql.replace("{WHERE}", whereClause)
if (whereClause) { if (whereClause) {
if (filter_field === "band_url" || filter_fuzzy) { if (filter_field === "band_url" || filter_fuzzy) {