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
[scrobbler] correctly add album year
tsiry-sandratraina.com
11 months ago
bc2aab98
1c4c2634
+10
-1
1 changed file
expand all
collapse all
unified
split
crates
scrobbler
src
scrobbler.rs
+10
-1
crates/scrobbler/src/scrobbler.rs
···
145
145
let album = repo::album::get_album_by_track_id(pool, &track.xata_id).await?;
146
146
let artist = repo::artist::get_artist_by_track_id(pool, &track.xata_id).await?;
147
147
let mut track: Track = track.into();
148
148
-
track.year = album.year.map(|x| x as u32);
148
148
+
track.year = match album.year {
149
149
+
Some(year) => Some(year as u32),
150
150
+
None => match album.release_date.clone() {
151
151
+
Some(release_date) => {
152
152
+
let year = release_date.split("-").next();
153
153
+
year.and_then(|x| x.parse::<u32>().ok())
154
154
+
}
155
155
+
None => None,
156
156
+
},
157
157
+
};
149
158
track.release_date = album.release_date.map(|x| x.split("T").next().unwrap().to_string());
150
159
track.artist_picture = artist.picture.clone();
151
160