feat: spotify-only matching + optional local-LLM gate + google→bandcamp fallback (closes task/drop-musicbrainz-google-fallback, closes task/ollama-classifier)

Source: human-feedback note 01KVDYV3A35B57N15CRBQDXPCH (project/reddit-spotify-linker,
2026-06-18) — "remove the musicbrainz integration and just use spotify"; a google search
for "<name> bandcamp" fallback; and "would a local llm be better able to categorise these
... include instructions for running something suitable via ollama (16GB M2)".

- Remove MusicBrainz entirely (viaMusicBrainz + url-rels + rate-gate; lib relUrls/mbResult).
  Spotify is now the only music API; it both gates by exact-name match and supplies the
  direct artist link.
- Optional ollama LLM gate (OLLAMA_URL enables it, OLLAMA_MODEL default qwen2.5:3b) called
  over plain HTTP -> stays zero npm-dep. It classifies which candidates are real
  artists/albums (the matching-quality lever). Pure prompt/parse logic in new llm.js
  (unit-tested in llm.test.js); the fetch + resolveAll gate wiring live in resolver.js.
- A confirmed name links to its direct Spotify page when available, else a Google search for
  "<name> bandcamp". New "google" primary platform rendered by the extension (styles.css
  blue accent + platform-aware link title in content.js).
- README: drop MusicBrainz; document the two gates + a runnable local-LLM setup for a 16GB
  MacBook M2. AGENTS.md: flip the old "no ML/NER" standing decision per the human override.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
paul
2026-06-19 12:50:07 +00:00
co-authored by Claude Opus 4.8
parent b97c82d92e
commit ef57761859
10 changed files with 343 additions and 249 deletions
+9 -5
View File
@@ -46,17 +46,21 @@
}
// ---- link building / rewriting --------------------------------------------
// Per the user's "if on spotify, link that, else bandcamp" rule: one link to the
// primary platform, colour-coded so you can tell which at a glance.
// Per the user's "if on spotify, link that, else a Bandcamp Google-search fallback"
// rule: one link to the primary platform, colour-coded so you can tell which at a glance.
function makeLink(label, links) {
const primary = links.primary || { platform: "spotify", url: links.spotify };
const name = links.name || label;
const platform = primary.platform;
const a = document.createElement("a");
a.className = `rsl-link rsl-${primary.platform}`;
a.className = `rsl-link rsl-${platform}`;
a.textContent = label;
a.href = primary.url;
a.target = "_blank";
a.rel = "noopener noreferrer";
a.title = `Open on ${primary.platform === "spotify" ? "Spotify" : "Bandcamp"}`;
a.title = platform === "spotify"
? `Open ${name} on Spotify`
: `Find ${name} on Bandcamp (Google search)`;
return a;
}
@@ -80,7 +84,7 @@
}
// ---- resolver client ------------------------------------------------------
const resolved = new Map(); // candidate string -> { spotify, bandcamp } | null
const resolved = new Map(); // candidate string -> { name, spotify?, google?, primary } | null
// The network call goes through the background script — a page-context fetch to
// http://localhost is blocked by reddit's CSP / mixed-content rules.