Implement online music search in shanty-search
#8
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
shanty-searchcrate provides the ability to search for music online — finding artists, albums, and tracks that can then be added to the user's library (watchlist). This is the "discovery" piece that feeds intoshanty-watch. It wraps online music databases and returns structured results.This issue covers:
MusicBrainz search — implement search functionality against the MusicBrainz API:
Result types — define clean, serializable result types:
ArtistSearchResult— name, MBID, disambiguation, country, type (person/group)AlbumSearchResult— title, artist, MBID, year, track count, cover art URLTrackSearchResult— title, artist, album, MBID, duration, track numberDiscography— list of releases grouped by type (album, single, EP, compilation)Search provider trait — define a
SearchProvidertrait so that alternative backends (Last.fm, Spotify API for metadata, Discogs, etc.) can be added later. The trait should cover:search_artist(query) -> Vec<ArtistSearchResult>search_album(query, artist_hint) -> Vec<AlbumSearchResult>search_track(query, artist_hint) -> Vec<TrackSearchResult>get_artist_discography(artist_id) -> DiscographyCaching — optionally cache search results in
shanty-dbto reduce API calls for repeated searches. Cache entries should have a TTL (e.g., 24 hours).CLI interface — the
shanty-searchbinary should accept:artist <query>— search for an artistalbum <query> [--artist <artist>]— search for an albumtrack <query> [--artist <artist>]— search for a trackdiscography <artist_name_or_mbid>— show an artist's discography--json— output results as JSON (useful for piping to other tools)--limit <n>— max number of results (default 10)Design Considerations
shanty-tag. Consider whether the MB client should live in a shared utility crate (e.g.,shanty-mb) or inshanty-db, or whether each crate has its own thin client. A shared client avoids duplication of rate-limiting logic.Acceptance Criteria
SearchProvidertrait exists with MusicBrainz as the first implementation--jsonoutput is valid JSONDependencies