musichoard/src/lib.rs

54 lines
1.3 KiB
Rust
Raw Normal View History

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};
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).
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).
#[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).
#[derive(Debug, Deserialize, Serialize, PartialEq)]
2023-03-29 01:29:11 +02:00
pub struct Track {
pub number: u32,
pub title: String,
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).
#[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).
#[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).
#[derive(Debug, Deserialize, Serialize, PartialEq)]
2023-03-29 01:29:11 +02:00
pub struct ReleaseGroup {
pub r#type: ReleaseGroupType,
pub title: String,
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
}