musichoard/src/lib.rs

54 lines
1.3 KiB
Rust

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