removed secondary artists
This commit is contained in:
@@ -313,7 +313,6 @@ impl MetadataFetcher for LocalMusicBrainzFetcher {
|
||||
.unwrap_or_else(|| "Unknown Artist".into()),
|
||||
releases: vec![],
|
||||
genres: vec![],
|
||||
secondary_artists: vec![],
|
||||
})
|
||||
},
|
||||
);
|
||||
|
||||
@@ -251,7 +251,6 @@ impl MetadataFetcher for MusicBrainzFetcher {
|
||||
let r: MbRecordingDetail = self.get_json(&url).await?;
|
||||
|
||||
let (artist_name, artist_mbid) = extract_artist_credit(&r.artist_credit);
|
||||
let secondary_artists = extract_secondary_artists(&r.artist_credit);
|
||||
Ok(RecordingDetails {
|
||||
mbid: r.id,
|
||||
title: r.title,
|
||||
@@ -275,7 +274,6 @@ impl MetadataFetcher for MusicBrainzFetcher {
|
||||
.into_iter()
|
||||
.map(|g| g.name)
|
||||
.collect(),
|
||||
secondary_artists,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -388,32 +386,6 @@ fn extract_artist_credit(credits: &Option<Vec<MbArtistCredit>>) -> (String, Opti
|
||||
}
|
||||
}
|
||||
|
||||
/// Extract non-featuring secondary artists from MusicBrainz artist credits.
|
||||
/// Returns (name, mbid) pairs for collaborators that aren't "featuring" credits.
|
||||
fn extract_secondary_artists(credits: &Option<Vec<MbArtistCredit>>) -> Vec<(String, String)> {
|
||||
let Some(credits) = credits else {
|
||||
return vec![];
|
||||
};
|
||||
if credits.len() <= 1 {
|
||||
return vec![];
|
||||
}
|
||||
|
||||
// Walk credits after the first. Stop at any "feat"/"ft." joinphrase
|
||||
// from the PREVIOUS credit (since joinphrase is on the credit BEFORE the next artist).
|
||||
let mut result = Vec::new();
|
||||
for i in 0..credits.len() - 1 {
|
||||
let jp = credits[i].joinphrase.as_deref().unwrap_or("");
|
||||
let lower = jp.to_lowercase();
|
||||
if lower.contains("feat") || lower.contains("ft.") {
|
||||
break;
|
||||
}
|
||||
// The next credit is a non-featuring collaborator
|
||||
let next = &credits[i + 1];
|
||||
result.push((next.artist.name.clone(), next.artist.id.clone()));
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
// --- MusicBrainz API response types ---
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -513,7 +485,6 @@ struct MbRecordingDetail {
|
||||
#[derive(Deserialize)]
|
||||
struct MbArtistCredit {
|
||||
artist: MbArtist,
|
||||
joinphrase: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
||||
@@ -43,9 +43,6 @@ pub struct RecordingDetails {
|
||||
pub releases: Vec<ReleaseRef>,
|
||||
pub duration_ms: Option<u64>,
|
||||
pub genres: Vec<String>,
|
||||
/// Non-featuring collaborators beyond the primary artist.
|
||||
#[serde(default)]
|
||||
pub secondary_artists: Vec<(String, String)>,
|
||||
}
|
||||
|
||||
/// Detailed artist info from a direct MBID lookup.
|
||||
|
||||
+1
-1
Submodule shanty-db updated: 1f983bbecf...e76b2fc575
+1
-1
Submodule shanty-tag updated: 884b2e8d52...65c229ee7f
Reference in New Issue
Block a user