A decentralized music tracking and discovery platform built on AT Protocol 🎵

Match multiple comma-separated scrobble artists

+27 -2
+12 -1
crates/scrobbler/src/scrobbler.rs
··· 400 400 .to_lowercase(); 401 401 402 402 // check if artists don't contain the scrobble artist (to avoid wrong matches) 403 - if !artists.contains(&scrobble.artist.to_lowercase()) { 403 + // scrobble artist can contain multiple artists separated by ", " 404 + let scrobble_artists: Vec<String> = scrobble 405 + .artist 406 + .split(", ") 407 + .map(|a| a.trim().to_lowercase()) 408 + .collect(); 409 + 410 + let has_artist_match = scrobble_artists 411 + .iter() 412 + .any(|scrobble_artist| artists.contains(scrobble_artist)); 413 + 414 + if !has_artist_match { 404 415 tracing::warn!(artist = %artist, track = ?track, "Artist mismatch, skipping"); 405 416 } else { 406 417 tracing::info!(artist = %scrobble.artist, track = %scrobble.track, "Spotify (track)");
+15 -1
crates/webscrobbler/src/scrobbler.rs
··· 149 149 .to_lowercase(); 150 150 let artist = scrobble.data.song.parsed.artist.trim(); 151 151 // check if artists don't contain the scrobble artist (to avoid wrong matches) 152 - if !artists.contains(&scrobble.data.song.parsed.artist.trim().to_lowercase()) { 152 + // scrobble artist can contain multiple artists separated by ", " 153 + let scrobble_artists: Vec<String> = scrobble 154 + .data 155 + .song 156 + .parsed 157 + .artist 158 + .split(", ") 159 + .map(|a| a.trim().to_lowercase()) 160 + .collect(); 161 + 162 + let has_artist_match = scrobble_artists 163 + .iter() 164 + .any(|scrobble_artist| artists.contains(scrobble_artist)); 165 + 166 + if !has_artist_match { 153 167 tracing::warn!(artist = %artist, track = ?track, "Artist mismatch, skipping"); 154 168 } else { 155 169 tracing::info!("Spotify (track)");