Settings: add "Use Spotify Free for background enrichment" toggle

User-facing opt-in for metadata.spotify_free_enrichment (the engine landed in
38461295). A checkbox in the Metadata Source frame, independent of the primary-
source dropdown, so a user with an official Spotify account connected can choose
to run the bulk enrichment worker on the no-creds Spotify Free source — sparing
their official API quota / dodging rate-limit bans for interactive search + sync.
Help text notes the trade-off (no artist genres from Free). Default off.

Wiring mirrors the existing spotify_free setting: saved in the metadata payload,
loaded into the checkbox, persisted via the generic metadata.* config loop (no
backend change). Auto-save already covers checkboxes in #settings-page.
This commit is contained in:
BoulderBadgeDad 2026-06-09 12:27:44 -07:00
parent 38461295c2
commit fd3ce8ba6e
2 changed files with 15 additions and 1 deletions

View file

@ -3855,6 +3855,15 @@
<strong>Discogs</strong> — needs a personal access token.<br><br>
Tip: if you pick <strong>Spotify Free</strong> and later connect a real Spotify account, it uses the official account normally and only falls back to free while Spotify is rate-limited — then switches back automatically.</div>
</div>
<div class="form-group" style="margin-top: 12px;">
<label style="display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: normal;">
<input type="checkbox" id="metadata-spotify-free-enrichment" style="width: auto; margin: 0;">
<span>Use Spotify Free for background enrichment</span>
</label>
<div class="callback-info">
<div class="callback-help">Runs the background enrichment worker on the no-credentials Spotify Free source even when your Spotify account is connected — sparing your official API quota (and avoiding rate-limit bans) for interactive search and playlist sync, since bulk enrichment is what usually trips Spotify's limits. Needs the bundled Spotify Free package. Trade-off: Spotify Free can't provide artist genres. Leave off to enrich via your official account as usual.</div>
</div>
</div>
</div>
<!-- Spotify Settings -->

View file

@ -1061,6 +1061,8 @@ async function loadSettingsData() {
const _metaSel = (_fbSrc === 'spotify' && settings.metadata?.spotify_free === true)
? 'spotify_free' : _fbSrc;
document.getElementById('metadata-fallback-source').value = _metaSel;
const _efEl = document.getElementById('metadata-spotify-free-enrichment');
if (_efEl) _efEl.checked = settings.metadata?.spotify_free_enrichment === true;
// Populate Hydrabase settings
const hbConfig = settings.hydrabase || {};
@ -2886,7 +2888,10 @@ async function saveSettings(quiet = false) {
// 'Spotify Free' is stored as the spotify source + a flag, so all
// downstream 'spotify' routing is unchanged.
fallback_source: metadataSource === 'spotify_free' ? 'spotify' : metadataSource,
spotify_free: metadataSource === 'spotify_free'
spotify_free: metadataSource === 'spotify_free',
// Independent opt-in: run the enrichment worker on Spotify Free even
// when an official account is connected (spares the official quota).
spotify_free_enrichment: document.getElementById('metadata-spotify-free-enrichment')?.checked || false
},
hydrabase: {
url: document.getElementById('hydrabase-url').value,