Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
match DistroKid's fixed artist across case and spacing, and report its spelling
[._.]/ Adam Eivy2f3360dc7843
diff --git a/client/src/lib/distrokidForm.test.js b/client/src/lib/distrokidForm.test.jsindex 8e20394fe1..d1e0437f3f 100644--- a/client/src/lib/distrokidForm.test.js+++ b/client/src/lib/distrokidForm.test.js@@ -134,6 +134,12 @@ describe('DistroKid artist', () => {expect(setDistrokidArtist('ExampleArtist')).toEqual({ ok: true, fixed: 'exampleartist' });});+ it('matches the hidden artist across case and spacing, and reports the account spelling', () => {+ document.body.innerHTML = '<input type="hidden" id="artistName" name="bandname" value=" exampleartist ">';+ expect(setDistrokidArtist('Example Artist')).toEqual({ ok: true, fixed: 'exampleartist' });+ expect(setDistrokidArtist(' Example Artist ')).toEqual({ ok: true, fixed: 'exampleartist' });+ });+it("names the account's own artist when it differs", () => {document.body.innerHTML = '<input type="hidden" id="artistName" name="bandname" value="exampleartist">';expect(setDistrokidArtist('Someone Else')).toEqual({ ok: false, fixed: 'exampleartist' });diff --git a/server/lib/distrokidForm.js b/server/lib/distrokidForm.jsindex a7072682f2..7ad761eb5b 100644--- a/server/lib/distrokidForm.js+++ b/server/lib/distrokidForm.js@@ -183,7 +183,8 @@ export function untickDistrokidExtras() {/*** Set the release's artist. A plan with several artists shows a field (or a* picker); an account with one artist renders it as a hidden input that- * already holds that artist, so there it is only checked. Resolves+ * already holds that artist, so there it is only checked (ignoring case and+ * spacing). Resolves* `{ ok, fixed }`: `fixed` is the account's own artist when the form does not* let it change, so a mismatch can name both.*/@@ -205,6 +206,8 @@ export function setDistrokidArtist(artist) {field.blur?.();return { ok: true, fixed: null };}- const fixed = fields.find((e) => e.value)?.value || null;- return { ok: !!fixed && fixed.toLowerCase() === artist.toLowerCase(), fixed };+ // DistroKid may store the name with different case or spacing ("exampleartist" for "Example Artist").+ const squash = (v) => v.replace(/\s+/g, '').toLowerCase();+ const fixed = fields.find((e) => e.value.trim())?.value.trim() || null;+ return { ok: !!fixed && squash(fixed) === squash(artist), fixed };}diff --git a/server/services/musicVideo/publish/distrokid.js b/server/services/musicVideo/publish/distrokid.jsindex f85aa81638..6188c44d31 100644--- a/server/services/musicVideo/publish/distrokid.js+++ b/server/services/musicVideo/publish/distrokid.js@@ -58,10 +58,11 @@ export const distrokidAdapter = {// The song count rebuilds the form, so it goes first.await soft('number of songs (1)', () => setValue(page, '#howManySongsOnThisAlbum, select[name=howmanysongs]', '1'));await page.waitForTimeout(1500);+ let releasedAs = payload.artist;await step(label, 'set the artist', async () => {// An account with one artist fixes it in a hidden field, so it is checked, not typed.const { ok, fixed } = await page.evaluate(setDistrokidArtist, payload.artist);- if (ok) return;+ if (ok) { releasedAs = fixed || payload.artist; return; }throw new Error(fixed? `this DistroKid account releases as "${fixed}", not "${payload.artist}"`: `no artist field accepted "${payload.artist}"`);@@ -107,7 +108,7 @@ export const distrokidAdapter = {const aiParts = [payload.ai.lyrics && 'lyrics', payload.ai.music && 'music', payload.ai.vocals && 'all of the audio'].filter(Boolean);return {- artist: payload.artist,+ artist: releasedAs,title: payload.title,songwriter: `${payload.songwriter.first} ${payload.songwriter.last} (${payload.songwriterRole === 'both' ? 'music and lyrics' : payload.songwriterRole})`,releaseDate: payload.releaseDate || 'As soon as possible',