fixed up the featured artist thing
CI / check (push) Failing after 1m9s
CI / docker (push) Has been skipped

This commit is contained in:
Connor Johnstone
2026-03-24 11:38:08 -04:00
parent 314400bde5
commit 026d1f446b
10 changed files with 28 additions and 17 deletions
+17 -10
View File
@@ -345,7 +345,7 @@ impl MetadataFetcher for MusicBrainzFetcher {
) -> DataResult<Vec<ReleaseGroupEntry>> {
// Fetch album, single, and EP release groups
let url = format!(
"{BASE_URL}/release-group?artist={artist_mbid}&type=album|single|ep&fmt=json&limit=100"
"{BASE_URL}/release-group?artist={artist_mbid}&type=album|single|ep&inc=artist-credits&fmt=json&limit=100"
);
let resp: MbReleaseGroupResponse = self.get_json(&url).await?;
@@ -353,15 +353,20 @@ impl MetadataFetcher for MusicBrainzFetcher {
.release_groups
.unwrap_or_default()
.into_iter()
.map(|rg| ReleaseGroupEntry {
mbid: rg.id,
title: rg.title,
primary_type: rg.primary_type,
secondary_types: rg.secondary_types.unwrap_or_default(),
first_release_date: rg.first_release_date,
first_release_mbid: rg
.releases
.and_then(|r| r.into_iter().next().map(|rel| rel.id)),
.map(|rg| {
let primary = extract_artist_credit(&rg.artist_credit);
let featured = primary.1.as_deref() != Some(artist_mbid);
ReleaseGroupEntry {
mbid: rg.id,
title: rg.title,
primary_type: rg.primary_type,
secondary_types: rg.secondary_types.unwrap_or_default(),
first_release_date: rg.first_release_date,
first_release_mbid: rg
.releases
.and_then(|r| r.into_iter().next().map(|rel| rel.id)),
featured,
}
})
.collect())
}
@@ -538,6 +543,8 @@ struct MbReleaseGroup {
#[serde(rename = "first-release-date")]
first_release_date: Option<String>,
releases: Option<Vec<MbReleaseGroupRelease>>,
#[serde(rename = "artist-credit")]
artist_credit: Option<Vec<MbArtistCredit>>,
}
#[derive(Deserialize)]