Optimize Last.fm popularity lookups with light and full modes
Build and Publish / Build and Publish Docker Image (push) Successful in 5m22s

This commit is contained in:
Aleksandr Bogomiakov committed 2026-10-16 00:59:09 +01:00
1 parent 2b3b50f7af
commit bd1d3a4ebc
11 files changed
+955 -185

No files matched your search

+11 -1
View File
@@ -13,7 +13,7 @@
</table>
<div style="margin: 1rem 0; display: flex; gap: .5rem; align-items: flex-end;">
{% if job.name_str() != "metadata_backfill" %}
{% if job.name_str() != "metadata_backfill" && job.name_str() != "lastfm_popularity" %}
<form method="post" action="/admin/jobs/{{ job.name_str() }}/run" style="margin:0;">
<button type="submit" style="padding:.4rem 1rem; background:#007bff; color:#fff; border:none; border-radius:4px; cursor:pointer;">{{ t.jobs_run_now }}</button>
</form>
@@ -29,6 +29,16 @@
{% endif %}
</div>
{% if job.name_str() == "lastfm_popularity" %}
<form method="post" action="/admin/jobs/lastfm_popularity/run-options" style="margin:1rem 0;">
<p>{{ t.jobs_lastfm_light_help }}</p>
<label style="display:block; margin-bottom:1rem;">
<input type="checkbox" name="refresh_existing"> {{ t.jobs_lastfm_full }}
</label>
<button type="submit">{{ t.jobs_run_now }}</button>
</form>
{% endif %}
{% if job.name_str() == "metadata_backfill" %}
<h2>{{ t.jobs_metadata_backfill_options }}</h2>
<form method="post" action="/admin/jobs/metadata_backfill/run-options" style="margin:0 0 1.5rem; padding:1rem; background:#fff; border:1px solid #e0e0e0; border-radius:6px;">
+19 -2
View File
@@ -2292,13 +2292,20 @@ tbody tr:hover {
<label><input type="radio" value="overwrite" x-model="artworkBackfillOptions.mode" /> Search all and replace existing</label>
</div>
</div>
<div class="metadata-backfill-options" x-show="isLastfmPopularityJob(activeJob)">
<div class="mode-row">
<label><input type="radio" value="light" x-model="lastfmPopularityOptions.mode" /> Light: unchecked tracks only</label>
<label><input type="radio" value="full" x-model="lastfmPopularityOptions.mode" /> Full: refresh all visible tracks</label>
</div>
<p class="job-param-note">Light mode skips previous matches and tracks confirmed missing. Changed titles or artists and failed lookups are checked again. Full mode also retries previous matches and misses.</p>
</div>
<div class="job-param-note" x-show="activeJob && !jobHasParameterForm(activeJob)">
This task has no manual parameters.
</div>
<div class="toolbar" style="margin-bottom:12px">
<button class="btn primary" type="button" @click="runJob(activeJob)">
<i data-lucide="play"></i>
<span x-text="isMetadataBackfillJob(activeJob) ? 'Run with options' : 'Run now'"></span>
<span x-text="jobHasParameterForm(activeJob) ? 'Run with options' : 'Run now'"></span>
</button>
<button class="btn" type="button" @click="toggleJob(activeJob)">
<i data-lucide="power"></i>
@@ -3811,6 +3818,7 @@ function adminV2() {
musicbrainz_tags: true,
mode: 'fill_missing'
},
lastfmPopularityOptions: { mode: 'light' },
artworkBackfillOptions: {
mode: 'missing'
},
@@ -4624,6 +4632,11 @@ function adminV2() {
method: 'POST',
body: JSON.stringify(this.artworkBackfillPayload())
})
: this.isLastfmPopularityJob(job)
? await this.request(`${this.apiBase}/jobs/lastfm_popularity/run-options`, {
method: 'POST',
body: JSON.stringify({ refresh_existing: this.lastfmPopularityOptions.mode === 'full' })
})
: await this.request(`${this.apiBase}/jobs/${encodeURIComponent(job.name)}/run`, { method: 'POST' });
this.showToast(`Run #${result.run_id} started`);
this.activeJobName = job.name;
@@ -4647,8 +4660,12 @@ function adminV2() {
return job && job.name === 'artwork_backfill';
},
isLastfmPopularityJob(job) {
return job && job.name === 'lastfm_popularity';
},
jobHasParameterForm(job) {
return this.isMetadataBackfillJob(job) || this.isArtworkBackfillJob(job);
return this.isMetadataBackfillJob(job) || this.isArtworkBackfillJob(job) || this.isLastfmPopularityJob(job);
},
metadataBackfillPayload() {