Fix reorganize modal using hardcoded template instead of saved settings

The enhanced view reorganize modal had a hardcoded default path template
instead of loading the user's saved template from settings. Now fetches
the saved album_path template from /api/settings on modal open.
pull/253/head
Broque Thomas 2 months ago
parent 5d6ccee066
commit 7070b98756

@ -42435,8 +42435,17 @@ async function showReorganizeModal(albumId) {
html += '<div class="reorganize-template-section">';
html += '<label class="reorganize-label">Path Template</label>';
html += '<div class="reorganize-template-hint">Use <code>/</code> to separate folders. The last segment becomes the filename.</div>';
// Load saved template from settings, fall back to default
let savedTemplate = '$albumartist/$albumartist - $album/$track - $title';
try {
const settingsResp = await fetch('/api/settings');
if (settingsResp.ok) {
const settings = await settingsResp.json();
savedTemplate = settings.file_organization?.templates?.album_path || savedTemplate;
}
} catch (_) {}
html += '<input type="text" id="reorganize-template-input" class="reorganize-template-input" ';
html += 'value="$albumartist/$albumartist - $album/$track - $title" ';
html += `value="${savedTemplate.replace(/"/g, '&quot;')}" `;
html += 'placeholder="$albumartist/$album/$track - $title" spellcheck="false">';
html += '</div>';

Loading…
Cancel
Save