feat: batch fix artist sort tags + rename folder when override is added
- edit-metadata: use albumArtistSort (when provided) for artist folder naming instead of auto-converted romajiAlbumArtist — ensures manual overrides sent by the download pipeline also place files in the correct folder - Add POST /api/fix-artist-sort endpoint: searches Navidrome for all songs where artist or albumArtist matches the kanji, re-writes ARTISTSORT + ALBUMARTISTSORT via ffmpeg (-map_metadata 0 preserves all other existing tags), moves each file to the correct artist folder, cleans up empty old dirs, triggers Navidrome rescan — returns a job ID for progress tracking - addRomajiOverrideUI: after saving a new override, calls fix-artist-sort and shows a job card with live progress Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
0a2736e893
commit
d777301c20
2 files changed
+140
-2
No files matched your search
@@ -89,7 +89,7 @@ function _renderRomajiOverrides() {
|
||||
</div>`
|
||||
).join('');
|
||||
}
|
||||
export function addRomajiOverrideUI() {
|
||||
export async function addRomajiOverrideUI() {
|
||||
const k = (document.getElementById('ro-kanji')?.value || '').trim();
|
||||
const v = (document.getElementById('ro-romaji')?.value || '').trim();
|
||||
if (!k || !v) { toast('⚠ Kanji und Romaji eingeben'); return; }
|
||||
@@ -97,6 +97,20 @@ export function addRomajiOverrideUI() {
|
||||
document.getElementById('ro-kanji').value = '';
|
||||
document.getElementById('ro-romaji').value = '';
|
||||
_renderRomajiOverrides();
|
||||
// Batch-fix existing songs in the library
|
||||
if (!S.cfg.backendUrl || !S.cfg.url || !S.cfg.user || !S.cfg.pass) return;
|
||||
try {
|
||||
const jobId = 'job_' + Date.now();
|
||||
addJob(jobId, `Romaji-Fix: ${v}`, k, 'fix-sort');
|
||||
const res = await fetch(`${S.cfg.backendUrl}/api/fix-artist-sort`, {
|
||||
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ ndUrl: S.cfg.url, user: S.cfg.user, pass: S.cfg.pass, artistKanji: k, artistSort: v, jobId }),
|
||||
});
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
pollJob(jobId);
|
||||
} catch (e) {
|
||||
toast('⚠ Fix-Artist-Sort: ' + e.message);
|
||||
}
|
||||
}
|
||||
export function removeRomajiOverrideUI(kanji) {
|
||||
removeRomajiOverride(kanji);
|
||||
|
||||
Reference in new issue
Block a user