2023-03-29 01:29:11 +02:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use uuid;
|
|
|
|
|
|
|
|
/// The [MusicBrainz Identifier](https://musicbrainz.org/doc/MusicBrainz_Identifier).
|
|
|
|
type Mbid = uuid::Uuid;
|
|
|
|
|
|
|
|
/// An artist. May be linked to MusicBrainz.
|
|
|
|
#[derive(Deserialize, Serialize)]
|
|
|
|
pub struct Artist {
|
|
|
|
pub name: String,
|
|
|
|
pub mbid: Option<Mbid>,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// A single track on a release.
|
|
|
|
#[derive(Deserialize, Serialize)]
|
|
|
|
pub struct Track {
|
|
|
|
pub number: u32,
|
|
|
|
pub title: String,
|
|
|
|
pub artist: Artist,
|
2023-03-28 22:49:59 +02:00
|
|
|
}
|
|
|
|
|
2023-03-29 01:29:11 +02:00
|
|
|
/// MusicHoard release corresponds to MusicBrainz' concept of a release. However, it does not link
|
|
|
|
/// to MusicBrainz as the intention of MusicHoard is to manage releases locally.
|
|
|
|
#[derive(Deserialize, Serialize)]
|
|
|
|
pub struct Release {
|
|
|
|
pub title: String,
|
|
|
|
pub artist: String,
|
|
|
|
pub tracks: Vec<Track>,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// MusicHoard uses MusicBrainz [primary release group
|
|
|
|
/// type](https://musicbrainz.org/doc/Release_Group/Type)
|
|
|
|
#[derive(Deserialize, Serialize)]
|
|
|
|
pub enum ReleaseGroupType {
|
|
|
|
Album,
|
|
|
|
Ep,
|
|
|
|
Single,
|
|
|
|
Other,
|
|
|
|
}
|
2023-03-28 22:49:59 +02:00
|
|
|
|
2023-03-29 01:29:11 +02:00
|
|
|
/// MusicHoard uses MusicBrainz' [Release Group concept](https://musicbrainz.org/doc/Release_Group).
|
|
|
|
#[derive(Deserialize, Serialize)]
|
|
|
|
pub struct ReleaseGroup {
|
|
|
|
pub r#type: ReleaseGroupType,
|
|
|
|
pub title: String,
|
|
|
|
pub artist: Artist,
|
|
|
|
pub year: u32,
|
|
|
|
pub mbid: Option<Mbid>,
|
|
|
|
pub releases: Vec<Release>,
|
2023-03-28 22:49:59 +02:00
|
|
|
}
|