Skip to content

Commit ecb519b

Browse files
unhappychoiceclaude
andcommitted
feat(fetcher): add lastfm_top_albums
Third user-stats sibling: a user's top albums for a rolling window via `user.getTopAlbums`. Same option contract (`user` / `period` / `limit`) and same 10 shapes via the shared `lastfm/top.rs` surface. Row mapping mirrors `lastfm_top_tracks` exactly — both endpoints return `{name, playcount, artist: {name}, url, image, @attr: {rank}}` rows, just under a different envelope key (`topalbums.album` vs `toptracks.track`). Album titles surface as `"Album — Artist"` via the shared secondary-label rendering. Album artwork via the `image` array is the only practical difference at the user-facing level: `ImageLinkedList` rows show the actual cover art because Last.fm consistently populates `image` for albums (unlike tracks where the array is often only the placeholder). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 407e13b commit ecb519b

2 files changed

Lines changed: 443 additions & 0 deletions

File tree

‎src/fetcher/lastfm/mod.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ mod client;
1313
mod common;
1414
mod scrobbles_today;
1515
mod top;
16+
mod top_albums;
1617
mod top_artists;
1718
mod top_tracks;
1819

@@ -25,6 +26,7 @@ pub fn fetchers() -> Vec<Arc<dyn Fetcher>> {
2526
Arc::new(scrobbles_today::LastfmScrobblesToday),
2627
Arc::new(top_artists::LastfmTopArtists),
2728
Arc::new(top_tracks::LastfmTopTracks),
29+
Arc::new(top_albums::LastfmTopAlbums),
2830
]
2931
}
3032

@@ -44,5 +46,6 @@ mod tests {
4446
assert!(names.contains(&"lastfm_scrobbles_today".to_string()));
4547
assert!(names.contains(&"lastfm_top_artists".to_string()));
4648
assert!(names.contains(&"lastfm_top_tracks".to_string()));
49+
assert!(names.contains(&"lastfm_top_albums".to_string()));
4750
}
4851
}

0 commit comments

Comments
 (0)