//! MusicHoard - a music collection manager. use serde::{Deserialize, Serialize}; use uuid::Uuid; pub mod collection; pub mod database; pub mod library; /// [MusicBrainz Identifier](https://musicbrainz.org/doc/MusicBrainz_Identifier) (MBID). pub type Mbid = Uuid; /// The track file format. #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum TrackFormat { Flac, Mp3, } /// A single track on an album. #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub struct Track { pub number: u32, pub title: String, pub artist: Vec, pub format: TrackFormat, } /// The album identifier. #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Hash)] pub struct AlbumId { pub year: u32, pub title: String, } /// An album is a collection of tracks that were released together. #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub struct Album { pub id: AlbumId, pub tracks: Vec, } /// The artist identifier. #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Hash)] pub struct ArtistId { pub name: String, } /// An artist. #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub struct Artist { pub id: ArtistId, pub albums: Vec, } #[cfg(test)] #[macro_use] mod testlib; #[cfg(test)] mod tests { use once_cell::sync::Lazy; use super::*; pub static COLLECTION: Lazy> = Lazy::new(|| collection!()); }