Add the library trait

This commit is contained in:
Wojciech Kozlowski 2023-03-29 18:00:32 +09:00
parent 42a41feead
commit 5ee8afc4c4
2 changed files with 18 additions and 0 deletions

View File

@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
use uuid::Uuid; use uuid::Uuid;
pub mod database; pub mod database;
pub mod library;
/// [MusicBrainz Identifier](https://musicbrainz.org/doc/MusicBrainz_Identifier) (MBID). /// [MusicBrainz Identifier](https://musicbrainz.org/doc/MusicBrainz_Identifier) (MBID).
pub type Mbid = Uuid; pub type Mbid = Uuid;

17
src/library/mod.rs Normal file
View File

@ -0,0 +1,17 @@
use std::path::Path;
use crate::ReleaseGroup;
/// Options for refining library queries.
pub struct Query {
albumartist: Option<String>,
artist: Option<String>,
album: Option<String>,
track: Option<u32>,
title: Option<String>,
}
/// Trait for interacting with the music library.
pub trait Library {
fn list(&self, album: bool, path: Path, format: &str, query: Query) -> Vec<ReleaseGroup>;
}