Files
alembic/app/templates/playlists/detail.html
T
andrew c87ddc2649 Dashboard detail, library filtering/pagination, simplified playlist times,
job descriptions

Dashboard: format breakdown (FLAC/MP3/etc. counts), approximate library
size (bitrate*length/8, same approximation `beet stats` itself uses --
verified to match its "100.5 GiB" output exactly against the real
library), and a credential auth-state summary per scope (configured y/n
plus, for Bandcamp, cookie expiry parsed locally from the stored cookie
jar -- deliberately not a live network probe like pipeline-status.sh's
Qobuz check, since this renders on every dashboard load).

Library: was one unfiltered page dumping all 4072 tracks. Added search
(artist/title/album), playlist and format filter dropdowns, and real
SQL-level pagination (LIMIT/OFFSET, not fetch-everything-then-slice).
beets_service gained count_items()/distinct_formats() to support this.

Playlists: cron_expr is still the stored/scheduled representation, but the
UI now shows and edits a plain daily time picker instead of raw cron
syntax -- every playlist schedule today is a simple daily HH:MM anyway.
playlist_service.cron_to_time()/time_to_cron() convert at the router
boundary; verified round-trip against all real playlist cron values.

Jobs: each maintenance job now shows a short one-line description of what
it actually does (MAINTENANCE_JOB_DESCRIPTIONS), and "next run" is
formatted consistently with playlists' time style (HH:MM, with a day
qualifier for non-today runs -- maintenance jobs can be weekly/monthly,
unlike playlists' plain daily schedule).

Verified end-to-end against the real production data (4072 tracks, 100.5
GiB, real credentials): stats/format-breakdown/search/pagination all
correct, all 7 credential scopes report configured with Bandcamp's real
cookie expiry (325 days), and a full authenticated page-render sweep
(dashboard, library with every filter combination, playlist detail,
jobs) all returned 200 with no template errors.
2026-07-08 15:39:22 -06:00

76 lines
3.2 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ playlist.name }} — alembic{% endblock %}
{% block content %}
<a class="back-link" href="/playlists">&larr; back to playlists</a>
<div class="page-header">
<div>
<h1>{{ playlist.name }}</h1>
<p class="subtitle muted"><a href="{{ playlist.spotify_url }}">{{ playlist.spotify_url }}</a></p>
</div>
<div class="actions">
<form method="post" action="/jobs/playlist:{{ playlist.name }}/run" class="inline">
<button type="submit" class="btn btn-primary">Run now</button>
</form>
</div>
</div>
<div class="panel" style="max-width:560px;">
<form method="post" action="/playlists/{{ playlist.id }}">
<label class="checkbox-field"><input type="checkbox" name="active" value="true" {{ "checked" if playlist.active }}> Active</label>
<div class="field">
<label for="sync_time">Sync time (daily)</label>
<input type="time" id="sync_time" name="sync_time" value="{{ sync_time }}">
<span class="hint">Leave blank for unscheduled/manual-only.</span>
</div>
<label class="checkbox-field"><input type="checkbox" name="no_m3u" value="true" {{ "checked" if playlist.no_m3u }}> Skip M3U</label>
<div class="field wide">
<label for="notes">Notes</label>
<textarea id="notes" name="notes" rows="3">{{ playlist.notes or '' }}</textarea>
</div>
<button type="submit" class="btn">Save</button>
</form>
</div>
<h2>Status</h2>
{% if error %}
<div class="notice warning">Couldn't fetch live status: {{ error }}</div>
{% elif status %}
{% set status_meta = {
"IN_LIBRARY": ("var(--status-success)", "In library"),
"QUARANTINED": ("var(--status-warning)", "Quarantined"),
"DOWNLOADED_PENDING_IMPORT": ("var(--status-info)", "Downloaded, pending import"),
"NOT_YET_ATTEMPTED": ("var(--status-muted)", "Not yet attempted")
} %}
{% set total = status.counts.values() | sum %}
<div class="status-bar">
{% for key, count in status.counts.items() %}
{% if count %}
<span style="width: {{ (count / total * 100) if total else 0 }}%; background: {{ status_meta.get(key, ('var(--status-muted)', key))[0] }};"></span>
{% endif %}
{% endfor %}
</div>
<div class="status-legend">
{% for key, count in status.counts.items() %}
<span class="item"><span class="dot" style="background: {{ status_meta.get(key, ('var(--status-muted)', key))[0] }}; color: {{ status_meta.get(key, ('var(--status-muted)', key))[0] }};"></span><strong>{{ count }}</strong> {{ status_meta.get(key, (None, key))[1] }}</span>
{% endfor %}
</div>
{% set badge_class = {"IN_LIBRARY": "badge-success", "QUARANTINED": "badge-warning", "DOWNLOADED_PENDING_IMPORT": "badge-info", "NOT_YET_ATTEMPTED": "badge-muted"} %}
<div class="table-wrap scroll">
<table>
<thead><tr><th>Artist</th><th>Title</th><th>Status</th></tr></thead>
<tbody>
{% for t in status.tracks %}
<tr>
<td>{{ t.artist }}</td>
<td>{{ t.title }}</td>
<td><span class="badge {{ badge_class.get(t.status, 'badge-muted') }}">{{ status_meta.get(t.status, (None, t.status))[1] }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% endblock %}