test: invented artists, albums and MusicBrainz ids in place of real ones
release / web (push) Failing after 1m16s
release / go (push) Successful in 1m48s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m0s
release / android (push) Successful in 4m34s
release / Build signed APK (push) Successful in 5m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
release / web (push) Failing after 1m16s
release / go (push) Successful in 1m48s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m0s
release / android (push) Successful in 4m34s
release / Build signed APK (push) Successful in 5m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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".
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user