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 11:00:32 +02:00
|
|
|
pub mod library;
|
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-30 14:41:25 +02:00
|
|
|
/// An album artist. Carries a MBID to facilitate discography access.
|
2023-03-29 08:37:01 +02:00
|
|
|
#[derive(Debug, Deserialize, Serialize, PartialEq)]
|
2023-03-30 14:41:25 +02:00
|
|
|
pub struct AlbumArtist {
|
2023-03-29 01:29:11 +02:00
|
|
|
pub name: String,
|
|
|
|
pub mbid: Option<Mbid>,
|
|
|
|
}
|
|
|
|
|
2023-03-30 14:41:25 +02:00
|
|
|
/// A single track on an album.
|
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-30 14:41:25 +02:00
|
|
|
pub artist: Vec<String>,
|
2023-03-28 22:49:59 +02:00
|
|
|
}
|
|
|
|
|
2023-03-30 14:41:25 +02:00
|
|
|
/// An album is a collection of tracks that were released together.
|
2023-03-29 08:37:01 +02:00
|
|
|
#[derive(Debug, Deserialize, Serialize, PartialEq)]
|
2023-03-30 14:41:25 +02:00
|
|
|
pub struct Album {
|
|
|
|
pub artist: AlbumArtist,
|
2023-03-29 01:29:11 +02:00
|
|
|
pub year: u32,
|
2023-03-30 14:41:25 +02:00
|
|
|
pub title: String,
|
|
|
|
pub tracks: Vec<Track>,
|
2023-03-28 22:49:59 +02:00
|
|
|
}
|