2023-03-29 02:44:59 +02:00
|
|
|
//! MusicHoard - a music collection manager.
|
|
|
|
|
2023-03-29 01:29:11 +02:00
|
|
|
use serde::{Deserialize, Serialize};
|
2023-03-29 08:37:01 +02:00
|
|
|
use uuid::Uuid;
|
|
|
|
|
|
|
|
pub mod database;
|
2023-03-29 01:29:11 +02:00
|
|
|
|
2023-03-29 02:44:59 +02:00
|
|
|
/// [MusicBrainz Identifier](https://musicbrainz.org/doc/MusicBrainz_Identifier) (MBID).
|
2023-03-29 08:37:01 +02:00
|
|
|
pub type Mbid = Uuid;
|
2023-03-29 01:29:11 +02:00
|
|
|
|
2023-03-29 02:44:59 +02:00
|
|
|
/// [Artist](https://musicbrainz.org/doc/Artist).
|
2023-03-29 08:37:01 +02:00
|
|
|
#[derive(Debug, Deserialize, Serialize, PartialEq)]
|
2023-03-29 01:29:11 +02:00
|
|
|
pub struct Artist {
|
|
|
|
pub name: String,
|
|
|
|
pub mbid: Option<Mbid>,
|
|
|
|
}
|
|
|
|
|
2023-03-29 02:44:59 +02:00
|
|
|
/// [Track](https://musicbrainz.org/doc/Track).
|
2023-03-29 08:37:01 +02:00
|
|
|
#[derive(Debug, Deserialize, Serialize, PartialEq)]
|
2023-03-29 01:29:11 +02:00
|
|
|
pub struct Track {
|
|
|
|
pub number: u32,
|
|
|
|
pub title: String,
|
2023-03-29 08:37:01 +02:00
|
|
|
pub artist: Vec<Artist>,
|
2023-03-29 02:44:59 +02:00
|
|
|
pub mbid: Option<Mbid>,
|
2023-03-28 22:49:59 +02:00
|
|
|
}
|
|
|
|
|
2023-03-29 02:44:59 +02:00
|
|
|
/// [Release](https://musicbrainz.org/doc/Release).
|
2023-03-29 08:37:01 +02:00
|
|
|
#[derive(Debug, Deserialize, Serialize, PartialEq)]
|
2023-03-29 01:29:11 +02:00
|
|
|
pub struct Release {
|
|
|
|
pub tracks: Vec<Track>,
|
2023-03-29 02:44:59 +02:00
|
|
|
pub mbid: Option<Mbid>,
|
2023-03-29 01:29:11 +02:00
|
|
|
}
|
|
|
|
|
2023-03-29 02:44:59 +02:00
|
|
|
/// [Release group primary type](https://musicbrainz.org/doc/Release_Group/Type).
|
2023-03-29 08:37:01 +02:00
|
|
|
#[derive(Debug, Deserialize, Serialize, PartialEq)]
|
2023-03-29 01:29:11 +02:00
|
|
|
pub enum ReleaseGroupType {
|
|
|
|
Album,
|
|
|
|
Ep,
|
|
|
|
Single,
|
|
|
|
Other,
|
|
|
|
}
|
2023-03-28 22:49:59 +02:00
|
|
|
|
2023-03-29 02:44:59 +02:00
|
|
|
/// [Release group](https://musicbrainz.org/doc/Release_Group).
|
2023-03-29 08:37:01 +02:00
|
|
|
#[derive(Debug, Deserialize, Serialize, PartialEq)]
|
2023-03-29 01:29:11 +02:00
|
|
|
pub struct ReleaseGroup {
|
|
|
|
pub r#type: ReleaseGroupType,
|
|
|
|
pub title: String,
|
2023-03-29 08:37:01 +02:00
|
|
|
pub artist: Vec<Artist>,
|
2023-03-29 01:29:11 +02:00
|
|
|
pub year: u32,
|
|
|
|
pub mbid: Option<Mbid>,
|
|
|
|
pub releases: Vec<Release>,
|
2023-03-28 22:49:59 +02:00
|
|
|
}
|