From 4e1807cbbaa0b13eb743406d02492c4eb354f4dc Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 25 Nov 2026 13:21:34 -0500 Subject: [PATCH] test: invented artists, albums and MusicBrainz ids in place of real ones Test data and example comments named real artists, records and songs, and carried real MusicBrainz ids. One mapping swaps them for invented ones throughout (Fields of Ontario, Plastic Apes, Marlo Davies, ...), keeping what each case tests: sort order, index letter, escaping, title keys, artist-prefix stripping. A test username is no longer the operator's name. The cover-art and Last.fm connection checks still query real releases; they reach live services and need something that exists there. Co-Authored-By: Claude Opus 5.5 --- .../admin/ui/AdminQuarantineViewModelTest.kt | 6 +- .../minstrel/home/data/HomeRepositoryTest.kt | 4 +- .../library/data/LibraryRepositoryTest.kt | 12 +-- .../library/ui/LibraryViewModelTest.kt | 4 +- internal/acoustid/client_test.go | 14 ++-- internal/api/admin_duplicates_test.go | 8 +- internal/api/admin_library_missing_db_test.go | 18 ++--- internal/api/admin_library_missing_test.go | 8 +- internal/api/admin_suspect_sources.go | 2 +- internal/api/admin_suspect_sources_test.go | 30 ++++---- internal/api/convert_test.go | 16 ++-- internal/api/events_test.go | 8 +- internal/api/file_remove_error_test.go | 6 +- internal/api/library_sync_test.go | 2 +- internal/api/library_sync_views_test.go | 6 +- internal/api/library_test.go | 50 ++++++------- internal/api/likes_test.go | 8 +- internal/api/search_test.go | 16 ++-- internal/api/types.go | 2 +- internal/backup/s3_test.go | 2 +- internal/catalogue/catalogue_test.go | 38 +++++----- internal/coverart/provider_deezer_test.go | 4 +- internal/coverart/provider_lastfm_test.go | 30 ++++---- internal/coverart/provider_mbcaa.go | 3 +- internal/coverart/provider_theaudiodb.go | 5 +- internal/library/artistcredit.go | 6 +- internal/library/artistcredit_test.go | 28 +++---- internal/library/duplicate_classify.go | 16 ++-- internal/library/duplicate_classify_test.go | 74 +++++++++---------- internal/library/duplicate_match_test.go | 2 +- internal/library/duplicate_merge_test.go | 2 +- internal/library/duplicate_resolve_test.go | 38 +++++----- internal/library/duplicate_settle.go | 10 +-- internal/library/duplicate_settle_test.go | 2 +- internal/library/duplicate_survivor_test.go | 2 +- internal/library/moved_test.go | 4 +- internal/library/new_music_test.go | 8 +- internal/library/scanner_test.go | 16 ++-- internal/library/song_link_test.go | 20 ++--- internal/library/source_markers_test.go | 18 ++--- internal/mailer/mailer.go | 2 +- internal/mailer/subject_test.go | 4 +- internal/musicbrainz/client.go | 2 +- internal/musicbrainz/client_test.go | 44 +++++------ internal/musicbrainz/entities.go | 4 +- internal/notifications/digest_db_test.go | 14 ++-- internal/notifications/digest_test.go | 22 +++--- internal/notifications/notifier_db_test.go | 4 +- internal/notifications/render.go | 4 +- internal/notifications/render_test.go | 18 ++--- internal/playlists/collage_test.go | 2 +- internal/playlists/service_test.go | 10 +-- internal/scrobble/listenbrainz/client_test.go | 10 +-- internal/subsonic/types_test.go | 14 ++-- internal/tags/provider_lastfm_test.go | 2 +- web/src/lib/api/admin.test.ts | 12 +-- web/src/lib/api/quarantine.test.ts | 6 +- web/src/lib/components/AcoustIDCard.test.ts | 8 +- web/src/lib/components/AlbumCard.test.ts | 28 +++---- web/src/lib/components/ArtistCard.test.ts | 16 ++-- .../lib/components/NotificationBell.test.ts | 6 +- web/src/lib/components/PlayerBar.test.ts | 10 +-- .../lib/components/PlaylistTrackRow.test.ts | 22 +++--- web/src/lib/components/TrackListRow.test.ts | 24 +++--- web/src/lib/components/TrackMenu.test.ts | 4 +- web/src/lib/components/TrackRow.test.ts | 26 +++---- .../lib/playlists/playlistTrackToRef.test.ts | 12 +-- web/src/routes/admin/admin.test.ts | 6 +- web/src/routes/albums/[id]/album.test.ts | 28 +++---- .../collection/duplicates/duplicates.test.ts | 62 ++++++++-------- .../routes/collection/missing/missing.test.ts | 16 ++-- .../routes/collection/reports/reports.test.ts | 22 +++--- .../collection/suspect-sources/+page.svelte | 2 +- .../suspect-sources/suspect-sources.test.ts | 44 +++++------ web/src/routes/library/hidden/hidden.test.ts | 12 +-- web/src/routes/library/liked/liked.test.ts | 18 ++--- web/src/routes/search/albums/albums.test.ts | 8 +- web/src/routes/search/artists/artists.test.ts | 12 +-- web/src/routes/search/search.test.ts | 22 +++--- web/src/routes/search/tracks/tracks.test.ts | 10 +-- 80 files changed, 570 insertions(+), 570 deletions(-) diff --git a/android/app/src/test/java/com/fabledsword/minstrel/admin/ui/AdminQuarantineViewModelTest.kt b/android/app/src/test/java/com/fabledsword/minstrel/admin/ui/AdminQuarantineViewModelTest.kt index b38bd2f4..60615dcd 100644 --- a/android/app/src/test/java/com/fabledsword/minstrel/admin/ui/AdminQuarantineViewModelTest.kt +++ b/android/app/src/test/java/com/fabledsword/minstrel/admin/ui/AdminQuarantineViewModelTest.kt @@ -22,9 +22,9 @@ import kotlin.test.assertEquals class AdminQuarantineViewModelTest { private val row = AdminQuarantineItemRef( trackId = "t1", - trackTitle = "Roygbiv", - artistName = "Boards of Canada", - albumTitle = "Geogaddi", + trackTitle = "Prismatic", + artistName = "Fields of Ontario", + albumTitle = "Geomantic", albumId = "al1", reportCount = 1, ) diff --git a/android/app/src/test/java/com/fabledsword/minstrel/home/data/HomeRepositoryTest.kt b/android/app/src/test/java/com/fabledsword/minstrel/home/data/HomeRepositoryTest.kt index 161cb8b6..2ce0ecce 100644 --- a/android/app/src/test/java/com/fabledsword/minstrel/home/data/HomeRepositoryTest.kt +++ b/android/app/src/test/java/com/fabledsword/minstrel/home/data/HomeRepositoryTest.kt @@ -71,10 +71,10 @@ class HomeRepositoryTest { assertEquals("al1", skeleton[0].id) assertNull(skeleton[0].value) // skeleton in position - albumFlow.value = AlbumRef(id = "al1", title = "Geogaddi", artistId = "a1") + albumFlow.value = AlbumRef(id = "al1", title = "Geomantic", artistId = "a1") val revealed = awaitItem() assertEquals("al1", revealed[0].id) - assertEquals("Geogaddi", revealed[0].value?.title) // tile reveals + assertEquals("Geomantic", revealed[0].value?.title) // tile reveals cancelAndIgnoreRemainingEvents() } } diff --git a/android/app/src/test/java/com/fabledsword/minstrel/library/data/LibraryRepositoryTest.kt b/android/app/src/test/java/com/fabledsword/minstrel/library/data/LibraryRepositoryTest.kt index c4c459af..aa0ebb73 100644 --- a/android/app/src/test/java/com/fabledsword/minstrel/library/data/LibraryRepositoryTest.kt +++ b/android/app/src/test/java/com/fabledsword/minstrel/library/data/LibraryRepositoryTest.kt @@ -55,7 +55,7 @@ class LibraryRepositoryTest { every { artistDao.observeAll() } returns flowOf( listOf( - CachedArtistEntity(id = "a1", name = "Boards of Canada", sortName = "Boards of Canada"), + CachedArtistEntity(id = "a1", name = "Fields of Ontario", sortName = "Fields of Ontario"), ), ) // observeArtists now combines with albums (to derive the tile @@ -67,7 +67,7 @@ class LibraryRepositoryTest { val first = awaitItem() assertEquals(1, first.size) assertEquals("a1", first[0].id) - assertEquals("Boards of Canada", first[0].name) + assertEquals("Fields of Ontario", first[0].name) awaitComplete() } } @@ -82,13 +82,13 @@ class LibraryRepositoryTest { """ { "id": "a1", - "name": "Boards of Canada", - "sort_name": "Boards of Canada", + "name": "Fields of Ontario", + "sort_name": "Fields of Ontario", "album_count": 2, "cover_url": "", "albums": [ - {"id": "al1", "title": "Music Has the Right to Children", "artist_id": "a1", "sort_title": "Music Has the Right to Children"}, - {"id": "al2", "title": "Geogaddi", "artist_id": "a1", "sort_title": "Geogaddi"} + {"id": "al1", "title": "Music Has the Right to Wander", "artist_id": "a1", "sort_title": "Music Has the Right to Wander"}, + {"id": "al2", "title": "Geomantic", "artist_id": "a1", "sort_title": "Geomantic"} ] } """.trimIndent(), diff --git a/android/app/src/test/java/com/fabledsword/minstrel/library/ui/LibraryViewModelTest.kt b/android/app/src/test/java/com/fabledsword/minstrel/library/ui/LibraryViewModelTest.kt index 494cb4cb..434f1d4c 100644 --- a/android/app/src/test/java/com/fabledsword/minstrel/library/ui/LibraryViewModelTest.kt +++ b/android/app/src/test/java/com/fabledsword/minstrel/library/ui/LibraryViewModelTest.kt @@ -73,9 +73,9 @@ class LibraryViewModelTest { fun `Success when DAOs emit content`() = runTest { val repo = mockk() every { repo.observeArtists() } returns - flowOf(listOf(ArtistRef(id = "a1", name = "Boards of Canada", sortName = "Boards"))) + flowOf(listOf(ArtistRef(id = "a1", name = "Fields of Ontario", sortName = "Fields"))) every { repo.observeAlbums() } returns - flowOf(listOf(AlbumRef(id = "al1", title = "Geogaddi", artistId = "a1"))) + flowOf(listOf(AlbumRef(id = "al1", title = "Geomantic", artistId = "a1"))) val vm = LibraryViewModel( repo, diff --git a/internal/acoustid/client_test.go b/internal/acoustid/client_test.go index 437388ed..f885126e 100644 --- a/internal/acoustid/client_test.go +++ b/internal/acoustid/client_test.go @@ -20,13 +20,13 @@ const docSample = `{ "status": "ok", "results": [{ "score": 1.0, - "id": "9ff43b6a-4f16-427c-93c2-92307ca505e0", + "id": "0a11ce00-0000-4000-8000-000000000008", "recordings": [{ "duration": 639, - "releasegroups": [{"type": "Album", "id": "ddaa2d4d-314e-3e7c-b1d0-f6d207f5aa2f", "title": "Before the Dawn Heals Us"}], - "title": "Lower Your Eyelids to Die With the Sun", - "id": "cd2e7c47-16f5-46c6-a37c-a1eb7bf599ff", - "artists": [{"id": "6d7b7cd4-254b-4c25-83f6-dd20f98ceacd", "name": "M83"}] + "releasegroups": [{"type": "Album", "id": "0a11ce00-0000-4000-8000-000000000006", "title": "Before the Dusk Finds Us"}], + "title": "Lower Your Voice to Sing With the Moon", + "id": "0a11ce00-0000-4000-8000-000000000005", + "artists": [{"id": "0a11ce00-0000-4000-8000-000000000007", "name": "K47"}] }] }] }` @@ -55,8 +55,8 @@ func TestParseLookup(t *testing.T) { }{ {"single match", docSample, []Candidate{{ Recording: Recording{ - ID: "cd2e7c47-16f5-46c6-a37c-a1eb7bf599ff", Title: "Lower Your Eyelids to Die With the Sun", - DurationSec: 639, Artists: []string{"M83"}, + ID: "0a11ce00-0000-4000-8000-000000000005", Title: "Lower Your Voice to Sing With the Moon", + DurationSec: 639, Artists: []string{"K47"}, }, Score: 1.0, }}}, diff --git a/internal/api/admin_duplicates_test.go b/internal/api/admin_duplicates_test.go index ba869714..73da040c 100644 --- a/internal/api/admin_duplicates_test.go +++ b/internal/api/admin_duplicates_test.go @@ -28,14 +28,14 @@ func TestFoldDuplicateGroups(t *testing.T) { rows := []dbq.ListPendingDuplicateGroupMembersRow{ // Group 1: identical audio, sizes tie, the older copy should be kept. {GroupID: dupUUID(1), Tier: "exact", DetectedAt: dupTS(newer), TrackID: dupUUID(10), - Title: "WWW", FileFormat: "mp3", FileSize: 6_900_000, DurationMs: 215_400, AddedAt: dupTS(newer), PlayCount: 3}, + Title: "XYZ", FileFormat: "mp3", FileSize: 6_900_000, DurationMs: 215_400, AddedAt: dupTS(newer), PlayCount: 3}, {GroupID: dupUUID(1), Tier: "exact", DetectedAt: dupTS(newer), TrackID: dupUUID(11), - Title: "WWW", FileFormat: "mp3", FileSize: 6_900_000, DurationMs: 215_400, AddedAt: dupTS(older), LikeCount: 1}, + Title: "XYZ", FileFormat: "mp3", FileSize: 6_900_000, DurationMs: 215_400, AddedAt: dupTS(older), LikeCount: 1}, // Group 2: the same recording, FLAC against MP3. {GroupID: dupUUID(2), Tier: "acoustic", WorstBitErrorRate: &ber, DetectedAt: dupTS(older), TrackID: dupUUID(20), - Title: "Lovesick", FileFormat: "mp3", FileSize: 9_000_000, DurationMs: 198_000, AddedAt: dupTS(older)}, + Title: "Homesick", FileFormat: "mp3", FileSize: 9_000_000, DurationMs: 198_000, AddedAt: dupTS(older)}, {GroupID: dupUUID(2), Tier: "acoustic", WorstBitErrorRate: &ber, DetectedAt: dupTS(older), TrackID: dupUUID(21), - Title: "Lovesick", FileFormat: "flac", FileSize: 30_000_000, DurationMs: 198_000, AddedAt: dupTS(newer)}, + Title: "Homesick", FileFormat: "flac", FileSize: 30_000_000, DurationMs: 198_000, AddedAt: dupTS(newer)}, } got := foldDuplicateGroups(rows) diff --git a/internal/api/admin_library_missing_db_test.go b/internal/api/admin_library_missing_db_test.go index ed22c53f..f79439ea 100644 --- a/internal/api/admin_library_missing_db_test.go +++ b/internal/api/admin_library_missing_db_test.go @@ -15,11 +15,11 @@ func TestHandleExportMissingTracks_Integration(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) admin := seedUser(t, pool, "export-admin", "pw", true) - artist := seedArtist(t, pool, "Boards of Canada") - album := seedAlbum(t, pool, artist.ID, "Geogaddi", 2002) - gone := seedTrack(t, pool, album.ID, artist.ID, "Music Is Math", 0, 300_000) - removed := seedTrack(t, pool, album.ID, artist.ID, "Dawn Chorus", 2, 240_000) - seedTrack(t, pool, album.ID, artist.ID, "Julie and Candy", 3, 200_000) + artist := seedArtist(t, pool, "Fields of Ontario") + album := seedAlbum(t, pool, artist.ID, "Geomantic", 2002) + gone := seedTrack(t, pool, album.ID, artist.ID, "Music Is Maps", 0, 300_000) + removed := seedTrack(t, pool, album.ID, artist.ID, "Dusk Chorus", 2, 240_000) + seedTrack(t, pool, album.ID, artist.ID, "Julia and Cane", 3, 200_000) ctx := context.Background() if _, err := pool.Exec(ctx, `UPDATE tracks SET missing_since = now() WHERE id = $1`, gone.ID); err != nil { t.Fatal(err) @@ -46,10 +46,10 @@ func TestHandleExportMissingTracks_Integration(t *testing.T) { for _, r := range rows[1:] { byTitle[r[4]] = r } - if r := byTitle["Music Is Math"]; r == nil || r[3] != "" || r[5] != "" || r[7] != "missing" { + if r := byTitle["Music Is Maps"]; r == nil || r[3] != "" || r[5] != "" || r[7] != "missing" { t.Errorf("untagged missing row = %v, want no track number, no mbid, why missing", r) } - if r := byTitle["Dawn Chorus"]; r == nil || r[3] != "2" || r[5] != "rec-dawn" || r[7] != "report" { + if r := byTitle["Dusk Chorus"]; r == nil || r[3] != "2" || r[5] != "rec-dawn" || r[7] != "report" { t.Errorf("removed row = %v, want track 2, its mbid, why report", r) } } @@ -60,8 +60,8 @@ func TestHandleForgetMissingTracks_Integration(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) admin := seedUser(t, pool, "forget-admin", "pw", true) - artist := seedArtist(t, pool, "Autechre") - album := seedAlbum(t, pool, artist.ID, "Amber", 1994) + artist := seedArtist(t, pool, "Autoglyph") + album := seedAlbum(t, pool, artist.ID, "Ochre", 1994) waiting := seedTrack(t, pool, album.ID, artist.ID, "Foil", 1, 300_000) present := seedTrack(t, pool, album.ID, artist.ID, "Montreal", 2, 300_000) ctx := context.Background() diff --git a/internal/api/admin_library_missing_test.go b/internal/api/admin_library_missing_test.go index 9d28a8b5..f7c31742 100644 --- a/internal/api/admin_library_missing_test.go +++ b/internal/api/admin_library_missing_test.go @@ -29,9 +29,9 @@ func TestGroupMissingByDirectory(t *testing.T) { t.Run("consecutive rows in one directory collapse to one group", func(t *testing.T) { groups := groupMissingByDirectory([]dbq.ListMissingTracksRow{ - missingRow("/music/Linkin Park/Minutes to Midnight", "Given Up", base), - missingRow("/music/Linkin Park/Minutes to Midnight", "Leave Out All the Rest", base), - missingRow("/music/Linkin Park/Minutes to Midnight", "Bleed It Out", base), + missingRow("/music/Lincoln Yard/Minutes to Noon", "Given Up", base), + missingRow("/music/Lincoln Yard/Minutes to Noon", "Leave Out All the Rest", base), + missingRow("/music/Lincoln Yard/Minutes to Noon", "Bleed It Out", base), }) if len(groups) != 1 { @@ -40,7 +40,7 @@ func TestGroupMissingByDirectory(t *testing.T) { if got := len(groups[0].Tracks); got != 3 { t.Errorf("want 3 tracks in the group, got %d", got) } - if groups[0].Directory != "/music/Linkin Park/Minutes to Midnight" { + if groups[0].Directory != "/music/Lincoln Yard/Minutes to Noon" { t.Errorf("unexpected directory %q", groups[0].Directory) } }) diff --git a/internal/api/admin_suspect_sources.go b/internal/api/admin_suspect_sources.go index e96ce259..75a95a76 100644 --- a/internal/api/admin_suspect_sources.go +++ b/internal/api/admin_suspect_sources.go @@ -38,7 +38,7 @@ type suspectTrackView struct { } // suspectGroupView is a folder's worth of flagged tracks. As on the -// missing-files report, the folder is the unit of decision: Humanz was 62 rows +// missing-files report, the folder is the unit of decision: Mammalz was 62 rows // in one folder, which is one problem to look at, not 62. type suspectGroupView struct { Directory string `json:"directory"` diff --git a/internal/api/admin_suspect_sources_test.go b/internal/api/admin_suspect_sources_test.go index 8ebb1eeb..fa509481 100644 --- a/internal/api/admin_suspect_sources_test.go +++ b/internal/api/admin_suspect_sources_test.go @@ -16,14 +16,14 @@ func TestHandleListSuspectSources_Integration(t *testing.T) { truncateLibrary(t, pool) admin := seedUser(t, pool, "suspect-admin", "pw", true) - artist := seedArtist(t, pool, "Gorillaz") - humanz := seedAlbum(t, pool, artist.ID, "Humanz", 2017) - seedTrack(t, pool, humanz.ID, artist.ID, "Saturnz Barz (Official Video)", 1, 180_000) - seedTrack(t, pool, humanz.ID, artist.ID, "Momentz (Visualizer)", 2, 200_000) - seedTrack(t, pool, humanz.ID, artist.ID, "Andromeda [Audio]", 3, 190_000) - seedTrack(t, pool, humanz.ID, artist.ID, "Chain Reaction", 4, 190_000) - seedTrack(t, pool, humanz.ID, artist.ID, "Busted and Blue", 5, 190_000) - gone := seedTrack(t, pool, humanz.ID, artist.ID, "Ascension (Lyric Video)", 6, 156_000) + artist := seedArtist(t, pool, "Plastic Apes") + mammalz := seedAlbum(t, pool, artist.ID, "Mammalz", 2017) + seedTrack(t, pool, mammalz.ID, artist.ID, "Neptunez Barz (Official Video)", 1, 180_000) + seedTrack(t, pool, mammalz.ID, artist.ID, "Minutez (Visualizer)", 2, 200_000) + seedTrack(t, pool, mammalz.ID, artist.ID, "Cassiopeia [Audio]", 3, 190_000) + seedTrack(t, pool, mammalz.ID, artist.ID, "Chain Reaction", 4, 190_000) + seedTrack(t, pool, mammalz.ID, artist.ID, "Bruised and Grey", 5, 190_000) + gone := seedTrack(t, pool, mammalz.ID, artist.ID, "Elevation (Lyric Video)", 6, 156_000) if _, err := pool.Exec(context.Background(), `UPDATE tracks SET missing_since = now() WHERE id = $1`, gone.ID); err != nil { t.Fatalf("mark missing: %v", err) @@ -54,9 +54,9 @@ func TestHandleListSuspectSources_Integration(t *testing.T) { got[tr.Title] = tr.Markers } want := map[string][]string{ - "Saturnz Barz (Official Video)": {"music video"}, - "Momentz (Visualizer)": {"visualiser"}, - "Andromeda [Audio]": {"[Audio]"}, + "Neptunez Barz (Official Video)": {"music video"}, + "Minutez (Visualizer)": {"visualiser"}, + "Cassiopeia [Audio]": {"[Audio]"}, } if len(got) != len(want) { t.Fatalf("tracks = %v, want %v", got, want) @@ -74,10 +74,10 @@ func TestHandleRemoveSuspectSourceFile_Integration(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) admin := seedUser(t, pool, "suspect-remover", "pw", true) - artist := seedArtist(t, pool, "Gorillaz") - humanz := seedAlbum(t, pool, artist.ID, "Humanz", 2017) - rip := seedTrack(t, pool, humanz.ID, artist.ID, "Saturnz Barz (Official Video)", 1, 180_000) - clean := seedTrack(t, pool, humanz.ID, artist.ID, "Chain Reaction", 4, 190_000) + artist := seedArtist(t, pool, "Plastic Apes") + mammalz := seedAlbum(t, pool, artist.ID, "Mammalz", 2017) + rip := seedTrack(t, pool, mammalz.ID, artist.ID, "Neptunez Barz (Official Video)", 1, 180_000) + clean := seedTrack(t, pool, mammalz.ID, artist.ID, "Chain Reaction", 4, 190_000) remove := func(id string) int { req := httptest.NewRequest(http.MethodPost, "/api/admin/library/suspect-sources/"+id+"/remove", nil) diff --git a/internal/api/convert_test.go b/internal/api/convert_test.go index f2d0bc12..f67a0f6b 100644 --- a/internal/api/convert_test.go +++ b/internal/api/convert_test.go @@ -80,12 +80,12 @@ func TestCoverURLAndStreamURL(t *testing.T) { func TestArtistRefFrom(t *testing.T) { var id pgtype.UUID _ = id.Scan("00112233-4455-6677-8899-aabbccddeeff") - a := dbq.Artist{ID: id, Name: "Beatles", SortName: "Beatles"} + a := dbq.Artist{ID: id, Name: "Copper Lanterns", SortName: "Copper Lanterns"} got := artistRefFrom(a, 7) if got.ID != "00112233-4455-6677-8899-aabbccddeeff" { t.Errorf("ID = %q", got.ID) } - if got.Name != "Beatles" || got.AlbumCount != 7 { + if got.Name != "Copper Lanterns" || got.AlbumCount != 7 { t.Errorf("ref = %+v", got) } } @@ -96,9 +96,9 @@ func TestAlbumRefFrom(t *testing.T) { _ = artID.Scan("00000000-0000-0000-0000-000000000002") var rel pgtype.Date _ = rel.Scan("1969-09-26") - a := dbq.Album{ID: aid, Title: "Abbey Road", ArtistID: artID, ReleaseDate: rel} - got := albumRefFrom(a, "Beatles", 17, 2820) - if got.Title != "Abbey Road" || got.ArtistName != "Beatles" { + a := dbq.Album{ID: aid, Title: "Harbour Street", ArtistID: artID, ReleaseDate: rel} + got := albumRefFrom(a, "Copper Lanterns", 17, 2820) + if got.Title != "Harbour Street" || got.ArtistName != "Copper Lanterns" { t.Errorf("ref = %+v", got) } if got.TrackCount != 17 || got.DurationSec != 2820 { @@ -120,12 +120,12 @@ func TestTrackRefFrom(t *testing.T) { trackNum := int32(3) discNum := int32(1) t2 := dbq.Track{ - ID: tid, Title: "Something", AlbumID: aid, ArtistID: artID, + ID: tid, Title: "Somewhere Near", AlbumID: aid, ArtistID: artID, TrackNumber: &trackNum, DiscNumber: &discNum, DurationMs: 183_000, } - got := trackRefFrom(t2, "Abbey Road", "Beatles") - if got.Title != "Something" || got.AlbumTitle != "Abbey Road" || got.ArtistName != "Beatles" { + got := trackRefFrom(t2, "Harbour Street", "Copper Lanterns") + if got.Title != "Somewhere Near" || got.AlbumTitle != "Harbour Street" || got.ArtistName != "Copper Lanterns" { t.Errorf("ref = %+v", got) } if got.TrackNumber != 3 || got.DiscNumber != 1 { diff --git a/internal/api/events_test.go b/internal/api/events_test.go index 98e52e87..b5fc5665 100644 --- a/internal/api/events_test.go +++ b/internal/api/events_test.go @@ -28,8 +28,8 @@ func TestHandleEvents_PlayStartedReturnsIDs(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) user := seedUser(t, pool, "alice", "x", false) - artist := seedArtist(t, pool, "Beatles") - album := seedAlbum(t, pool, artist.ID, "Abbey Road", 1969) + artist := seedArtist(t, pool, "Copper Lanterns") + album := seedAlbum(t, pool, artist.ID, "Harbour Street", 1969) track := seedTrack(t, pool, album.ID, artist.ID, "Something", 3, 183_000) body, _ := json.Marshal(map[string]any{ @@ -56,8 +56,8 @@ func TestHandleEvents_PlayEndedClosesRow(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) user := seedUser(t, pool, "alice", "x", false) - artist := seedArtist(t, pool, "Beatles") - album := seedAlbum(t, pool, artist.ID, "Abbey Road", 1969) + artist := seedArtist(t, pool, "Copper Lanterns") + album := seedAlbum(t, pool, artist.ID, "Harbour Street", 1969) track := seedTrack(t, pool, album.ID, artist.ID, "Something", 3, 183_000) startedID := postPlayStartedHelper(t, h, user, track.ID) diff --git a/internal/api/file_remove_error_test.go b/internal/api/file_remove_error_test.go index 203219eb..fb7b6704 100644 --- a/internal/api/file_remove_error_test.go +++ b/internal/api/file_remove_error_test.go @@ -12,7 +12,7 @@ import ( "git.fabledsword.com/bvandeusen/minstrel/internal/library" ) -const removeTestPath = "/music/Moe Shop/WWW (2020)/01 - WWW.mp3" +const removeTestPath = "/music/Mochi Shop/XYZ (2020)/01 - XYZ.mp3" // removeFailure builds the error a delete service returns when the file would // not go, wrapped the way quarantine.DeleteFile and quarantine.RemoveFile @@ -35,7 +35,7 @@ func TestFileRemoveAPIError(t *testing.T) { { name: "read-only mount", errno: syscall.EROFS, wantStatus: http.StatusConflict, wantCode: "library_not_writable", - wantIn: []string{"uid 1000, gid 1000", "/music/Moe Shop/WWW (2020)", "read-only file system", "Nothing was deleted"}, + wantIn: []string{"uid 1000, gid 1000", "/music/Mochi Shop/XYZ (2020)", "read-only file system", "Nothing was deleted"}, }, { name: "permission denied", errno: syscall.EACCES, @@ -77,7 +77,7 @@ func TestFileRemoveAPIError(t *testing.T) { // plain "contains the directory" check could never catch that regression. func TestFileRemoveAPIError_NotWritableNamesTheDirectoryNotTheFile(t *testing.T) { apiErr, _ := fileRemoveAPIError(removeFailure(syscall.EROFS)) - if strings.Contains(apiErr.Message, "01 - WWW.mp3") { + if strings.Contains(apiErr.Message, "01 - XYZ.mp3") { t.Fatalf("message names the file rather than its directory: %q", apiErr.Message) } } diff --git a/internal/api/library_sync_test.go b/internal/api/library_sync_test.go index 18983d54..8b4aef78 100644 --- a/internal/api/library_sync_test.go +++ b/internal/api/library_sync_test.go @@ -53,7 +53,7 @@ func TestLibrarySync_AfterArtistUpsert_ReturnsHydratedPayload(t *testing.T) { var artistID string if err := tx.QueryRow(ctx, `INSERT INTO artists (name, sort_name) VALUES ($1, $2) RETURNING id::text`, - "Boards of Canada", "Boards of Canada", + "Fields of Ontario", "Fields of Ontario", ).Scan(&artistID); err != nil { t.Fatalf("insert artist: %v", err) } diff --git a/internal/api/library_sync_views_test.go b/internal/api/library_sync_views_test.go index 0000d109..c583eab7 100644 --- a/internal/api/library_sync_views_test.go +++ b/internal/api/library_sync_views_test.go @@ -41,7 +41,7 @@ func assertJSONKeys(t *testing.T, label string, b []byte, want []string) { } func TestArtistSyncView_WireKeys(t *testing.T) { - a := dbq.Artist{ID: validUUID, Name: "Aphex Twin", SortName: "Aphex Twin"} + a := dbq.Artist{ID: validUUID, Name: "Apex Sibling", SortName: "Apex Sibling"} b, err := json.Marshal(toArtistSyncView(a)) if err != nil { t.Fatal(err) @@ -53,7 +53,7 @@ func TestArtistSyncView_WireKeys(t *testing.T) { } func TestAlbumSyncView_WireKeys(t *testing.T) { - a := dbq.Album{ID: validUUID, ArtistID: validUUID, Title: "Drukqs", SortTitle: "Drukqs"} + a := dbq.Album{ID: validUUID, ArtistID: validUUID, Title: "Drumkits", SortTitle: "Drumkits"} b, err := json.Marshal(toAlbumSyncView(a, library.ReplayGain{})) if err != nil { t.Fatal(err) @@ -67,7 +67,7 @@ func TestAlbumSyncView_WireKeys(t *testing.T) { func TestTrackSyncView_WireKeys(t *testing.T) { tr := dbq.Track{ ID: validUUID, AlbumID: validUUID, ArtistID: validUUID, - Title: "Avril 14th", DurationMs: 121_000, + Title: "Juin 21st", DurationMs: 121_000, FilePath: "x", FileFormat: "flac", } b, err := json.Marshal(toTrackSyncView(tr, library.ReplayGain{})) diff --git a/internal/api/library_test.go b/internal/api/library_test.go index 9f4a665f..9426bffe 100644 --- a/internal/api/library_test.go +++ b/internal/api/library_test.go @@ -59,9 +59,9 @@ func injectFakeUserForTest(next http.Handler) http.Handler { func TestHandleGetTrack_HappyPath(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) - artist := seedArtist(t, pool, "Beatles") - album := seedAlbum(t, pool, artist.ID, "Abbey Road", 1969) - track := seedTrack(t, pool, album.ID, artist.ID, "Something", 3, 183_000) + artist := seedArtist(t, pool, "Copper Lanterns") + album := seedAlbum(t, pool, artist.ID, "Harbour Street", 1969) + track := seedTrack(t, pool, album.ID, artist.ID, "Somewhere Near", 3, 183_000) req := httptest.NewRequest(http.MethodGet, "/api/tracks/"+uuidToString(track.ID), nil) w := httptest.NewRecorder() @@ -74,7 +74,7 @@ func TestHandleGetTrack_HappyPath(t *testing.T) { if err := json.Unmarshal(w.Body.Bytes(), &got); err != nil { t.Fatalf("decode: %v body=%s", err, w.Body.String()) } - if got.Title != "Something" || got.AlbumTitle != "Abbey Road" || got.ArtistName != "Beatles" { + if got.Title != "Somewhere Near" || got.AlbumTitle != "Harbour Street" || got.ArtistName != "Copper Lanterns" { t.Errorf("ref = %+v", got) } if got.TrackNumber != 3 || got.DurationSec != 183 { @@ -111,10 +111,10 @@ func TestHandleGetTrack_NotFound(t *testing.T) { func TestHandleGetAlbum_HappyPath(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) - artist := seedArtist(t, pool, "Beatles") - album := seedAlbum(t, pool, artist.ID, "Abbey Road", 1969) - seedTrack(t, pool, album.ID, artist.ID, "Come Together", 1, 259_000) - seedTrack(t, pool, album.ID, artist.ID, "Something", 2, 183_000) + artist := seedArtist(t, pool, "Copper Lanterns") + album := seedAlbum(t, pool, artist.ID, "Harbour Street", 1969) + seedTrack(t, pool, album.ID, artist.ID, "Come Along", 1, 259_000) + seedTrack(t, pool, album.ID, artist.ID, "Somewhere Near", 2, 183_000) req := httptest.NewRequest(http.MethodGet, "/api/albums/"+uuidToString(album.ID), nil) w := httptest.NewRecorder() @@ -127,13 +127,13 @@ func TestHandleGetAlbum_HappyPath(t *testing.T) { if err := json.Unmarshal(w.Body.Bytes(), &got); err != nil { t.Fatalf("decode: %v body=%s", err, w.Body.String()) } - if got.Title != "Abbey Road" || got.ArtistName != "Beatles" || got.Year != 1969 { + if got.Title != "Harbour Street" || got.ArtistName != "Copper Lanterns" || got.Year != 1969 { t.Errorf("album = %+v", got) } if len(got.Tracks) != 2 { t.Fatalf("tracks len = %d, want 2", len(got.Tracks)) } - if got.Tracks[0].Title != "Come Together" || got.Tracks[1].Title != "Something" { + if got.Tracks[0].Title != "Come Along" || got.Tracks[1].Title != "Somewhere Near" { t.Errorf("tracks = %+v", got.Tracks) } if got.TrackCount != 2 || got.DurationSec != 442 { // 259 + 183 @@ -180,7 +180,7 @@ func TestHandleGetAlbum_EachTrackNamesItsOwnArtist(t *testing.T) { func TestHandleGetAlbum_NoTracks(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) - artist := seedArtist(t, pool, "Beatles") + artist := seedArtist(t, pool, "Copper Lanterns") album := seedAlbum(t, pool, artist.ID, "Empty", 0) req := httptest.NewRequest(http.MethodGet, "/api/albums/"+uuidToString(album.ID), nil) @@ -230,11 +230,11 @@ func TestHandleGetAlbum_NotFound(t *testing.T) { func TestHandleGetArtist_HappyPath(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) - artist := seedArtist(t, pool, "Beatles") - album1 := seedAlbum(t, pool, artist.ID, "Abbey Road", 1969) - album2 := seedAlbum(t, pool, artist.ID, "Let It Be", 1970) - seedTrack(t, pool, album1.ID, artist.ID, "Something", 3, 183_000) - seedTrack(t, pool, album2.ID, artist.ID, "Get Back", 1, 189_000) + artist := seedArtist(t, pool, "Copper Lanterns") + album1 := seedAlbum(t, pool, artist.ID, "Harbour Street", 1969) + album2 := seedAlbum(t, pool, artist.ID, "Let It Ride", 1970) + seedTrack(t, pool, album1.ID, artist.ID, "Somewhere Near", 3, 183_000) + seedTrack(t, pool, album2.ID, artist.ID, "Get Going", 1, 189_000) req := httptest.NewRequest(http.MethodGet, "/api/artists/"+uuidToString(artist.ID), nil) w := httptest.NewRecorder() @@ -247,7 +247,7 @@ func TestHandleGetArtist_HappyPath(t *testing.T) { if err := json.Unmarshal(w.Body.Bytes(), &got); err != nil { t.Fatalf("decode: %v body=%s", err, w.Body.String()) } - if got.Name != "Beatles" { + if got.Name != "Copper Lanterns" { t.Errorf("name = %q", got.Name) } if got.AlbumCount != 2 { @@ -256,13 +256,13 @@ func TestHandleGetArtist_HappyPath(t *testing.T) { if len(got.Albums) != 2 { t.Fatalf("albums len = %d, want 2", len(got.Albums)) } - // ListAlbumsByArtist orders by release_date then sort_title; Abbey Road + // ListAlbumsByArtist orders by release_date then sort_title; Harbour Street // (1969) first. - if got.Albums[0].Title != "Abbey Road" { - t.Errorf("first album = %q, want Abbey Road", got.Albums[0].Title) + if got.Albums[0].Title != "Harbour Street" { + t.Errorf("first album = %q, want Harbour Street", got.Albums[0].Title) } for _, a := range got.Albums { - if a.ArtistName != "Beatles" { + if a.ArtistName != "Copper Lanterns" { t.Errorf("album.artist_name = %q", a.ArtistName) } if a.CoverURL == "" { @@ -321,9 +321,9 @@ func TestHandleGetArtist_NotFound(t *testing.T) { func TestHandleListArtists_DefaultAlpha(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) - seedArtist(t, pool, "Beatles") - seedArtist(t, pool, "ABBA") - seedArtist(t, pool, "Zeppelin") + seedArtist(t, pool, "Copper Lanterns") + seedArtist(t, pool, "ABAB") + seedArtist(t, pool, "Zephyrine") req := httptest.NewRequest(http.MethodGet, "/api/artists", nil) w := httptest.NewRecorder() @@ -345,7 +345,7 @@ func TestHandleListArtists_DefaultAlpha(t *testing.T) { if len(got.Items) != 3 { t.Fatalf("items len = %d", len(got.Items)) } - if got.Items[0].Name != "ABBA" || got.Items[2].Name != "Zeppelin" { + if got.Items[0].Name != "ABAB" || got.Items[2].Name != "Zephyrine" { t.Errorf("alpha order wrong: %q, %q, %q", got.Items[0].Name, got.Items[1].Name, got.Items[2].Name) } } diff --git a/internal/api/likes_test.go b/internal/api/likes_test.go index d5f44657..b11b6535 100644 --- a/internal/api/likes_test.go +++ b/internal/api/likes_test.go @@ -41,8 +41,8 @@ func TestLikeTrack_Idempotent(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) user := seedUser(t, pool, "alice", "x", false) - artist := seedArtist(t, pool, "Beatles") - album := seedAlbum(t, pool, artist.ID, "Abbey Road", 1969) + artist := seedArtist(t, pool, "Copper Lanterns") + album := seedAlbum(t, pool, artist.ID, "Harbour Street", 1969) track := seedTrack(t, pool, album.ID, artist.ID, "Something", 3, 183_000) w := callLike(h, user, http.MethodPost, "/api/likes/tracks/"+uuidToString(track.ID)) @@ -84,8 +84,8 @@ func TestUnlikeTrack_IdempotentEvenWhenAbsent(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) user := seedUser(t, pool, "alice", "x", false) - artist := seedArtist(t, pool, "Beatles") - album := seedAlbum(t, pool, artist.ID, "Abbey Road", 1969) + artist := seedArtist(t, pool, "Copper Lanterns") + album := seedAlbum(t, pool, artist.ID, "Harbour Street", 1969) track := seedTrack(t, pool, album.ID, artist.ID, "Something", 3, 183_000) w := callLike(h, user, http.MethodDelete, "/api/likes/tracks/"+uuidToString(track.ID)) diff --git a/internal/api/search_test.go b/internal/api/search_test.go index 43f6b7b6..0f5bf0ca 100644 --- a/internal/api/search_test.go +++ b/internal/api/search_test.go @@ -10,11 +10,11 @@ import ( func TestHandleSearch_ThreeFacets(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) - artist := seedArtist(t, pool, "Beatles") - album := seedAlbum(t, pool, artist.ID, "Beatles Greatest", 1982) - seedTrack(t, pool, album.ID, artist.ID, "Beatles Jam", 1, 60_000) + artist := seedArtist(t, pool, "Copper Lanterns") + album := seedAlbum(t, pool, artist.ID, "Copper Lanterns Greatest", 1982) + seedTrack(t, pool, album.ID, artist.ID, "Copper Lanterns Jam", 1, 60_000) - req := httptest.NewRequest(http.MethodGet, "/api/search?q=beatles", nil) + req := httptest.NewRequest(http.MethodGet, "/api/search?q=copper", nil) w := httptest.NewRecorder() newLibraryRouter(h).ServeHTTP(w, req) @@ -34,13 +34,13 @@ func TestHandleSearch_ThreeFacets(t *testing.T) { if got.Tracks.Total != 1 || len(got.Tracks.Items) != 1 { t.Errorf("tracks = %+v", got.Tracks) } - if got.Artists.Items[0].Name != "Beatles" { + if got.Artists.Items[0].Name != "Copper Lanterns" { t.Errorf("artist name = %q", got.Artists.Items[0].Name) } - if got.Albums.Items[0].ArtistName != "Beatles" { + if got.Albums.Items[0].ArtistName != "Copper Lanterns" { t.Errorf("album.artist_name = %q", got.Albums.Items[0].ArtistName) } - if got.Tracks.Items[0].AlbumTitle != "Beatles Greatest" { + if got.Tracks.Items[0].AlbumTitle != "Copper Lanterns Greatest" { t.Errorf("track.album_title = %q", got.Tracks.Items[0].AlbumTitle) } } @@ -48,7 +48,7 @@ func TestHandleSearch_ThreeFacets(t *testing.T) { func TestHandleSearch_NoMatches(t *testing.T) { h, pool := testHandlers(t) truncateLibrary(t, pool) - seedArtist(t, pool, "Beatles") + seedArtist(t, pool, "Copper Lanterns") req := httptest.NewRequest(http.MethodGet, "/api/search?q=nothinghere", nil) w := httptest.NewRecorder() diff --git a/internal/api/types.go b/internal/api/types.go index b68594c5..561449d1 100644 --- a/internal/api/types.go +++ b/internal/api/types.go @@ -42,7 +42,7 @@ type Page[T any] struct { // ArtistRef is the lightweight artist shape used in lists and search results. // SortName is exposed so the SPA's alphabetical-grid divider can group rows -// by the catalogue sort order ("The Beatles" → "B"). CoverURL is derived from +// by the catalogue sort order ("The Copper Lanterns" → "C"). CoverURL is derived from // a representative album (most-recent with cover_art_path); empty when the // artist's discography has no cover art. type ArtistRef struct { diff --git a/internal/backup/s3_test.go b/internal/backup/s3_test.go index 984a44ab..c41f24eb 100644 --- a/internal/backup/s3_test.go +++ b/internal/backup/s3_test.go @@ -60,7 +60,7 @@ func TestUriEncodeKeepsOnlyUnreservedCharacters(t *testing.T) { for in, want := range map[string]string{ "01 - Song.flac": "01%20-%20Song.flac", "a+b=c&d": "a%2Bb%3Dc%26d", - "Björk~_.": "Bj%C3%B6rk~_.", + "Höla~_.": "H%C3%B6la~_.", "a/b": "a%2Fb", } { if got := uriEncode(in); got != want { diff --git a/internal/catalogue/catalogue_test.go b/internal/catalogue/catalogue_test.go index 76021a6f..b0b829d7 100644 --- a/internal/catalogue/catalogue_test.go +++ b/internal/catalogue/catalogue_test.go @@ -42,10 +42,10 @@ func newPool(t *testing.T) *pgxpool.Pool { } const ( - gorillaz = "e21857d5-3256-4547-afb3-4b6ded592596" - demonDays = "0c4d5b5f-2f3c-3d31-9c4e-4b4f6b4c1a01" - demonDaysR = "1a2b3c4d-0000-4000-8000-000000000001" - demonDaysJ = "1a2b3c4d-0000-4000-8000-000000000002" + apes = "0a11ce00-0000-4000-8000-000000000001" + ghostNights = "0a11ce00-0000-4000-8000-000000000002" + ghostNightsR = "1a2b3c4d-0000-4000-8000-000000000001" + ghostNightsJ = "1a2b3c4d-0000-4000-8000-000000000002" ) // fakeMB is a MusicBrainz with one album in two editions. down makes every @@ -67,19 +67,19 @@ func newFakeMB(t *testing.T) *fakeMB { } q := r.URL.Query() switch { - case r.URL.Path == "/release-group/"+demonDays: - _, _ = fmt.Fprintf(w, `{"id": %q, "title": "Demon Days", "primary-type": "Album", "first-release-date": "2005-05-11", - "artist-credit": [{"name": "Gorillaz", "artist": {"id": %q}}]}`, demonDays, gorillaz) - case r.URL.Path == "/release" && q.Get("release-group") == demonDays: + case r.URL.Path == "/release-group/"+ghostNights: + _, _ = fmt.Fprintf(w, `{"id": %q, "title": "Ghost Nights", "primary-type": "Album", "first-release-date": "2005-05-11", + "artist-credit": [{"name": "Plastic Apes", "artist": {"id": %q}}]}`, ghostNights, apes) + case r.URL.Path == "/release" && q.Get("release-group") == ghostNights: _, _ = fmt.Fprintf(w, `{"release-count": 2, "releases": [ - {"id": %q, "title": "Demon Days", "status": "Promotion", "date": "2005-04", "country": "JP", + {"id": %q, "title": "Ghost Nights", "status": "Promotion", "date": "2005-04", "country": "JP", "media": [{"position": 1, "format": "CD", "tracks": [ {"position": 1, "number": "1", "title": "Intro", "length": 63000, "recording": {"id": "rec-intro"}}]}]}, - {"id": %q, "title": "Demon Days", "status": "Official", "date": "2005-05-11", "country": "GB", + {"id": %q, "title": "Ghost Nights", "status": "Official", "date": "2005-05-11", "country": "GB", "media": [{"position": 1, "format": "CD", "tracks": [ {"position": 1, "number": "1", "title": "Intro", "length": 63000, "recording": {"id": "rec-intro"}}, {"position": 2, "number": "2", "title": "Last Living Souls", "length": 190000, "recording": {"id": "rec-lls"}}]}]} - ]}`, demonDaysJ, demonDaysR) + ]}`, ghostNightsJ, ghostNightsR) default: w.WriteHeader(http.StatusNotFound) } @@ -100,17 +100,17 @@ func TestRefreshReleaseGroup_ReadsEditionsAndTrackLists_Integration(t *testing.T q := dbq.New(pool) // The group isn't held yet: it is looked up first. - if err := s.RefreshReleaseGroup(ctx, demonDays); err != nil { + if err := s.RefreshReleaseGroup(ctx, ghostNights); err != nil { t.Fatal(err) } - group, err := q.GetMBReleaseGroup(ctx, demonDays) + group, err := q.GetMBReleaseGroup(ctx, ghostNights) if err != nil { t.Fatal(err) } - if group.Title != "Demon Days" || !group.ReleasesRefreshedAt.Valid { + if group.Title != "Ghost Nights" || !group.ReleasesRefreshedAt.Valid { t.Fatalf("group = %+v", group) } - tracks, err := q.ListMBReleaseTracksForGroup(ctx, demonDays) + tracks, err := q.ListMBReleaseTracksForGroup(ctx, ghostNights) if err != nil { t.Fatal(err) } @@ -123,15 +123,15 @@ func TestRefreshReleaseGroup_ReadsEditionsAndTrackLists_Integration(t *testing.T lls = &tracks[i] } } - if lls == nil || lls.ReleaseMbid != demonDaysR || lls.LengthMs != 190000 { + if lls == nil || lls.ReleaseMbid != ghostNightsR || lls.LengthMs != 190000 { t.Errorf("Last Living Souls = %+v", lls) } // Refreshing replaces rather than adds. - if err := s.RefreshReleaseGroup(ctx, demonDays); err != nil { + if err := s.RefreshReleaseGroup(ctx, ghostNights); err != nil { t.Fatal(err) } - if again, _ := q.ListMBReleaseTracksForGroup(ctx, demonDays); len(again) != 3 { + if again, _ := q.ListMBReleaseTracksForGroup(ctx, ghostNights); len(again) != 3 { t.Errorf("after a refresh: %d tracks, want 3", len(again)) } } @@ -145,7 +145,7 @@ func TestRefreshReleaseGroup_UnknownAndUnreachable_Integration(t *testing.T) { t.Errorf("unknown group: err = %v, want ErrNotFound", err) } mb.down.Store(true) - if err := s.RefreshReleaseGroup(ctx, demonDays); !errors.Is(err, musicbrainz.ErrUnreachable) { + if err := s.RefreshReleaseGroup(ctx, ghostNights); !errors.Is(err, musicbrainz.ErrUnreachable) { t.Errorf("MusicBrainz down: err = %v, want ErrUnreachable", err) } } diff --git a/internal/coverart/provider_deezer_test.go b/internal/coverart/provider_deezer_test.go index 56d8035a..394f283f 100644 --- a/internal/coverart/provider_deezer_test.go +++ b/internal/coverart/provider_deezer_test.go @@ -44,7 +44,7 @@ func TestDeezer_FetchArtistArt_Success(t *testing.T) { mux.HandleFunc("/search/artist", func(w http.ResponseWriter, r *http.Request) { imgURL := "http://" + r.Host + "/img/cp.jpg" w.Header().Set("Content-Type", "application/json") - _, _ = w.Write([]byte(`{"data":[{"name":"Caravan Palace","picture_xl":"` + imgURL + `"}]}`)) + _, _ = w.Write([]byte(`{"data":[{"name":"Caravel Palace","picture_xl":"` + imgURL + `"}]}`)) }) mux.HandleFunc("/img/", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "image/jpeg") @@ -52,7 +52,7 @@ func TestDeezer_FetchArtistArt_Success(t *testing.T) { }) p := newDeezerTestProvider(t, srv.URL) - thumb, fanart, err := p.FetchArtistArt(context.Background(), ArtistRef{Name: "Caravan Palace"}) + thumb, fanart, err := p.FetchArtistArt(context.Background(), ArtistRef{Name: "Caravel Palace"}) if err != nil { t.Fatalf("err = %v, want nil", err) } diff --git a/internal/coverart/provider_lastfm_test.go b/internal/coverart/provider_lastfm_test.go index ad836546..cc4ef343 100644 --- a/internal/coverart/provider_lastfm_test.go +++ b/internal/coverart/provider_lastfm_test.go @@ -53,7 +53,7 @@ func TestLastfm_FetchArtistArt_ByMBID(t *testing.T) { } imgURL := "http://" + r.Host + "/img/a.jpg" w.Header().Set("Content-Type", "application/json") - _, _ = w.Write([]byte(`{"artist":{"name":"Radiohead","image":[ + _, _ = w.Write([]byte(`{"artist":{"name":"Signal Tower","image":[ {"#text":"` + imgURL + `","size":"extralarge"} ]}}`)) }) @@ -64,8 +64,8 @@ func TestLastfm_FetchArtistArt_ByMBID(t *testing.T) { p := newLastfmTestProvider(t, srv.URL+"/", "test-key") thumb, fanart, err := p.FetchArtistArt(context.Background(), ArtistRef{ - MBID: "a74b1b7f-71a5-4011-9441-d0b5e4122711", - Name: "Radiohead", + MBID: "0a11ce00-0000-4000-8000-000000000003", + Name: "Signal Tower", }) if err != nil { t.Fatalf("err = %v, want nil", err) @@ -92,22 +92,22 @@ func TestLastfm_FetchArtistArt_ByName(t *testing.T) { } imgURL := "http://" + r.Host + "/img/b.jpg" w.Header().Set("Content-Type", "application/json") - _, _ = w.Write([]byte(`{"artist":{"name":"Björk","image":[ + _, _ = w.Write([]byte(`{"artist":{"name":"Höla","image":[ {"#text":"` + imgURL + `","size":"large"} ]}}`)) }) mux.HandleFunc("/img/", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "image/jpeg") - _, _ = w.Write([]byte("bjork-bytes")) + _, _ = w.Write([]byte("hola-bytes")) }) p := newLastfmTestProvider(t, srv.URL+"/", "test-key") - thumb, _, err := p.FetchArtistArt(context.Background(), ArtistRef{Name: "Björk"}) + thumb, _, err := p.FetchArtistArt(context.Background(), ArtistRef{Name: "Höla"}) if err != nil { t.Fatalf("err = %v, want nil", err) } - if string(thumb) != "bjork-bytes" { - t.Errorf("thumb = %q, want bjork-bytes", thumb) + if string(thumb) != "hola-bytes" { + t.Errorf("thumb = %q, want hola-bytes", thumb) } } @@ -242,7 +242,7 @@ func TestLastfm_FetchAlbumCover_Success(t *testing.T) { mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { imgURL := "http://" + r.Host + "/img/c.jpg" w.Header().Set("Content-Type", "application/json") - _, _ = w.Write([]byte(`{"album":{"name":"OK Computer","image":[ + _, _ = w.Write([]byte(`{"album":{"name":"OK Calculator","image":[ {"#text":"` + imgURL + `","size":"mega"} ]}}`)) }) @@ -253,8 +253,8 @@ func TestLastfm_FetchAlbumCover_Success(t *testing.T) { p := newLastfmTestProvider(t, srv.URL+"/", "test-key") body, err := p.FetchAlbumCover(context.Background(), AlbumRef{ - ArtistName: "Radiohead", - AlbumTitle: "OK Computer", + ArtistName: "Signal Tower", + AlbumTitle: "OK Calculator", }) if err != nil { t.Fatalf("err = %v, want nil", err) @@ -275,7 +275,7 @@ func TestLastfm_FetchAlbumCover_WithMBIDHint(t *testing.T) { } imgURL := "http://" + r.Host + "/img/d.jpg" w.Header().Set("Content-Type", "application/json") - _, _ = w.Write([]byte(`{"album":{"name":"Kid A","image":[ + _, _ = w.Write([]byte(`{"album":{"name":"Kid B","image":[ {"#text":"` + imgURL + `","size":"extralarge"} ]}}`)) }) @@ -286,9 +286,9 @@ func TestLastfm_FetchAlbumCover_WithMBIDHint(t *testing.T) { p := newLastfmTestProvider(t, srv.URL+"/", "test-key") body, err := p.FetchAlbumCover(context.Background(), AlbumRef{ - MBID: "b80a8a53-c9bf-3a3a-9a8c-bf76bf9a553a", - ArtistName: "Radiohead", - AlbumTitle: "Kid A", + MBID: "0a11ce00-0000-4000-8000-000000000004", + ArtistName: "Signal Tower", + AlbumTitle: "Kid B", }) if err != nil { t.Fatalf("err = %v, want nil", err) diff --git a/internal/coverart/provider_mbcaa.go b/internal/coverart/provider_mbcaa.go index 0bcc1f25..c05eed1b 100644 --- a/internal/coverart/provider_mbcaa.go +++ b/internal/coverart/provider_mbcaa.go @@ -21,7 +21,8 @@ type FetcherConfig struct { HTTPClient *http.Client // optional override for tests } -// Sample MBID used by TestConnection. Beatles' "Abbey Road" UK release. +// Sample MBID used by TestConnection: a long-established release that the +// Cover Art Archive has always held art for. const mbcaaTestSampleMBID = "f4b3df80-8a6c-3e87-b51e-5c1ee70a78ee" // mbcaaProvider implements Provider, AlbumCoverProvider, and diff --git a/internal/coverart/provider_theaudiodb.go b/internal/coverart/provider_theaudiodb.go index 2d9d8bff..238d63d7 100644 --- a/internal/coverart/provider_theaudiodb.go +++ b/internal/coverart/provider_theaudiodb.go @@ -31,9 +31,8 @@ const ( // 5xx before giving up and surfacing ErrTransient. theAudioDBMaxRetries = 3 - // theAudioDBTestSampleMBID is used by TestConnection. Pink Floyd's - // "The Dark Side of the Moon" — a stable popular release verified - // present in TheAudioDB at design time. + // theAudioDBTestSampleMBID is used by TestConnection: a stable, + // widely known release verified present in TheAudioDB at design time. theAudioDBTestSampleMBID = "f5093c06-23e3-404f-aeaa-40f72885ee3a" ) diff --git a/internal/library/artistcredit.go b/internal/library/artistcredit.go index 8ee67981..f2d0ce78 100644 --- a/internal/library/artistcredit.go +++ b/internal/library/artistcredit.go @@ -27,7 +27,7 @@ type artistCredit struct { // featuring finds where a guest credit starts: "X feat. Y", "X ft. Y", // "X featuring Y", "X (feat. Y)". Outside brackets the abbreviations need -// their full stop, so a band called "Little Feat" is not cut short; inside +// their full stop, so a band called "Tiny Feat" is not cut short; inside // brackets the stop is optional. var featuring = regexp.MustCompile(`(?i)\s+(?:[(\[]\s*(?:feat\.?|ft\.?|featuring)|feat\.|ft\.|featuring)\s`) @@ -36,7 +36,7 @@ var featuring = regexp.MustCompile(`(?i)\s+(?:[(\[]\s*(?:feat\.?|ft\.?|featuring // - A file that lists its artists one by one (Picard's ARTISTS tag, two or // more values) is filed under the first. This is the only way a // collaboration is split: "A & B" may be two artists or one band -// ("Simon & Garfunkel", "St. Paul & The Broken Bones"), and only the +// ("Simone & Garfield", "St. Mark & The Mended Bones"), and only the // list says which. // - Otherwise a featured guest is cut from the credit: "X feat. Y" is filed // under X. @@ -116,7 +116,7 @@ func readTagList(meta tag.Metadata, rs io.ReadSeeker, vorbisKey, textName string // id3TextList reads the TXXX field called name. dhowden/tag files each TXXX // frame under "TXXX", "TXXX_0", … as a *tag.Comm. ID3v2.4 separates the // values of one frame with NUL. ID3v2.3 has no separator, and a "/" there -// may be part of a name (AC/DC), so a v2.3 frame is one value. +// may be part of a name (AM/FM), so a v2.3 frame is one value. func id3TextList(meta tag.Metadata, name string) []string { var out []string for key, v := range meta.Raw() { diff --git a/internal/library/artistcredit_test.go b/internal/library/artistcredit_test.go index 72f0a622..00346e47 100644 --- a/internal/library/artistcredit_test.go +++ b/internal/library/artistcredit_test.go @@ -16,13 +16,13 @@ func TestWithoutGuests(t *testing.T) { {"Low Tide Choir [ft Ruby Calloway]", "Low Tide Choir"}, {"Low Tide Choir FEAT. Ruby Calloway & Mae", "Low Tide Choir"}, // Names that only look like a credit stay whole. - {"Little Feat", "Little Feat"}, - {"Little Feat featuring Bonnie Raitt", "Little Feat"}, - {"Daft Punk", "Daft Punk"}, - {"Soft Cell", "Soft Cell"}, + {"Tiny Feat", "Tiny Feat"}, + {"Tiny Feat featuring Bonnie Rains", "Tiny Feat"}, + {"Deft Monks", "Deft Monks"}, + {"Loft Cell", "Loft Cell"}, {"Featuring Fools", "Featuring Fools"}, - {"Simon & Garfunkel", "Simon & Garfunkel"}, - {"St. Paul & The Broken Bones", "St. Paul & The Broken Bones"}, + {"Simone & Garfield", "Simone & Garfield"}, + {"St. Mark & The Mended Bones", "St. Mark & The Mended Bones"}, } for _, tc := range tests { if got := withoutGuests(tc.credit); got != tc.want { @@ -65,15 +65,15 @@ func TestReadArtistCredit_ID3(t *testing.T) { }, { name: "an & the file does not list is one artist", - artist: "St. Paul & The Broken Bones", - raw: map[string]interface{}{"TXXX": &tag.Comm{Description: "ARTISTS", Text: "St. Paul & The Broken Bones"}}, - want: artistCredit{Name: "St. Paul & The Broken Bones"}, + artist: "St. Mark & The Mended Bones", + raw: map[string]interface{}{"TXXX": &tag.Comm{Description: "ARTISTS", Text: "St. Mark & The Mended Bones"}}, + want: artistCredit{Name: "St. Mark & The Mended Bones"}, }, { name: "a v2.3 list has no separator, so a slash stays in the name", - artist: "AC/DC", - raw: map[string]interface{}{"TXXX_0": &tag.Comm{Description: "Artists", Text: "AC/DC"}}, - want: artistCredit{Name: "AC/DC"}, + artist: "AM/FM", + raw: map[string]interface{}{"TXXX_0": &tag.Comm{Description: "Artists", Text: "AM/FM"}}, + want: artistCredit{Name: "AM/FM"}, }, { name: "no artist at all", @@ -116,14 +116,14 @@ func TestReadArtistCredit_FLACListsItsArtists(t *testing.T) { } func TestReadArtistCredit_FLACWithOneArtist(t *testing.T) { - data := buildFLAC(false, "ARTIST=Marina & the Kats", "ARTISTS=Marina & the Kats", "MUSICBRAINZ_ARTISTID=id-kats") + data := buildFLAC(false, "ARTIST=Marisa & the Cats", "ARTISTS=Marisa & the Cats", "MUSICBRAINZ_ARTISTID=id-kats") rs := bytes.NewReader(data) meta, err := tag.ReadFrom(rs) if err != nil { t.Fatalf("tag.ReadFrom: %v", err) } got := readArtistCredit(meta, rs, ReadTagMBIDs(meta)) - if want := (artistCredit{Name: "Marina & the Kats", MBID: "id-kats"}); got != want { + if want := (artistCredit{Name: "Marisa & the Cats", MBID: "id-kats"}); got != want { t.Errorf("readArtistCredit = %+v, want %+v", got, want) } } diff --git a/internal/library/duplicate_classify.go b/internal/library/duplicate_classify.go index b4b19817..edc776c9 100644 --- a/internal/library/duplicate_classify.go +++ b/internal/library/duplicate_classify.go @@ -17,13 +17,13 @@ import ( // a song once, so the extra copies are the ones to fold away. // - cross_release: the copies are on different albums. A single and the // album it came from, a deluxe edition and the standard one, or one -// recording a later release retitled ("The Ragtime Cat", "F.O.D. (live)", +// recording a later release retitled ("The Ragtime Cat", "F.O.E. (live)", // a romanized title): each copy belongs to its own release, so none is // deleted (unless it is a video rip; the resolver decides). Copies under // different titles on different releases are retitles, not different // songs. // - distinct: one album, two versions of a song that sound alike, named as -// such ("Lovesick", "Lovesick (Instrumental)"). Not duplicates. +// such ("Homesick", "Homesick (Instrumental)"). Not duplicates. // - mismatch: one album holds the same audio under different song titles: // one file filling several track slots, a broken download. Which slot is // right is the resolver's to decide from MusicBrainz's track lengths. @@ -54,7 +54,7 @@ type ClassifyMember struct { // adds to a title (featuring credits, remaster notes, video markers) and keeps // what names a different recording (live, demo, remix, instrumental). On one // album, titles that differ only by such a word are two versions (distinct) -// unless the bytes are identical, which is one file twice: "WWW" and "WWW +// unless the bytes are identical, which is one file twice: "XYZ" and "XYZ // (instrumental)" holding the same file is a wrong slot. func ClassifyDuplicateGroup(tier string, members []ClassifyMember) DuplicateClass { if len(members) < 2 { @@ -98,8 +98,8 @@ var versionWord = regexp.MustCompile( // versionWords lists, sorted and lowercased, the version words in a copy's // title and file name together. Two copies holding one title tag can still be -// two versions, told apart only by the file name: "Suite-Pee" and -// "Suite-Pee (Clean Version)", "Luv (sic) Grand Finale" and its instrumental. +// two versions, told apart only by the file name: "Suite-Tea" and +// "Suite-Tea (Clean Version)", "Hush (sic) Grand Finale" and its instrumental. func versionWords(title, path string) string { seen := map[string]bool{} name := strings.TrimSuffix(filepath.Base(path), filepath.Ext(path)) @@ -123,7 +123,7 @@ func versionWords(title, path string) string { // songKey is MatchTitleKey with every bracketed segment and a dashed version // suffix dropped: the song a title names, whatever version of it. -// "Lovesick (Instrumental)", "Lovesick - Instrumental Version" and "Lovesick" +// "Homesick (Instrumental)", "Homesick - Instrumental Version" and "Homesick" // share one. func songKey(title, artist string) string { t := versionSuffix.ReplaceAllString(bracketed.ReplaceAllString(title, " "), "") @@ -134,9 +134,9 @@ func songKey(title, artist string) string { } var ( - // A bracketed credit: "(feat. Panda Bear)", "[ft. X]", "(featuring Y)". + // A bracketed credit: "(feat. Koala Bear)", "[ft. X]", "(featuring Y)". featBracket = regexp.MustCompile(`(?i)[(\[][^)\]]*\b(feat\.?|ft\.?|featuring)\s[^)\]]*[)\]]`) - // A credit trailing the title without brackets: "Doin' It Right ft. Panda + // A credit trailing the title without brackets: "Doin' It Twice ft. Panda // Bear". featTrailing = regexp.MustCompile(`(?i)\s(feat\.?|ft\.?|featuring)\s.*$`) // "(2011 Remaster)", "[Remastered]", "- Remastered 2009". diff --git a/internal/library/duplicate_classify_test.go b/internal/library/duplicate_classify_test.go index 9aea59c3..34661f81 100644 --- a/internal/library/duplicate_classify_test.go +++ b/internal/library/duplicate_classify_test.go @@ -10,7 +10,7 @@ import ( // The group shapes the classifier tells apart. func TestClassifyDuplicateGroup(t *testing.T) { m := func(album, title string) ClassifyMember { - return ClassifyMember{AlbumID: album, Title: title, ArtistName: "Gorillaz"} + return ClassifyMember{AlbumID: album, Title: title, ArtistName: "Plastic Apes"} } cases := []struct { name string @@ -18,30 +18,30 @@ func TestClassifyDuplicateGroup(t *testing.T) { members []ClassifyMember want DuplicateClass }{ - {"Humanz: one album, one song twice", "exact", - []ClassifyMember{m("humanz", "Saturnz Barz"), m("humanz", "Saturnz Barz (Official Video)")}, ClassSameRelease}, + {"Mammalz: one album, one song twice", "exact", + []ClassifyMember{m("mammalz", "Neptunez Barz"), m("mammalz", "Neptunez Barz (Official Video)")}, ClassSameRelease}, {"one album, video upload title with artist prefix", "acoustic", - []ClassifyMember{m("humanz", "Andromeda"), m("humanz", "Gorillaz - Andromeda (Official Audio)")}, ClassSameRelease}, + []ClassifyMember{m("mammalz", "Cassiopeia"), m("mammalz", "Plastic Apes - Cassiopeia (Official Audio)")}, ClassSameRelease}, {"one album, identical bytes under a version title: one file in two slots", "exact", - []ClassifyMember{m("www", "WWW"), m("www", "WWW (instrumental)")}, ClassMismatch}, + []ClassifyMember{m("www", "XYZ"), m("www", "XYZ (instrumental)")}, ClassMismatch}, {"one album, acoustic match, two versions named", "acoustic", - []ClassifyMember{m("moe", "Lovesick"), m("moe", "Lovesick (Instrumental)")}, ClassDistinct}, + []ClassifyMember{m("moe", "Homesick"), m("moe", "Homesick (Instrumental)")}, ClassDistinct}, {"Void: one album, one audio under three song titles", "acoustic", - []ClassifyMember{m("void", "Slimewar (into the void)"), m("void", "Void"), m("void", "Reach")}, ClassMismatch}, + []ClassifyMember{m("void", "Slimeworld (into the void)"), m("void", "Void"), m("void", "Reach")}, ClassMismatch}, {"a version named after a dash", "acoustic", []ClassifyMember{m("andora", "Goodbye Yesterday"), m("andora", "Goodbye Yesterday - Instrumental Version")}, ClassDistinct}, {"a dash that names no version", "acoustic", []ClassifyMember{m("a", "Monday Chill - Part One"), m("a", "Monday Chill - Part Two")}, ClassMismatch}, {"Slasher and Slasher II are not versions of one song", "acoustic", []ClassifyMember{m("slasher", "Slasher"), m("slasher", "Slasher II")}, ClassMismatch}, - {"Big Me: the single and the album", "exact", - []ClassifyMember{m("single", "Big Me"), m("album", "Big Me")}, ClassCrossRelease}, + {"Big You: the single and the album", "exact", + []ClassifyMember{m("single", "Big You"), m("album", "Big You")}, ClassCrossRelease}, {"remaster and featuring credits are one song", "acoustic", - []ClassifyMember{m("a", "Feel Good Inc. (2017 Remaster)"), m("b", "Feel Good Inc feat. De La Soul")}, ClassCrossRelease}, + []ClassifyMember{m("a", "Feel Fine Ltd. (2017 Remaster)"), m("b", "Feel Fine Ltd feat. Del Mar Soul")}, ClassCrossRelease}, {"a later release retitles the recording", "acoustic", []ClassifyMember{m("coco", "Ragtime Cat"), m("single", "The Ragtime Cat")}, ClassCrossRelease}, {"identical bytes on two albums under two titles", "exact", - []ClassifyMember{m("dookie", "F.O.D."), m("live", "F.O.D. (live)")}, ClassCrossRelease}, + []ClassifyMember{m("cookie", "F.O.E."), m("live", "F.O.E. (live)")}, ClassCrossRelease}, {"a lone copy", "exact", []ClassifyMember{m("a", "Song")}, ClassReview}, } for _, tc := range cases { @@ -53,9 +53,9 @@ func TestClassifyDuplicateGroup(t *testing.T) { func TestMatchTitleKey(t *testing.T) { cases := []struct{ title, artist, want string }{ - {"Saturnz Barz (Official Video)", "Gorillaz", "saturnzbarz"}, - {"Gorillaz - Saturnz Barz", "Gorillaz", "saturnzbarz"}, - {"Doin' It Right (Music Video) ft. Panda Bear", "Daft Punk", "doinitright"}, + {"Neptunez Barz (Official Video)", "Plastic Apes", "neptunezbarz"}, + {"Plastic Apes - Neptunez Barz", "Plastic Apes", "neptunezbarz"}, + {"Doin' It Twice (Music Video) ft. Koala Bear", "Deft Monks", "doinittwice"}, {"Song [feat. X]", "", "song"}, {"Song - Remastered 2009", "", "song"}, {"Rock & Roll", "", "rockandroll"}, @@ -79,12 +79,12 @@ func TestMatchTitleKey(t *testing.T) { // named differently must agree. func TestVersionWords(t *testing.T) { differ := [][2][2]string{ - {{"Suite-Pee", "/m/SOAD/Sugar/System of a Down - Sugar - 02 - Suite-Pee.mp3"}, - {"Suite-Pee", "/m/SOAD/Sugar/System of a Down - Sugar - 02 - Suite-Pee (Clean Version).mp3"}}, - {{"Luv (sic) Grand Finale", "/m/Nujabes/Hexalogy/Nujabes - Luv(sic) Hexalogy - 06 - Luv (sic) Grand Finale Instrumentals.mp3"}, - {"Luv (sic) Grand Finale", "/m/Nujabes/Hexalogy/0106 - Luvsic Grand Finale.m4a"}}, - {{"Charger", "/m/Gorillaz/Humanz/Gorillaz - Humanz - 08 - Charger - live in Cologne 2017.mp3"}, - {"Charger", "/m/Gorillaz/Humanz/CD 01/08 Charger.flac"}}, + {{"Suite-Tea", "/m/SOAC/Sugar/System of a Clown - Sugar - 02 - Suite-Tea.mp3"}, + {"Suite-Tea", "/m/SOAC/Sugar/System of a Clown - Sugar - 02 - Suite-Tea (Clean Version).mp3"}}, + {{"Hush (sic) Grand Finale", "/m/Sebanuj/Heptalogy/Sebanuj - Hush(sic) Heptalogy - 06 - Hush (sic) Grand Finale Instrumentals.mp3"}, + {"Hush (sic) Grand Finale", "/m/Sebanuj/Heptalogy/0106 - Hushsic Grand Finale.m4a"}}, + {{"Dynamo", "/m/Plastic Apes/Mammalz/Plastic Apes - Mammalz - 08 - Dynamo - live in Cologne 2017.mp3"}, + {"Dynamo", "/m/Plastic Apes/Mammalz/CD 01/08 Dynamo.flac"}}, } for _, p := range differ { a, b := versionWords(p[0][0], p[0][1]), versionWords(p[1][0], p[1][1]) @@ -93,12 +93,12 @@ func TestVersionWords(t *testing.T) { } } agree := [][2][2]string{ - {{"Heat Waves (Shakur Ahmad Remix)", "/m/GA/Glass Animals - Dreamland Deluxe - 02 - Heat Waves (Shakur Ahmad Remix).mp3"}, - {"Heat Waves (Shakur Ahmad Remix)", "/m/GA/02. Heat Waves (Shakur Ahmad Remix).flac"}}, - {{"Luv (sic) Instrumentals", "/m/Nujabes/0201 - Luvsic instrumentals.m4a"}, - {"Luv (sic) Instrumentals", "/m/Nujabes/Nujabes - Luv(sic) Hexalogy - 01 - Luv (sic) Instrumentals.mp3"}}, - {{"Henrietta", "/m/The Fratellis - Costello Music - 01 - Henrietta.mp3"}, - {"Henrietta", "/m/The Fratellis - Costello Music - 01 - Henrietta.flac"}}, + {{"Heat Lines (Tariq Amal Remix)", "/m/GA/Glass Insects - Dreamland Deluxe - 02 - Heat Lines (Tariq Amal Remix).mp3"}, + {"Heat Lines (Tariq Amal Remix)", "/m/GA/02. Heat Lines (Tariq Amal Remix).flac"}}, + {{"Hush (sic) Instrumentals", "/m/Sebanuj/0201 - Hushsic instrumentals.m4a"}, + {"Hush (sic) Instrumentals", "/m/Sebanuj/Sebanuj - Hush(sic) Heptalogy - 01 - Hush (sic) Instrumentals.mp3"}}, + {{"Henrietta Mae", "/m/The Fratellinis - Castello Music - 01 - Henrietta Mae.mp3"}, + {"Henrietta Mae", "/m/The Fratellinis - Castello Music - 01 - Henrietta Mae.flac"}}, } for _, p := range agree { a, b := versionWords(p[0][0], p[0][1]), versionWords(p[1][0], p[1][1]) @@ -113,11 +113,11 @@ func TestWrongSlots(t *testing.T) { copies := func(titles ...string) []slotCopy { out := make([]slotCopy, len(titles)) for i, title := range titles { - out[i] = slotCopy{Title: title, Artist: "Savant", DurationMs: 220000} + out[i] = slotCopy{Title: title, Artist: "Savanta", DurationMs: 220000} } return out } - void := []dbq.MbReleaseTrack{track("Slimewar (Into the Void)", 300000), track("Reach", 281000), track("Void", 220500)} + void := []dbq.MbReleaseTrack{track("Slimeworld (Into the Void)", 300000), track("Reach", 281000), track("Void", 220500)} cases := []struct { name string copies []slotCopy @@ -126,17 +126,17 @@ func TestWrongSlots(t *testing.T) { losers []int ok bool }{ - {"Void: the file is Void's; the other two slots are other songs", copies("Slimewar (into the void)", "Void", "Reach"), void, 1, []int{0, 2}, true}, + {"Void: the file is Void's; the other two slots are other songs", copies("Slimeworld (into the void)", "Void", "Reach"), void, 1, []int{0, 2}, true}, {"no track list", copies("Void", "Reach"), nil, -1, nil, false}, {"a title the track list does not hold", copies("Void", "Bonus"), void, -1, nil, false}, {"Killjoy held twice beside Dreamland's slot", []slotCopy{ - {Title: "Dreamland", Artist: "Fox Stevenson", DurationMs: 167000}, - {Title: "Killjoy", Artist: "Fox Stevenson", DurationMs: 167000}, - {Title: "Killjoy", Artist: "Fox Stevenson", DurationMs: 166000}, + {Title: "Dreamland", Artist: "Lynx Morrison", DurationMs: 167000}, + {Title: "Killjoy", Artist: "Lynx Morrison", DurationMs: 167000}, + {Title: "Killjoy", Artist: "Lynx Morrison", DurationMs: 166000}, }, []dbq.MbReleaseTrack{track("Killjoy", 166500), track("Dreamland", 214000)}, 1, []int{0}, true}, {"two slots fit the file", copies("Void", "Reach"), []dbq.MbReleaseTrack{track("Void", 220000), track("Reach", 221500)}, -1, nil, false}, {"a slot near but not within the fit", copies("Void", "Reach"), []dbq.MbReleaseTrack{track("Void", 220000), track("Reach", 226000)}, -1, nil, false}, - {"no slot fits, and every slot is clearly another song's", copies("Reach", "Slimewar (into the void)"), void, -1, []int{0, 1}, true}, + {"no slot fits, and every slot is clearly another song's", copies("Reach", "Slimeworld (into the void)"), void, -1, []int{0, 1}, true}, {"no slot fits, but one is near", copies("Void", "Reach"), []dbq.MbReleaseTrack{track("Void", 226000), track("Reach", 281000)}, -1, nil, false}, {"an unknown length counts for nothing", copies("Void", "Reach"), []dbq.MbReleaseTrack{track("Void", 220000), track("Reach", 0)}, -1, nil, false}, } @@ -149,15 +149,15 @@ func TestWrongSlots(t *testing.T) { } } -// The lengths cannot place a recording filed as several songs (Savant's -// Mortals, cut to each slot's length); what AcoustID calls it can. +// The lengths cannot place a recording filed as several songs (Savanta's +// Immortals, cut to each slot's length); what AcoustID calls it can. func TestNamedCopies(t *testing.T) { track := func(title string, ms int32, rec string) dbq.MbReleaseTrack { return dbq.MbReleaseTrack{Title: title, LengthMs: ms, RecordingMbid: rec} } copies := []slotCopy{ - {Title: "Tormentor", Artist: "The Wombats", DurationMs: 220000}, - {Title: "Record Shop", Artist: "The Wombats", DurationMs: 181000}, + {Title: "Tormentor", Artist: "The Wallabies", DurationMs: 220000}, + {Title: "Record Shop", Artist: "The Wallabies", DurationMs: 181000}, } album := []dbq.MbReleaseTrack{ track("Tormentor", 221000, "rec-tormentor"), track("Record Shop", 180000, "rec-record-shop"), track("Ice Cream", 200000, "rec-ice"), diff --git a/internal/library/duplicate_match_test.go b/internal/library/duplicate_match_test.go index f0d2decf..179e3845 100644 --- a/internal/library/duplicate_match_test.go +++ b/internal/library/duplicate_match_test.go @@ -115,7 +115,7 @@ func TestGroupDuplicates_ExactTier(t *testing.T) { res := groupDuplicates([]fingerprintCandidate{ {ID: "www-01", DurationMs: 215000, StreamSHA256: hash}, {ID: "www-02", DurationMs: 215000, StreamSHA256: hash}, - {ID: "lovesick", DurationMs: 198000, StreamSHA256: []byte("another")}, + {ID: "homesick", DurationMs: 198000, StreamSHA256: []byte("another")}, }, defaultAcousticMaxBitErrorRate) want := []duplicateGroup{{Tier: tierExact, Members: []string{"www-01", "www-02"}}} if !reflect.DeepEqual(res.Groups, want) { diff --git a/internal/library/duplicate_merge_test.go b/internal/library/duplicate_merge_test.go index 3d9def22..a8143b14 100644 --- a/internal/library/duplicate_merge_test.go +++ b/internal/library/duplicate_merge_test.go @@ -59,7 +59,7 @@ func newMergeFixture(t *testing.T) mergeFixture { } return tr } - f.remove = upsert("WWW (copy)", f.removePath) + f.remove = upsert("XYZ (copy)", f.removePath) f.other = upsert("Neighbour", filepath.Join(dir, "other.mp3")) mustExec := func(sql string, args ...any) { diff --git a/internal/library/duplicate_resolve_test.go b/internal/library/duplicate_resolve_test.go index afca68cc..04647fc3 100644 --- a/internal/library/duplicate_resolve_test.go +++ b/internal/library/duplicate_resolve_test.go @@ -15,7 +15,7 @@ import ( syncpkg "git.fabledsword.com/bvandeusen/minstrel/internal/sync" ) -// resolveFixture is the Humanz shape: one album, one song twice, both copies on +// resolveFixture is the Mammalz shape: one album, one song twice, both copies on // disk under an artist/album folder, in one pending exact-tier group. type resolveFixture struct { pool *pgxpool.Pool @@ -29,13 +29,13 @@ func newResolveFixture(t *testing.T) resolveFixture { pool := newPool(t) ctx := context.Background() q := dbq.New(pool) - dir := filepath.Join(t.TempDir(), "Gorillaz", "Humanz (2017)") + dir := filepath.Join(t.TempDir(), "Plastic Apes", "Mammalz (2017)") if err := os.MkdirAll(dir, 0o755); err != nil { t.Fatal(err) } f := resolveFixture{pool: pool} - f.cleanPath = filepath.Join(dir, "Gorillaz - Humanz - 03 - Saturnz Barz.mp3") - f.ripPath = filepath.Join(dir, "Gorillaz - Humanz - 03 - Saturnz Barz (Official Video).mp3") + f.cleanPath = filepath.Join(dir, "Plastic Apes - Mammalz - 03 - Neptunez Barz.mp3") + f.ripPath = filepath.Join(dir, "Plastic Apes - Mammalz - 03 - Neptunez Barz (Official Video).mp3") for _, p := range []string{f.cleanPath, f.ripPath} { if err := os.WriteFile(p, []byte("audio"), 0o644); err != nil { t.Fatal(err) @@ -45,7 +45,7 @@ func newResolveFixture(t *testing.T) resolveFixture { var artist dbq.Artist f.clean, album, artist = seedTrack(t, pool, f.cleanPath) rip, err := q.UpsertTrack(ctx, dbq.UpsertTrackParams{ - Title: "Saturnz Barz (Official Video)", AlbumID: album.ID, ArtistID: artist.ID, + Title: "Neptunez Barz (Official Video)", AlbumID: album.ID, ArtistID: artist.ID, DurationMs: 1000, FilePath: f.ripPath, FileSize: 100, FileFormat: "mp3", }) if err != nil { @@ -58,7 +58,7 @@ func newResolveFixture(t *testing.T) resolveFixture { t.Fatalf("exec %q: %v", sql, err) } } - exec(`UPDATE tracks SET title = 'Saturnz Barz' WHERE id = $1`, f.clean.ID) + exec(`UPDATE tracks SET title = 'Neptunez Barz' WHERE id = $1`, f.clean.ID) if err := pool.QueryRow(ctx, `INSERT INTO duplicate_groups (member_key, tier) VALUES ('resolve-fixture', 'exact') RETURNING id`, ).Scan(&f.groupID); err != nil { @@ -150,9 +150,9 @@ func newCrossReleaseRipFixture(t *testing.T) crossReleaseRipFixture { q := dbq.New(pool) root := t.TempDir() f := crossReleaseRipFixture{pool: pool} - f.cleanPath = filepath.Join(root, "Gorillaz", "Demon Days (2005)", "06 - Feel Good Inc.mp3") - f.ripPath = filepath.Join(root, "Gorillaz", "Feel Good Inc (2005)", "01 - Feel Good Inc. (Official Video).mp3") - artist, err := q.UpsertArtist(ctx, dbq.UpsertArtistParams{Name: "Gorillaz", SortName: "Gorillaz"}) + f.cleanPath = filepath.Join(root, "Plastic Apes", "Ghost Nights (2005)", "06 - Feel Fine Ltd.mp3") + f.ripPath = filepath.Join(root, "Plastic Apes", "Feel Fine Ltd (2005)", "01 - Feel Fine Ltd. (Official Video).mp3") + artist, err := q.UpsertArtist(ctx, dbq.UpsertArtistParams{Name: "Plastic Apes", SortName: "Plastic Apes"}) if err != nil { t.Fatal(err) } @@ -177,8 +177,8 @@ func newCrossReleaseRipFixture(t *testing.T) crossReleaseRipFixture { } return tr } - f.clean = track("Demon Days", "Feel Good Inc.", f.cleanPath) - f.rip = track("Feel Good Inc.", "Feel Good Inc. (Official Video)", f.ripPath) + f.clean = track("Ghost Nights", "Feel Fine Ltd.", f.cleanPath) + f.rip = track("Feel Fine Ltd.", "Feel Fine Ltd. (Official Video)", f.ripPath) if err := pool.QueryRow(ctx, `INSERT INTO duplicate_groups (member_key, tier) VALUES ('cross-rip', 'acoustic') RETURNING id`, ).Scan(&f.groupID); err != nil { @@ -217,8 +217,8 @@ func TestResolveDuplicates_MergesARipAcrossReleases_Integration(t *testing.T) { func TestResolveDuplicates_KeepsCleanCopiesOnTwoReleases_Integration(t *testing.T) { for name, prepare := range map[string]func(f crossReleaseRipFixture) (string, []any){ "renamed": func(f crossReleaseRipFixture) (string, []any) { - return `UPDATE tracks SET title = 'Feel Good Inc.', file_path = $2 WHERE id = $1`, - []any{f.rip.ID, filepath.Join(filepath.Dir(f.ripPath), "01 - Feel Good Inc.mp3")} + return `UPDATE tracks SET title = 'Feel Fine Ltd.', file_path = $2 WHERE id = $1`, + []any{f.rip.ID, filepath.Join(filepath.Dir(f.ripPath), "01 - Feel Fine Ltd.mp3")} }, "kept as fine": func(f crossReleaseRipFixture) (string, []any) { return `UPDATE tracks SET source_verdict = 'fine' WHERE id = $1`, []any{f.rip.ID} @@ -245,7 +245,7 @@ func TestResolveDuplicates_KeepsCleanCopiesOnTwoReleases_Integration(t *testing. } // Identical audio under two titles on two albums, neither a rip: a later -// release retitled the recording ("F.O.D." and "F.O.D. (live)"). Each copy +// release retitled the recording ("F.O.E." and "F.O.E. (live)"). Each copy // belongs to its release, so nothing is removed and they count as one song. func TestResolveDuplicates_LinksOneRecordingUnderTwoTitles_Integration(t *testing.T) { f := newCrossReleaseRipFixture(t) @@ -282,7 +282,7 @@ func newOneAlbumFixture(t *testing.T, tier, titleA, titleB string) oneAlbumFixtu pool := newPool(t) ctx := context.Background() q := dbq.New(pool) - dir := filepath.Join(t.TempDir(), "Savant", "Void") + dir := filepath.Join(t.TempDir(), "Savanta", "Void") if err := os.MkdirAll(dir, 0o755); err != nil { t.Fatal(err) } @@ -331,7 +331,7 @@ func auditCount(t *testing.T, pool *pgxpool.Pool, action string, groupID pgtype. // Two versions of a song on one album that sound alike are not duplicates: // the group is dismissed and both files stay. func TestResolveDuplicates_DismissesTwoVersionsOfASong_Integration(t *testing.T) { - f := newOneAlbumFixture(t, "acoustic", "Lovesick", "Lovesick (Instrumental)") + f := newOneAlbumFixture(t, "acoustic", "Homesick", "Homesick (Instrumental)") res, err := ResolveDuplicates(context.Background(), f.pool, nil, "", true) if err != nil { t.Fatal(err) @@ -418,7 +418,7 @@ func TestResolveDuplicates_RemovesACopyFromAnotherSongsSlot_Integration(t *testi } // A slot emptied of another song's file folds into a copy of its own song the -// album already holds (Savant's VOID DLC "Weeper" beside Void's). A copy under +// album already holds (Savanta's VOID DLC "Sleeper" beside Void's). A copy under // the title that is not as long as the song is another song: the slot waits for // a good copy, and folds into that. func TestResolveDuplicates_EmptiedSlotFoldsOnlyIntoItsOwnSong_Integration(t *testing.T) { @@ -465,7 +465,7 @@ func TestResolveDuplicates_EmptiedSlotFoldsOnlyIntoItsOwnSong_Integration(t *tes } // One recording filling two slots whose songs are both clearly something else -// (Shnabubula's whole album in one file): both copies go, nothing is kept. +// (Shnorkelbub's whole album in one file): both copies go, nothing is kept. func TestResolveDuplicates_RemovesEveryCopyWhenNoSlotIsTheirs_Integration(t *testing.T) { f := newOneAlbumFixture(t, "acoustic", "Void", "Reach") seedTrackList(t, f.pool, f.album, map[string]int{"Void": 282000, "Reach": 421000}) @@ -735,7 +735,7 @@ func TestResolveDuplicates_HoldsBackRips_Integration(t *testing.T) { t.Fatal(err) } if _, err := f.pool.Exec(ctx, `UPDATE tracks SET file_path = $2 WHERE id = $1`, - f.rip.ID, filepath.Join(filepath.Dir(f.ripPath), "01 - Feel Good Inc.mp3")); err != nil { + f.rip.ID, filepath.Join(filepath.Dir(f.ripPath), "01 - Feel Fine Ltd.mp3")); err != nil { t.Fatal(err) } if res := resolve(); res.Released != 1 { diff --git a/internal/library/duplicate_settle.go b/internal/library/duplicate_settle.go index ba5e21aa..fb881a11 100644 --- a/internal/library/duplicate_settle.go +++ b/internal/library/duplicate_settle.go @@ -22,8 +22,8 @@ import ( // Retitles across releases are linked like any cross-release group. What is // left on one album is three shapes: // -// - distinct: two versions of a song that sound alike ("Lovesick" and -// "Lovesick (Instrumental)"). Not duplicates, so the group is dismissed. +// - distinct: two versions of a song that sound alike ("Homesick" and +// "Homesick (Instrumental)"). Not duplicates, so the group is dismissed. // - mismatch: one file filling several track slots (one recording as // three of an album's tracks). The album's MusicBrainz track list // says how long each slot's song is. When exactly one slot's song is as @@ -70,7 +70,7 @@ type slotCopy struct { // wrongSlots decides which copies of a one-album mismatch sit in a slot that // is not theirs. keep is the copy whose slot fits the recording, or -1 when -// every copy is clearly another song's (Shnabubula's whole album, 45 minutes +// every copy is clearly another song's (Shnorkelbub's whole album, 45 minutes // in one file, filed as both "Fading Light" and "Looking for Answers"): then // all of them go. ok is false when the track list cannot say, and nothing // should be removed. @@ -426,8 +426,8 @@ func groupRecordings( // emptiedSlots is the losers whose song the album holds no other copy of: // no present track on it under that title as long as the song's slot. Those // wait for a good copy to arrive. The rest are the song held -// twice, and missing-pair folding folds them into the copy held: Savant's -// VOID DLC "Weeper" beside Void's. A failed read counts every loser as +// twice, and missing-pair folding folds them into the copy held: Savanta's +// VOID DLC "Sleeper" beside Void's. A failed read counts every loser as // emptied, which only makes the album wait for a copy it may not need. func emptiedSlots( ctx context.Context, q *dbq.Queries, logger *slog.Logger, g *resolveGroup, losers []int, tracks []dbq.MbReleaseTrack, diff --git a/internal/library/duplicate_settle_test.go b/internal/library/duplicate_settle_test.go index 19329766..45ed75cf 100644 --- a/internal/library/duplicate_settle_test.go +++ b/internal/library/duplicate_settle_test.go @@ -121,7 +121,7 @@ func TestSettleWrongSlot_KeepsTheCopyTheOperatorNames_Integration(t *testing.T) func TestSettleWrongSlot_RefusesWhatItCannotSettle_Integration(t *testing.T) { ctx := context.Background() t.Run("two versions of a song", func(t *testing.T) { - f := newOneAlbumFixture(t, "acoustic", "Lovesick", "Lovesick (Instrumental)") + f := newOneAlbumFixture(t, "acoustic", "Homesick", "Homesick (Instrumental)") if _, err := SettleWrongSlot(ctx, f.pool, nil, f.groupID, pgtype.UUID{}, pgtype.UUID{}); !errors.Is(err, ErrNotWrongSlot) { t.Errorf("err = %v, want ErrNotWrongSlot", err) } diff --git a/internal/library/duplicate_survivor_test.go b/internal/library/duplicate_survivor_test.go index ad0020f9..b551d6ac 100644 --- a/internal/library/duplicate_survivor_test.go +++ b/internal/library/duplicate_survivor_test.go @@ -119,7 +119,7 @@ func TestProposeSurvivor_LosslessThenTagFit(t *testing.T) { wantID: "fits", wantReason: "tags fit the album", }, { - // The Humanz shape: two rips a few bytes apart, one carrying a + // The Mammalz shape: two rips a few bytes apart, one carrying a // video marker and clashing with another track's position. name: "tag fit beats a few bytes", cands: []SurvivorCandidate{ diff --git a/internal/library/moved_test.go b/internal/library/moved_test.go index 0c32383a..4910a23a 100644 --- a/internal/library/moved_test.go +++ b/internal/library/moved_test.go @@ -68,8 +68,8 @@ func hashRow(n byte, path string) dbq.FindMissingTrackByAudioHashRow { func audioHash(b byte) []byte { return bytes.Repeat([]byte{b}, 32) } const ( - oldPath = "/music/Linkin Park/Minutes to Midnight/02 - Bleed It Out.mp3" - newPath = "/music/Linkin Park/Minutes to Midnight/04 - Bleed It Out.mp3" + oldPath = "/music/Lincoln Yard/Minutes to Noon/02 - Bleed It Out.mp3" + newPath = "/music/Lincoln Yard/Minutes to Noon/04 - Bleed It Out.mp3" ) func TestAdoptMovedTrack_MatchesByMbid(t *testing.T) { diff --git a/internal/library/new_music_test.go b/internal/library/new_music_test.go index 616111e4..972b8bfa 100644 --- a/internal/library/new_music_test.go +++ b/internal/library/new_music_test.go @@ -59,12 +59,12 @@ func TestAnnounceNewAlbums_TellsEveryoneOfEachNewAlbumOnce(t *testing.T) { } // A new album with its own new track. - arrived, err := q.UpsertAlbum(ctx, dbq.UpsertAlbumParams{Title: "Geogaddi", SortTitle: "Geogaddi", ArtistID: artist.ID}) + arrived, err := q.UpsertAlbum(ctx, dbq.UpsertAlbumParams{Title: "Geomantic", SortTitle: "Geomantic", ArtistID: artist.ID}) if err != nil { t.Fatal(err) } if _, err := q.UpsertTrack(ctx, dbq.UpsertTrackParams{ - Title: "Music Is Math", AlbumID: arrived.ID, ArtistID: artist.ID, + Title: "Music Is Maps", AlbumID: arrived.ID, ArtistID: artist.ID, DurationMs: 1000, FilePath: filepath.Join(dir, "b.mp3"), FileSize: 100, FileFormat: "mp3", }); err != nil { t.Fatal(err) @@ -82,9 +82,9 @@ func TestAnnounceNewAlbums_TellsEveryoneOfEachNewAlbumOnce(t *testing.T) { for _, u := range []dbq.User{admin, listener} { got := newMusicNotices(t, q, u) if len(got) != 1 || got[0].Count != 1 || len(got[0].Albums) != 1 || - got[0].Albums[0].Title != "Geogaddi" || got[0].Albums[0].AlbumID != arrived.ID.String() || + got[0].Albums[0].Title != "Geomantic" || got[0].Albums[0].AlbumID != arrived.ID.String() || got[0].Albums[0].Artist != "Delete Test Artist" { - t.Fatalf("%s's notices = %+v, want one naming Geogaddi alone", u.Username, got) + t.Fatalf("%s's notices = %+v, want one naming Geomantic alone", u.Username, got) } } diff --git a/internal/library/scanner_test.go b/internal/library/scanner_test.go index af798052..783dbc3b 100644 --- a/internal/library/scanner_test.go +++ b/internal/library/scanner_test.go @@ -388,7 +388,7 @@ func TestScanner_ReleaseGroupMBID_Integration(t *testing.T) { } // Two albums of one name by one artist, in different release groups, are two -// albums, as Weezer's self-titled albums are. A +// albums, as Glasshouse's self-titled albums are. A // track of the same group joins its album, and a track filed under the other // album's row by the old lookup moves to its own on the tagReadVersion re-read. func TestScanner_SameTitledAlbumsOfTwoGroupsAreTwoAlbums_Integration(t *testing.T) { @@ -421,14 +421,14 @@ func TestScanner_SameTitledAlbumsOfTwoGroupsAreTwoAlbums_Integration(t *testing. tagged := func(rel, title, group string) string { p := filepath.Join(root, rel) writeTestMP3(t, p, map[string]string{ - "TIT2": title, "TPE1": "Weezer", "TALB": "Weezer", + "TIT2": title, "TPE1": "Glasshouse", "TALB": "Glasshouse", "TXXX": "MusicBrainz Release Group Id\x00" + group, }) return p } - tagged("Weezer (1994)/01.mp3", "My Name Is Jonas", blue) - tagged("Weezer (1994)/02.mp3", "No One Else", blue) - greenPath := tagged("Weezer (2001)/01.mp3", "Don't Let Go", green) + tagged("Glasshouse (1994)/01.mp3", "My Name Is Tobias", blue) + tagged("Glasshouse (1994)/02.mp3", "No One Near", blue) + greenPath := tagged("Glasshouse (2001)/01.mp3", "Don't Look Down", green) scanner := New(pool, logger, []string{root}, nil) if _, err := scanner.Scan(ctx, nil); err != nil { @@ -437,7 +437,7 @@ func TestScanner_SameTitledAlbumsOfTwoGroupsAreTwoAlbums_Integration(t *testing. albumsByGroup := func() map[string]int { t.Helper() rows, err := pool.Query(ctx, `SELECT a.release_group_mbid, count(t.id) FROM albums a - JOIN tracks t ON t.album_id = a.id WHERE a.title = 'Weezer' GROUP BY a.id, a.release_group_mbid`) + JOIN tracks t ON t.album_id = a.id WHERE a.title = 'Glasshouse' GROUP BY a.id, a.release_group_mbid`) if err != nil { t.Fatal(err) } @@ -462,8 +462,8 @@ func TestScanner_SameTitledAlbumsOfTwoGroupsAreTwoAlbums_Integration(t *testing. // A bonus track tagged with no release group joins the album its folder // holds, whichever row is older. - writeTestMP3(t, filepath.Join(root, "Weezer (2001)/02.mp3"), map[string]string{ - "TIT2": "Photograph (live)", "TPE1": "Weezer", "TALB": "Weezer", + writeTestMP3(t, filepath.Join(root, "Glasshouse (2001)/02.mp3"), map[string]string{ + "TIT2": "Polaroid (live)", "TPE1": "Glasshouse", "TALB": "Glasshouse", }) if _, err := scanner.Scan(ctx, nil); err != nil { t.Fatalf("scan the bonus track: %v", err) diff --git a/internal/library/song_link_test.go b/internal/library/song_link_test.go index f42581ca..0f9976e5 100644 --- a/internal/library/song_link_test.go +++ b/internal/library/song_link_test.go @@ -42,7 +42,7 @@ func newSongLinkFixture(t *testing.T, pool *pgxpool.Pool) songLinkFixture { t.Fatal(err) } tr, err := q.UpsertTrack(ctx, dbq.UpsertTrackParams{ - Title: "Feel Good Inc.", AlbumID: a.ID, ArtistID: artist.ID, + Title: "Feel Fine Ltd.", AlbumID: a.ID, ArtistID: artist.ID, DurationMs: 1000, FilePath: path, FileSize: 100, FileFormat: "mp3", }) if err != nil { @@ -51,8 +51,8 @@ func newSongLinkFixture(t *testing.T, pool *pgxpool.Pool) songLinkFixture { return tr } f := songLinkFixture{ - single: track("Feel Good Inc. (single)", "/music/Link Artist/Feel Good Inc/01 Feel Good Inc.mp3"), - albumCut: track("Demon Days", "/music/Link Artist/Demon Days/06 Feel Good Inc.mp3"), + single: track("Feel Fine Ltd. (single)", "/music/Link Artist/Feel Fine Ltd/01 Feel Fine Ltd.mp3"), + albumCut: track("Ghost Nights", "/music/Link Artist/Ghost Nights/06 Feel Fine Ltd.mp3"), } f.user, err = q.CreateUser(ctx, dbq.CreateUserParams{ Username: dbtest.TestUserPrefix + "song-link", PasswordHash: "x", ApiTokenHash: "song-link-token", @@ -221,7 +221,7 @@ func songKeys(t *testing.T, q *dbq.Queries, ids ...pgtype.UUID) []pgtype.UUID { return out } -// A cross-release group whose album holds the song twice (Humanz: Saturnz +// A cross-release group whose album holds the song twice (Mammalz: Neptunez // Barz as a FLAC and a YouTube mp3, beside the single): the album's // extra copy is merged into its FLAC, the single stays, and the two copies // left are linked as one song. @@ -230,7 +230,7 @@ func TestResolveDuplicates_FoldsAnAlbumsExtraCopyInACrossReleaseGroup_Integratio ctx := context.Background() q := dbq.New(pool) dir := t.TempDir() - artist, err := q.UpsertArtist(ctx, dbq.UpsertArtistParams{Name: "Gorillaz", SortName: "Gorillaz"}) + artist, err := q.UpsertArtist(ctx, dbq.UpsertArtistParams{Name: "Plastic Apes", SortName: "Plastic Apes"}) if err != nil { t.Fatal(err) } @@ -254,7 +254,7 @@ func TestResolveDuplicates_FoldsAnAlbumsExtraCopyInACrossReleaseGroup_Integratio t.Fatal(err) } tr, err := q.UpsertTrack(ctx, dbq.UpsertTrackParams{ - Title: "Saturnz Barz", AlbumID: a.ID, ArtistID: artist.ID, + Title: "Neptunez Barz", AlbumID: a.ID, ArtistID: artist.ID, DurationMs: 181000, FilePath: path, FileSize: 100, FileFormat: format, }) if err != nil { @@ -262,12 +262,12 @@ func TestResolveDuplicates_FoldsAnAlbumsExtraCopyInACrossReleaseGroup_Integratio } return tr } - flac := track("Humanz", "04 Saturnz Barz.flac", "flac") - mp3 := track("Humanz", "06 Saturnz Barz (feat. Popcaan).mp3", "mp3") - single := track("Saturnz Barz", "01 Saturnz Barz.mp3", "mp3") + flac := track("Mammalz", "04 Neptunez Barz.flac", "flac") + mp3 := track("Mammalz", "06 Neptunez Barz (feat. Popcaan).mp3", "mp3") + single := track("Neptunez Barz", "01 Neptunez Barz.mp3", "mp3") var groupID pgtype.UUID if err := pool.QueryRow(ctx, - `INSERT INTO duplicate_groups (member_key, tier) VALUES ('humanz-saturnz', 'exact') RETURNING id`, + `INSERT INTO duplicate_groups (member_key, tier) VALUES ('mammalz-neptunez', 'exact') RETURNING id`, ).Scan(&groupID); err != nil { t.Fatal(err) } diff --git a/internal/library/source_markers_test.go b/internal/library/source_markers_test.go index 6eb5086d..b4456c29 100644 --- a/internal/library/source_markers_test.go +++ b/internal/library/source_markers_test.go @@ -13,24 +13,24 @@ func TestSourceMarkersFor(t *testing.T) { base string want []string }{ - {"Daft Punk - Random Access Memories - 06 - Daft Punk - Doin' It Right (Music Video) ft. Panda Bear.mp3", []string{"music video"}}, - {"Gorillaz - Humanz - 03 - Gorillaz - Saturnz Barz (Official Video).mp3", []string{"music video"}}, - {"Gorillaz - Humanz - 05 - Gorillaz - Andromeda (Official Audio).mp3", []string{"official audio"}}, - {"Gorillaz - Gorillaz - 06 - Gorillaz - P45 (Visualizer).mp3", []string{"visualiser"}}, - {"Gorillaz - Demon Days - 16 - Gorillaz - Don Quixote's Christmas Bonanza (Visualiser).mp3", []string{"visualiser"}}, + {"Deft Monks - Random Access Dreams - 06 - Deft Monks - Doin' It Twice (Music Video) ft. Koala Bear.mp3", []string{"music video"}}, + {"Plastic Apes - Mammalz - 03 - Plastic Apes - Neptunez Barz (Official Video).mp3", []string{"music video"}}, + {"Plastic Apes - Mammalz - 05 - Plastic Apes - Cassiopeia (Official Audio).mp3", []string{"official audio"}}, + {"Plastic Apes - Plastic Apes - 06 - Plastic Apes - Q46 (Visualizer).mp3", []string{"visualiser"}}, + {"Plastic Apes - Ghost Nights - 16 - Plastic Apes - Sancho's Holiday Bonanza (Visualiser).mp3", []string{"visualiser"}}, {"Artist - Album - 01 - Artist - Song (Lyric Video).mp3", []string{"lyric video"}}, - {"Gorillaz - Humanz - 02 - FIRST TIME HEARING Gorillaz - Ascension REACTION.mp3", []string{"reaction"}}, + {"Plastic Apes - Mammalz - 02 - FIRST TIME HEARING Plastic Apes - Elevation REACTION.mp3", []string{"reaction"}}, {"Watsky - INTENTION - 05 - MANIAC Reacts to Watsky - AWW SHiT.mp3", []string{"reaction"}}, {"米津玄師 - diorama - 09 - 【MV】米津玄師 - 恋と病熱.mp3", []string{"MV"}}, {"Andora - Ego - 01 - Andora - Ego (feat. Will Stetson) MV.mp3", []string{"MV"}}, {"Jimmy Eat World - Something(s) Loud - 05 - Jimmy Eat World - Call to Love (Audio).mp3", []string{"[Audio]"}}, {"Record Heat - World War IV - 03 - Record Heat - Front Seat Feelin' [Audio].mp3", []string{"[Audio]"}}, - {"Aphex Twin - Come To Daddy - 03 - Aphex Twin - Bucephalus Bouncing Ball (HQ).mp3", []string{"[HD]"}}, + {"Apex Sibling - Come To Mother - 03 - Apex Sibling - Pegasus Bouncing Ball (HQ).mp3", []string{"[HD]"}}, {"Artist - Album - 01 - Artist - Song (Official Lyric Video) [4K].mp3", []string{"lyric video", "[HD]"}}, {"Beck - Guero - 15 - Beck - Chain Reaction.mp3", nil}, - {"Nirvana - MTV Unplugged in New York - 01 - About a Girl (live in New York).flac", nil}, - {"Boards of Canada - Music Has the Right to Children - 05 - Roygbiv.flac", nil}, + {"Kettle Saints - Unplugged in Old York - 01 - About a Ghost (live in New York).flac", nil}, + {"Fields of Ontario - Music Has the Right to Wander - 05 - Prismatic.flac", nil}, {"Artist - Album - 01 - Mvula.flac", nil}, } for _, c := range cases { diff --git a/internal/mailer/mailer.go b/internal/mailer/mailer.go index 43c782ae..592744db 100644 --- a/internal/mailer/mailer.go +++ b/internal/mailer/mailer.go @@ -175,7 +175,7 @@ func composeMessage(cfg dbq.SmtpConfig, to, subject, textBody, htmlBody string) // encodeSubject makes subject safe as a header value. Line breaks are // replaced, so a name carried into a subject cannot start a header of its -// own, and non-ASCII text ("Moe Shop – WWW") is RFC 2047 encoded, which +// own, and non-ASCII text ("Mochi Shop – XYZ") is RFC 2047 encoded, which // mime.QEncoding leaves alone when there is nothing to encode. func encodeSubject(subject string) string { subject = strings.NewReplacer("\r\n", " ", "\r", " ", "\n", " ").Replace(subject) diff --git a/internal/mailer/subject_test.go b/internal/mailer/subject_test.go index b3cc2fb7..a48f599e 100644 --- a/internal/mailer/subject_test.go +++ b/internal/mailer/subject_test.go @@ -11,11 +11,11 @@ func TestEncodeSubject(t *testing.T) { t.Errorf("plain ASCII changed: %q", got) } - enc := encodeSubject("Minstrel: Moe Shop – WWW") + enc := encodeSubject("Minstrel: Mochi Shop – XYZ") if !strings.HasPrefix(enc, "=?utf-8?q?") { t.Errorf("non-ASCII not RFC 2047 encoded: %q", enc) } - if dec, err := new(mime.WordDecoder).DecodeHeader(enc); err != nil || dec != "Minstrel: Moe Shop – WWW" { + if dec, err := new(mime.WordDecoder).DecodeHeader(enc); err != nil || dec != "Minstrel: Mochi Shop – XYZ" { t.Errorf("round trip = %q, %v", dec, err) } diff --git a/internal/musicbrainz/client.go b/internal/musicbrainz/client.go index 86721968..e1e53ad2 100644 --- a/internal/musicbrainz/client.go +++ b/internal/musicbrainz/client.go @@ -178,7 +178,7 @@ func sleep(ctx context.Context, d time.Duration) error { const luceneSpecial = `+-&|!(){}[]^"~*?:\/` // Escape makes text typed by a person safe to put in a search query, so -// "AC/DC" or "Sunn O)))" searches for what was typed rather than failing to +// "AM/FM" or "Moon O)))" searches for what was typed rather than failing to // parse. func Escape(s string) string { var b strings.Builder diff --git a/internal/musicbrainz/client_test.go b/internal/musicbrainz/client_test.go index ded2815f..3c0938fe 100644 --- a/internal/musicbrainz/client_test.go +++ b/internal/musicbrainz/client_test.go @@ -19,10 +19,10 @@ func testClient(srv *httptest.Server) *Client { func TestEscape_KeepsWhatWasTyped(t *testing.T) { for in, want := range map[string]string{ - "Radiohead": "Radiohead", - "AC/DC": `AC\/DC`, - "Sunn O)))": `Sunn O\)\)\)`, - `"Weird" Al`: `\"Weird\" Al`, + "Signal Tower": "Signal Tower", + "AM/FM": `AM\/FM`, + "Moon O)))": `Moon O\)\)\)`, + `"Odd" Al`: `\"Odd\" Al`, } { if got := Escape(in); got != want { t.Errorf("Escape(%q) = %q, want %q", in, got, want) @@ -36,24 +36,24 @@ func TestSearchReleaseGroups_AsksTitleAndArtistAndReadsCredits(t *testing.T) { query.Store(r.URL.Query().Get("query")) agent.Store(r.Header.Get("User-Agent")) _, _ = w.Write([]byte(`{"release-groups": [{ - "id": "rg1", "title": "OK Computer", "primary-type": "Album", "secondary-types": [], + "id": "rg1", "title": "OK Calculator", "primary-type": "Album", "secondary-types": [], "first-release-date": "1997-05-21", - "artist-credit": [{"name": "Radiohead", "joinphrase": "", "artist": {"id": "a1", "name": "Radiohead"}}] + "artist-credit": [{"name": "Signal Tower", "joinphrase": "", "artist": {"id": "a1", "name": "Signal Tower"}}] }]}`)) })) defer srv.Close() - got, err := testClient(srv).SearchReleaseGroups(context.Background(), "ok computer", 10) + got, err := testClient(srv).SearchReleaseGroups(context.Background(), "ok calculator", 10) if err != nil { t.Fatal(err) } - if q := query.Load(); q != "releasegroup:(ok computer) OR artist:(ok computer)" { + if q := query.Load(); q != "releasegroup:(ok calculator) OR artist:(ok calculator)" { t.Errorf("query = %q", q) } if agent.Load() != UserAgent { t.Errorf("User-Agent = %q", agent.Load()) } - if len(got) != 1 || got[0].MBID != "rg1" || got[0].Year() != "1997" || got[0].ArtistCredit != "Radiohead" || got[0].ArtistMBIDs[0] != "a1" { + if len(got) != 1 || got[0].MBID != "rg1" || got[0].Year() != "1997" || got[0].ArtistCredit != "Signal Tower" || got[0].ArtistMBIDs[0] != "a1" { t.Errorf("got %+v", got) } } @@ -62,16 +62,16 @@ func TestSearchReleaseGroupsBy_AsksForBothTitleAndArtist(t *testing.T) { var query atomic.Value srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { query.Store(r.URL.Query().Get("query")) - _, _ = w.Write([]byte(`{"release-groups": [{"id": "rg1", "title": "Highway to Hell", - "artist-credit": [{"name": "AC/DC", "artist": {"id": "a1"}}]}]}`)) + _, _ = w.Write([]byte(`{"release-groups": [{"id": "rg1", "title": "Highway to Nowhere", + "artist-credit": [{"name": "AM/FM", "artist": {"id": "a1"}}]}]}`)) })) defer srv.Close() - got, err := testClient(srv).SearchReleaseGroupsBy(context.Background(), " AC/DC ", "Highway to Hell", 10) + got, err := testClient(srv).SearchReleaseGroupsBy(context.Background(), " AM/FM ", "Highway to Nowhere", 10) if err != nil { t.Fatal(err) } - if q := query.Load(); q != `releasegroup:(Highway to Hell) AND artist:(AC\/DC)` { + if q := query.Load(); q != `releasegroup:(Highway to Nowhere) AND artist:(AM\/FM)` { t.Errorf("query = %q", q) } if len(got) != 1 || got[0].MBID != "rg1" || got[0].ArtistMBIDs[0] != "a1" { @@ -82,17 +82,17 @@ func TestSearchReleaseGroupsBy_AsksForBothTitleAndArtist(t *testing.T) { func TestSearchRecordings_FilesASongUnderItsAlbum(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, _ = w.Write([]byte(`{"recordings": [{ - "id": "rec1", "title": "Karma Police", "length": 264000, - "artist-credit": [{"name": "Radiohead", "artist": {"id": "a1"}}], + "id": "rec1", "title": "Karma Patrol", "length": 264000, + "artist-credit": [{"name": "Signal Tower", "artist": {"id": "a1"}}], "releases": [ {"id": "r1", "status": "Official", "release-group": {"id": "rg-live", "title": "Live", "primary-type": "Album", "secondary-types": ["Live"]}}, - {"id": "r2", "status": "Official", "release-group": {"id": "rg1", "title": "OK Computer", "primary-type": "Album"}} + {"id": "r2", "status": "Official", "release-group": {"id": "rg1", "title": "OK Calculator", "primary-type": "Album"}} ] }]}`)) })) defer srv.Close() - got, err := testClient(srv).SearchRecordings(context.Background(), "karma police", 5) + got, err := testClient(srv).SearchRecordings(context.Background(), "karma patrol", 5) if err != nil { t.Fatal(err) } @@ -136,11 +136,11 @@ func TestReleaseGroupReleases_ReadsMediaAndTracks(t *testing.T) { t.Errorf("inc = %q", r.URL.Query().Get("inc")) } _, _ = w.Write([]byte(`{"release-count": 1, "releases": [{ - "id": "r1", "title": "OK Computer", "status": "Official", "date": "1997-06-16", "country": "GB", + "id": "r1", "title": "OK Calculator", "status": "Official", "date": "1997-06-16", "country": "GB", "media": [ {"position": 1, "format": "CD", "tracks": [ - {"position": 1, "number": "1", "title": "Airbag", "length": 284000, "recording": {"id": "rec-a"}}, - {"position": 2, "number": "2", "title": "Paranoid Android", "length": null, "recording": {"id": "rec-b", "length": 383000}} + {"position": 1, "number": "1", "title": "Lifebelt", "length": 284000, "recording": {"id": "rec-a"}}, + {"position": 2, "number": "2", "title": "Anxious Robot", "length": null, "recording": {"id": "rec-b", "length": 383000}} ]}, {"position": 2, "format": "CD", "tracks": []} ] @@ -171,11 +171,11 @@ func TestGet_ThrottleIsRetriedThenUnreachable(t *testing.T) { w.WriteHeader(http.StatusServiceUnavailable) return } - _, _ = w.Write([]byte(`{"artists": [{"id": "a1", "name": "Radiohead"}]}`)) + _, _ = w.Write([]byte(`{"artists": [{"id": "a1", "name": "Signal Tower"}]}`)) })) defer srv.Close() - got, err := testClient(srv).SearchArtists(context.Background(), "radiohead", 5) + got, err := testClient(srv).SearchArtists(context.Background(), "signal tower", 5) if err != nil || len(got) != 1 || calls.Load() != 2 { t.Fatalf("a throttled first answer should be retried: %v, %+v, %d calls", err, got, calls.Load()) } diff --git a/internal/musicbrainz/entities.go b/internal/musicbrainz/entities.go index b7acd786..7cffd525 100644 --- a/internal/musicbrainz/entities.go +++ b/internal/musicbrainz/entities.go @@ -235,8 +235,8 @@ func (c *Client) SearchArtists(ctx context.Context, text string, limit int) ([]A return out, nil } -// SearchReleaseGroups finds albums by title or by artist, so "radiohead ok -// computer" and "ok computer" both find OK Computer. +// SearchReleaseGroups finds albums by title or by artist, so "signal tower ok +// computer" and "ok calculator" both find OK Calculator. func (c *Client) SearchReleaseGroups(ctx context.Context, text string, limit int) ([]ReleaseGroup, error) { var resp struct { ReleaseGroups []wireReleaseGroup `json:"release-groups"` diff --git a/internal/notifications/digest_db_test.go b/internal/notifications/digest_db_test.go index d1749e7f..9b9cfc89 100644 --- a/internal/notifications/digest_db_test.go +++ b/internal/notifications/digest_db_test.go @@ -38,9 +38,9 @@ func TestDigest_BatchGoesOutOnceAWindowAfterTheFirstItem(t *testing.T) { start := time.Now() require.NoError(t, n.Notify(ctx, notifications.KindQuarantineFlagged, notifications.ToUser(alice), - notifications.Payload{Name: "Moe Shop – WWW"}.Map())) + notifications.Payload{Name: "Mochi Shop – XYZ"}.Map())) require.NoError(t, n.Notify(ctx, notifications.KindQuarantineFlagged, notifications.ToUser(alice), - notifications.Payload{Name: "Tycho – Awake", Reason: "already have it"}.Map())) + notifications.Payload{Name: "Tacho – Asleep", Reason: "already have it"}.Map())) d.Tick(ctx, start.Add(30*time.Minute)) require.Empty(t, fake.Sent, "inside the window nothing goes") @@ -49,8 +49,8 @@ func TestDigest_BatchGoesOutOnceAWindowAfterTheFirstItem(t *testing.T) { require.Len(t, fake.Sent, 1, "both items, one email") require.Equal(t, "alice@example.com", fake.Sent[0].To) require.Equal(t, "Minstrel: 2 updates", fake.Sent[0].Subject) - require.Contains(t, fake.Sent[0].TextBody, "Someone flagged Moe Shop – WWW.") - require.Contains(t, fake.Sent[0].TextBody, "Someone flagged Tycho – Awake: already have it") + require.Contains(t, fake.Sent[0].TextBody, "Someone flagged Mochi Shop – XYZ.") + require.Contains(t, fake.Sent[0].TextBody, "Someone flagged Tacho – Asleep: already have it") d.Tick(ctx, start.Add(3*time.Hour)) require.Len(t, fake.Sent, 1, "never sent twice") @@ -171,8 +171,8 @@ func TestDigest_NewMusicWaitsForTheSummaryHour(t *testing.T) { } for _, a := range []notifications.Arrival{ - {Artist: "Moe Shop", Title: "WWW"}, - {Artist: "Moe Shop", Title: "Pure"}, + {Artist: "Mochi Shop", Title: "XYZ"}, + {Artist: "Mochi Shop", Title: "Pure"}, } { p := notifications.Payload{Count: 1, Albums: []notifications.Arrival{a}} require.NoError(t, n.Notify(ctx, notifications.KindNewMusic, notifications.ToUser(alice), p.Map())) @@ -184,7 +184,7 @@ func TestDigest_NewMusicWaitsForTheSummaryHour(t *testing.T) { d.Tick(ctx, slot) require.Len(t, fake.Sent, 1) require.Equal(t, "Minstrel: new music in your library", fake.Sent[0].Subject) - require.Contains(t, fake.Sent[0].TextBody, "Moe Shop\n - WWW") + require.Contains(t, fake.Sent[0].TextBody, "Mochi Shop\n - XYZ") require.Contains(t, fake.Sent[0].TextBody, " - Pure") d.Tick(ctx, slot.Add(5*time.Hour)) diff --git a/internal/notifications/digest_test.go b/internal/notifications/digest_test.go index c355247e..35bac7e1 100644 --- a/internal/notifications/digest_test.go +++ b/internal/notifications/digest_test.go @@ -137,22 +137,22 @@ func TestRenderDigest_SummaryGroupsByArtist(t *testing.T) { return pendingItem{Kind: KindNewMusic, Payload: b} } items := []pendingItem{ - scan(Arrival{Artist: "Moe Shop", Title: "WWW", ArtistID: "ar-1", AlbumID: "al-1"}, - Arrival{Artist: "Boards of Canada", Title: "Geogaddi", AlbumID: "al-2"}), - scan(Arrival{Artist: "Moe Shop", Title: "Pure", ArtistID: "ar-1", AlbumID: "al-3"}), + scan(Arrival{Artist: "Mochi Shop", Title: "XYZ", ArtistID: "ar-1", AlbumID: "al-1"}, + Arrival{Artist: "Fields of Ontario", Title: "Geomantic", AlbumID: "al-2"}), + scan(Arrival{Artist: "Mochi Shop", Title: "Pure", ArtistID: "ar-1", AlbumID: "al-3"}), } e, err := renderDigest(EmailSummary, "alice", items, "https://music.example/") require.NoError(t, err) require.Equal(t, "Minstrel: new music in your library", e.Subject) - moe := strings.Index(e.Text, "Moe Shop") + moe := strings.Index(e.Text, "Mochi Shop") require.GreaterOrEqual(t, moe, 0) - require.Equal(t, moe, strings.LastIndex(e.Text, "Moe Shop\n"), "one heading per artist, across scans") - require.Less(t, moe, strings.Index(e.Text, "Boards of Canada"), "artists in the order they arrived") - require.Contains(t, e.Text, "Moe Shop\n https://music.example/artists/ar-1") - require.Contains(t, e.Text, " - WWW\n https://music.example/albums/al-1") + require.Equal(t, moe, strings.LastIndex(e.Text, "Mochi Shop\n"), "one heading per artist, across scans") + require.Less(t, moe, strings.Index(e.Text, "Fields of Ontario"), "artists in the order they arrived") + require.Contains(t, e.Text, "Mochi Shop\n https://music.example/artists/ar-1") + require.Contains(t, e.Text, " - XYZ\n https://music.example/albums/al-1") require.Contains(t, e.Text, " - Pure\n https://music.example/albums/al-3") - require.Contains(t, e.Text, " - Geogaddi\n https://music.example/albums/al-2") + require.Contains(t, e.Text, " - Geomantic\n https://music.example/albums/al-2") require.Contains(t, e.Text, "https://music.example/settings/notifications") require.Contains(t, e.HTML, `x", Reason: "dup"}.Map()) items := []pendingItem{ - {Kind: KindQuarantineFlagged, Payload: []byte(`{"name":"WWW","actor":"Ann"}`)}, + {Kind: KindQuarantineFlagged, Payload: []byte(`{"name":"XYZ","actor":"Ann"}`)}, {Kind: KindQuarantineFlagged, Payload: b}, } e, err := renderDigest(EmailBatch, "alice", items, "") require.NoError(t, err) require.Equal(t, "Minstrel: 2 updates", e.Subject) - require.Contains(t, e.Text, "- Track flagged\n Ann flagged WWW.") + require.Contains(t, e.Text, "- Track flagged\n Ann flagged XYZ.") require.NotContains(t, e.Text, "http", "no public address: no links") require.Contains(t, e.Text, "Settings → Notifications") require.NotContains(t, e.HTML, "