tangled
alpha
login
or
join now
t1c.dev
/
rocksky
forked from
rocksky.app/rocksky
2
fork
atom
A decentralized music tracking and discovery platform built on AT Protocol 🎵
2
fork
atom
overview
issues
pulls
pipelines
Match multiple comma-separated scrobble artists
tsiry-sandratraina.com
1 month ago
95a181ac
f04a74ad
+27
-2
2 changed files
expand all
collapse all
unified
split
crates
scrobbler
src
scrobbler.rs
webscrobbler
src
scrobbler.rs
+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
403
-
if !artists.contains(&scrobble.artist.to_lowercase()) {
403
403
+
// scrobble artist can contain multiple artists separated by ", "
404
404
+
let scrobble_artists: Vec<String> = scrobble
405
405
+
.artist
406
406
+
.split(", ")
407
407
+
.map(|a| a.trim().to_lowercase())
408
408
+
.collect();
409
409
+
410
410
+
let has_artist_match = scrobble_artists
411
411
+
.iter()
412
412
+
.any(|scrobble_artist| artists.contains(scrobble_artist));
413
413
+
414
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
152
-
if !artists.contains(&scrobble.data.song.parsed.artist.trim().to_lowercase()) {
152
152
+
// scrobble artist can contain multiple artists separated by ", "
153
153
+
let scrobble_artists: Vec<String> = scrobble
154
154
+
.data
155
155
+
.song
156
156
+
.parsed
157
157
+
.artist
158
158
+
.split(", ")
159
159
+
.map(|a| a.trim().to_lowercase())
160
160
+
.collect();
161
161
+
162
162
+
let has_artist_match = scrobble_artists
163
163
+
.iter()
164
164
+
.any(|scrobble_artist| artists.contains(scrobble_artist));
165
165
+
166
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)");