Add "Top Songs" tab to artist detail page #47

Closed
opened 2026-03-25 15:34:54 -04:00 by connor · 0 comments
Owner

Description:

Problem

Currently, to watch individual songs by an artist, users must browse through all their albums and singles, find the track they want, and click Watch. For popular artists with dozens of releases, this is tedious. Most users just want to quickly see an artist's most
popular tracks, pick a few, and move on.

Proposed Solution

Add a "Top Songs" tab to the artist detail page that shows the artist's most popular tracks from Last.fm, paginated. This becomes the fastest way to selectively watch individual songs.

Requirements

Backend:

  • New endpoint GET /api/artists/{id}/top-songs?page=1&limit=25 that fetches top tracks from Last.fm via the existing SimilarArtistFetcher::get_top_tracks() (already implemented in shanty-data/src/lastfm.rs)
  • Cache results in search_cache with a reasonable TTL (7 days)
  • Response should include: track name, playcount, recording MBID (if available from Last.fm), and watch status (cross-referenced with wanted_items)
  • Requires SHANTY_LASTFM_API_KEY to be set — gracefully degrade if not configured (show message instead of tab)

Frontend:

  • New tab on the artist detail page alongside the album listing (e.g., "Top Songs" | "Albums" | "EPs" | "Singles")
  • Paginated table: rank, title, play count, status badge, Watch/Unwatch button
  • Default to first 25 tracks, with "Load More" or pagination controls
  • Watch button should call the existing POST /api/tracks/watch endpoint with the track title and artist name
  • If Last.fm API key is not configured, hide the tab entirely (check via existing YtAuthStatus.lastfm_api_key_set or add a field to status)

Existing code to reuse:

  • shanty-data/src/lastfm.rs — LastFmSimilarFetcher::get_top_tracks() already fetches top tracks with playcount and optional MBID
  • shanty-data/src/types.rs — PopularTrack { name, mbid, playcount } type already exists
  • shanty-db/src/queries/cache.rs — for caching the Last.fm response
  • shanty-web/src/routes/tracks.rs — watch_track / unwatch_track endpoints already exist
  • shanty-web/frontend/src/pages/album.rs — Watch/Unwatch per-track pattern to follow

Acceptance Criteria

  • "Top Songs" tab visible on artist detail page when Last.fm API key is configured
  • Shows ranked list of tracks with play counts
  • Each track has a Watch/Unwatch button that creates/removes a wanted_item
  • Paginated (25 per page default)
  • Results cached (7 day TTL)
  • Tab hidden when no Last.fm API key is set
  • Works with the existing sync → download pipeline (watched top songs get downloaded on next "Set Sail")

Notes

This will likely be the primary workflow for casual users: search artist → view top songs → watch a few → Set Sail. It should feel fast and lightweight compared to browsing full discography.

Description: Problem Currently, to watch individual songs by an artist, users must browse through all their albums and singles, find the track they want, and click Watch. For popular artists with dozens of releases, this is tedious. Most users just want to quickly see an artist's most popular tracks, pick a few, and move on. Proposed Solution Add a "Top Songs" tab to the artist detail page that shows the artist's most popular tracks from Last.fm, paginated. This becomes the fastest way to selectively watch individual songs. Requirements Backend: - New endpoint GET /api/artists/{id}/top-songs?page=1&limit=25 that fetches top tracks from Last.fm via the existing SimilarArtistFetcher::get_top_tracks() (already implemented in shanty-data/src/lastfm.rs) - Cache results in search_cache with a reasonable TTL (7 days) - Response should include: track name, playcount, recording MBID (if available from Last.fm), and watch status (cross-referenced with wanted_items) - Requires SHANTY_LASTFM_API_KEY to be set — gracefully degrade if not configured (show message instead of tab) Frontend: - New tab on the artist detail page alongside the album listing (e.g., "Top Songs" | "Albums" | "EPs" | "Singles") - Paginated table: rank, title, play count, status badge, Watch/Unwatch button - Default to first 25 tracks, with "Load More" or pagination controls - Watch button should call the existing POST /api/tracks/watch endpoint with the track title and artist name - If Last.fm API key is not configured, hide the tab entirely (check via existing YtAuthStatus.lastfm_api_key_set or add a field to status) Existing code to reuse: - shanty-data/src/lastfm.rs — LastFmSimilarFetcher::get_top_tracks() already fetches top tracks with playcount and optional MBID - shanty-data/src/types.rs — PopularTrack { name, mbid, playcount } type already exists - shanty-db/src/queries/cache.rs — for caching the Last.fm response - shanty-web/src/routes/tracks.rs — watch_track / unwatch_track endpoints already exist - shanty-web/frontend/src/pages/album.rs — Watch/Unwatch per-track pattern to follow Acceptance Criteria - "Top Songs" tab visible on artist detail page when Last.fm API key is configured - Shows ranked list of tracks with play counts - Each track has a Watch/Unwatch button that creates/removes a wanted_item - Paginated (25 per page default) - Results cached (7 day TTL) - Tab hidden when no Last.fm API key is set - Works with the existing sync → download pipeline (watched top songs get downloaded on next "Set Sail") Notes This will likely be the primary workflow for casual users: search artist → view top songs → watch a few → Set Sail. It should feel fast and lightweight compared to browsing full discography.
connor added the MediumPriority label 2026-03-25 15:35:01 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Shanty/Main#47