Files
alembic/app/templates/import/index.html
T
andrew 270c9c0ed1 Add manual fix / manual import services and routers
library_edit.update_track_fields: single-track tag edits via `beet modify
-y -m` (subprocess with an argument list, not beets.library.Library
in-process -- an arg-list subprocess has no shell-injection surface to
avoid in the first place, and correctly reuses beets' own configured
path-format/move logic rather than reimplementing it against a hand-built
Library object with guessed config). Every changed field gets a
manual_fix_audit row with old/new values; triggers a Navidrome rescan
afterward if anything changed. Uses "genres" (plural) as the field name,
matching this deployment's actual beets column and every existing script's
convention, not the generic beets docs' singular "genre".

genre_fix.set_artist_genre and retag.retag_from_url wrap the existing
fix-genre.sh and fix-track-metadata.py as callable services rather than
reimplementing their per-format mutagen tag-writing logic.

manual_import: ties pipeline_runner.run_import_track to the manual_imports
table, mirrors import-track.sh's own argument-count-based disambiguation
(0/1/2 args), plus import-me/ listing and upload-with-path-traversal-guard.

routers/library.py + routers/import_.py: browsable library list, a track
detail/edit page (tag edit, artist-wide genre override, retag-from-URL
forms), and the import page (upload + trigger). Minimal templates for now,
Task 9 covers full UI polish.

Verified update_track_fields end-to-end against a REAL beets library (not
mocked): generated a tagged FLAC with ffmpeg/metaflac, imported it via a
real `beet import`, edited artist+title through the service, and confirmed
the file was physically moved to the new path-template location, tags were
rewritten on disk, the DB updated, and both changes landed correctly in
manual_fix_audit. Also verified the full app boots with the new routers
registered and all four new routes correctly redirect to login when
unauthenticated.
2026-07-08 14:01:35 -06:00

46 lines
1.3 KiB
HTML

{% extends "base.html" %}
{% block title %}Import — alembic{% endblock %}
{% block content %}
<h1>Manual import</h1>
{% if request.query_params.get('run_id') %}
<p>Import job started (run id {{ request.query_params.get('run_id') }}). Check the Jobs page for progress.</p>
{% endif %}
<h2>Upload a file into import-me/</h2>
<form method="post" action="/import/upload" enctype="multipart/form-data">
<input type="file" name="file" required>
<button type="submit">Upload</button>
</form>
<h2>Contents of import-me/</h2>
<ul>
{% for name in contents %}
<li>{{ name }}</li>
{% else %}
<li class="muted">(empty)</li>
{% endfor %}
</ul>
<h2>Run import</h2>
<form method="post" action="/import/run">
<label for="source">File/subdir (blank = import everything above)</label>
<input type="text" id="source" name="source" list="import-contents">
<datalist id="import-contents">
{% for name in contents %}
<option value="{{ name }}">
{% endfor %}
</datalist>
<label for="playlist_name">Playlist tag (optional)</label>
<select id="playlist_name" name="playlist_name">
<option value="">(none)</option>
{% for p in playlists %}
<option value="{{ p.name }}">{{ p.name }}</option>
{% endfor %}
</select>
<button type="submit">Import</button>
</form>
{% endblock %}