Files
alembic/app/templates/genres/index.html
T
andrew 8f1fc458f6 Background long-running actions; confirm destructive ones
- Run now (jobs and playlists), dedup scan, genre preview/apply, and manual
  import now dispatch via BackgroundTasks and redirect immediately, instead
  of awaiting a job that can run for the better part of an hour and hang the
  browser or reverse proxy. Progress shows in the Jobs runs table (which
  already polls); if the pipeline is busy the run records skipped_lock there.
- Fix the import banner, which claimed work was ongoing after the request
  had actually blocked to completion; it now reflects the backgrounded start.
- Add confirmation prompts to the dedup per-row and bulk delete and to
  "Fix genres now", matching the existing confirms on library and playlist
  deletes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 14:31:54 -06:00

59 lines
2.4 KiB
HTML

{% extends "base.html" %}
{% block title %}Genres — alembic{% endblock %}
{% block content %}
<div class="page-header">
<div>
<h1>Genre review</h1>
<p class="subtitle muted">The weekly scheduled run auto-writes genres (low-risk, reversible, GENRE_LOCK-protected) — this shows what it last changed.</p>
</div>
</div>
{% if request.query_params.get('started') %}
<div class="notice">Started in the background. Reload this page in a bit to see the result below, or watch its progress under <a href="/settings/jobs">Jobs</a>. If the pipeline is busy it will show as skipped there.</div>
{% endif %}
<div class="panel" style="max-width:560px;">
<p class="muted" style="margin-top:0;">Preview shows what would change, including overwriting existing genres. Fix writes those changes for real.</p>
<div class="btn-row">
<form method="post" action="/genres/scan" class="inline">
<button type="submit" class="btn btn-ghost">Preview changes</button>
</form>
<form method="post" action="/genres/apply" class="inline"
onsubmit="return confirm('Overwrite genres across your whole library with what Spotify reports? Locked artists are left alone. Preview first if unsure.')">
<button type="submit" class="btn btn-primary">Fix genres now</button>
</form>
</div>
</div>
<h2>Last run</h2>
{% if latest_run %}
<p class="muted">{{ latest_run.mode }} — {{ candidates | length }} change(s)</p>
<div class="table-wrap scroll">
<table>
<thead><tr><th>Artist</th><th>Title</th><th>Old genre</th><th>New genre</th><th></th></tr></thead>
<tbody>
{% for c in candidates %}
<tr>
<td>{{ c.artist }}</td>
<td>{{ c.title }}</td>
<td class="muted">{{ c.old_genre or '(empty)' }}</td>
<td>{{ c.new_genre }}</td>
<td>
<form method="post" action="/genres/lock" class="inline">
<input type="hidden" name="artist" value="{{ c.artist }}">
<input type="hidden" name="genre" value="{{ c.old_genre or '' }}">
<button type="submit" class="btn btn-sm btn-ghost" title="Revert to old genre and lock it">Lock old genre</button>
</form>
</td>
</tr>
{% else %}
<tr class="empty-row"><td colspan="5" class="muted">No changes in the last run.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="muted">No runs yet.</p>
{% endif %}
{% endblock %}