First draft of public data structures #2

Merged
wojtek merged 2 commits from 1---first-draft-of-public-data-structures into main 2023-03-29 02:46:49 +02:00
Showing only changes of commit 057808c1cc - Show all commits

View File

@ -1,35 +1,37 @@
//! MusicHoard - a music collection manager.
use serde::{Deserialize, Serialize};
use uuid;
/// The [MusicBrainz Identifier](https://musicbrainz.org/doc/MusicBrainz_Identifier).
type Mbid = uuid::Uuid;
/// [MusicBrainz Identifier](https://musicbrainz.org/doc/MusicBrainz_Identifier) (MBID).
pub type Mbid = uuid::Uuid;
/// An artist. May be linked to MusicBrainz.
/// [Artist](https://musicbrainz.org/doc/Artist).
#[derive(Deserialize, Serialize)]
pub struct Artist {
pub name: String,
pub mbid: Option<Mbid>,
}
/// A single track on a release.
/// [Track](https://musicbrainz.org/doc/Track).
#[derive(Deserialize, Serialize)]
pub struct Track {
pub number: u32,
pub title: String,
pub artist: Artist,
pub mbid: Option<Mbid>,
}
/// 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.
/// [Release](https://musicbrainz.org/doc/Release).
#[derive(Deserialize, Serialize)]
pub struct Release {
pub title: String,
pub artist: String,
pub tracks: Vec<Track>,
pub mbid: Option<Mbid>,
}
/// MusicHoard uses MusicBrainz [primary release group
/// type](https://musicbrainz.org/doc/Release_Group/Type)
/// [Release group primary type](https://musicbrainz.org/doc/Release_Group/Type).
#[derive(Deserialize, Serialize)]
pub enum ReleaseGroupType {
Album,
@ -38,7 +40,7 @@ pub enum ReleaseGroupType {
Other,
}
/// MusicHoard uses MusicBrainz' [Release Group concept](https://musicbrainz.org/doc/Release_Group).
/// [Release group](https://musicbrainz.org/doc/Release_Group).
#[derive(Deserialize, Serialize)]
pub struct ReleaseGroup {
pub r#type: ReleaseGroupType,