Add artist search and discography to MetadataProvider
This commit is contained in:
@@ -47,6 +47,27 @@ pub struct RecordingDetails {
|
||||
pub genres: Vec<String>,
|
||||
}
|
||||
|
||||
/// An artist match from a search query.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ArtistSearchResult {
|
||||
pub mbid: String,
|
||||
pub name: String,
|
||||
pub disambiguation: Option<String>,
|
||||
pub country: Option<String>,
|
||||
pub artist_type: Option<String>,
|
||||
pub score: u8,
|
||||
}
|
||||
|
||||
/// A release entry in an artist's discography.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct DiscographyEntry {
|
||||
pub mbid: String,
|
||||
pub title: String,
|
||||
pub date: Option<String>,
|
||||
pub release_type: Option<String>,
|
||||
pub track_count: Option<i32>,
|
||||
}
|
||||
|
||||
/// Trait for metadata lookup backends. MusicBrainz is the default implementation;
|
||||
/// others (Last.fm, Discogs, etc.) can be added later.
|
||||
pub trait MetadataProvider: Send + Sync {
|
||||
@@ -66,4 +87,16 @@ pub trait MetadataProvider: Send + Sync {
|
||||
&self,
|
||||
mbid: &str,
|
||||
) -> impl std::future::Future<Output = TagResult<RecordingDetails>> + Send;
|
||||
|
||||
fn search_artist(
|
||||
&self,
|
||||
query: &str,
|
||||
limit: u32,
|
||||
) -> impl std::future::Future<Output = TagResult<Vec<ArtistSearchResult>>> + Send;
|
||||
|
||||
fn get_artist_releases(
|
||||
&self,
|
||||
artist_mbid: &str,
|
||||
limit: u32,
|
||||
) -> impl std::future::Future<Output = TagResult<Vec<DiscographyEntry>>> + Send;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user