137 lines
3.7 KiB
Rust
137 lines
3.7 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
/// A reference to a release (album) that a recording appears on.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ReleaseRef {
|
|
pub mbid: String,
|
|
pub title: String,
|
|
pub date: Option<String>,
|
|
pub track_number: Option<i32>,
|
|
}
|
|
|
|
/// A recording match from a search query.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct RecordingMatch {
|
|
pub mbid: String,
|
|
pub title: String,
|
|
pub artist: String,
|
|
pub artist_mbid: Option<String>,
|
|
pub releases: Vec<ReleaseRef>,
|
|
/// MusicBrainz API score (0-100).
|
|
pub score: u8,
|
|
}
|
|
|
|
/// A release (album) match from a search query.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ReleaseMatch {
|
|
pub mbid: String,
|
|
pub title: String,
|
|
pub artist: String,
|
|
pub artist_mbid: Option<String>,
|
|
pub date: Option<String>,
|
|
pub track_count: Option<i32>,
|
|
pub score: u8,
|
|
}
|
|
|
|
/// Full details for a recording, retrieved by MBID.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct RecordingDetails {
|
|
pub mbid: String,
|
|
pub title: String,
|
|
pub artist: String,
|
|
pub artist_mbid: Option<String>,
|
|
pub releases: Vec<ReleaseRef>,
|
|
pub duration_ms: Option<u64>,
|
|
pub genres: Vec<String>,
|
|
}
|
|
|
|
/// Detailed artist info from a direct MBID lookup.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ArtistInfo {
|
|
pub name: String,
|
|
#[serde(default)]
|
|
pub mbid: Option<String>,
|
|
pub disambiguation: Option<String>,
|
|
pub country: Option<String>,
|
|
pub artist_type: Option<String>,
|
|
pub begin_year: Option<String>,
|
|
pub urls: Vec<ArtistUrl>,
|
|
}
|
|
|
|
/// An external URL linked to an artist on MusicBrainz.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ArtistUrl {
|
|
pub url: String,
|
|
pub link_type: 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>,
|
|
}
|
|
|
|
/// A release group (deduplicated album/EP/single concept).
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ReleaseGroupEntry {
|
|
pub mbid: String,
|
|
pub title: String,
|
|
pub primary_type: Option<String>,
|
|
pub secondary_types: Vec<String>,
|
|
pub first_release_date: Option<String>,
|
|
/// MBID of the first release in this group (for fetching tracks).
|
|
pub first_release_mbid: Option<String>,
|
|
/// True if the queried artist is not the primary credit on this release group.
|
|
#[serde(default)]
|
|
pub featured: bool,
|
|
}
|
|
|
|
/// A track within a release.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ReleaseTrack {
|
|
pub recording_mbid: String,
|
|
pub title: String,
|
|
pub track_number: Option<i32>,
|
|
pub disc_number: Option<i32>,
|
|
pub duration_ms: Option<u64>,
|
|
}
|
|
|
|
/// A similar artist returned by Last.fm or another provider.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct SimilarArtist {
|
|
pub name: String,
|
|
pub mbid: Option<String>,
|
|
pub match_score: f64,
|
|
}
|
|
|
|
/// A popular/top track for an artist from Last.fm.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct PopularTrack {
|
|
pub name: String,
|
|
pub mbid: Option<String>,
|
|
pub playcount: u64,
|
|
}
|
|
|
|
/// Result from a lyrics lookup.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct LyricsResult {
|
|
pub found: bool,
|
|
pub lyrics: Option<String>,
|
|
pub synced_lyrics: Option<String>,
|
|
}
|