fix: use correct fields from AlbumSummary in musician appearances

AlbumSummary only has id, title, image, and label fields.
The code was incorrectly trying to access artist and
release_date_original which only exist on the full Album struct.

- Use track.performer for artist_name instead of album.artist
- Set year to None since AlbumSummary doesn't have release_date
- Fix image access since ImageSet is direct field, not Option
- Fix title access since String is direct field, not Option
This commit is contained in:
vicrodh committed 2026-01-25 22:18:15 -06:00
1 parent e9f67ed1cf
commit 74d2059b8a
1 file changed
+9 -12
+9 -12
View File
@@ -171,24 +171,21 @@ pub async fn get_musician_appearances(
albums.push(AlbumAppearance {
album_id: album.id.clone(),
album_title: album.title.clone().unwrap_or_default(),
album_title: album.title.clone(),
album_artwork: album
.image
.as_ref()
.and_then(|i| i.large.clone())
.or_else(|| album.image.as_ref().and_then(|i| i.thumbnail.clone()))
.large
.clone()
.or_else(|| album.image.thumbnail.clone())
.unwrap_or_default(),
// AlbumSummary doesn't have artist field, use track's performer
artist_name: track
.album
.performer
.as_ref()
.and_then(|a| a.artist.as_ref())
.map(|a| a.name.clone())
.map(|p| p.name.clone())
.unwrap_or_else(|| performer_name.to_string()),
year: album
.release_date_original
.as_ref()
.and_then(|d| d.split('-').next())
.map(|s| s.to_string()),
// AlbumSummary doesn't have release_date_original
year: None,
role_on_album: role,
});
}