feat(store): add store
cargo devel CI / cargo CI (push) Successful in 3m9s Details

This commit is contained in:
Christoph J. Scherr 2024-08-23 10:48:16 +02:00
parent af3135462a
commit 876e2d68e0
5 changed files with 43 additions and 9 deletions

View File

@ -29,6 +29,7 @@ image = { version = "0.25.2", default-features = true, features = [
] }
libpt = { version = "0.6.0", features = ["cli", "full"] }
serde = { version = "1.0.208", features = ["derive"] }
strum = { version = "0.26.3", features = ["derive"] }
thiserror = "1.0.63"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

View File

@ -2,3 +2,5 @@ pub mod backend;
pub mod error;
pub mod music;
pub mod player;
pub mod store;

View File

@ -4,6 +4,7 @@ use libpt::cli::args::VerbosityLevel;
use libpt::log::{debug, info};
use crate::error::Error;
use crate::store::Store;
use self::ui::entry::{Entry, Kind};
@ -24,6 +25,9 @@ pub struct Player {
#[clap(skip)]
kind: Kind,
#[clap(skip)]
store: Store,
}
impl Player {
@ -75,16 +79,12 @@ impl Player {
}
fn entries(&self) -> Vec<Entry> {
let mut v = Vec::new();
match self.category() {
Kind::Album => {
let e = Entry::new(Kind::Album, "boom boom boom", "boomerboom", None);
for _ in 0..100 {
v.push(e.clone());
Kind::Album => self.store.albums(),
Kind::Song => self.store.songs(),
Kind::Playlist => self.store.playlists(),
Kind::Artist => self.store.artists(),
Kind::Genre => self.store.genres(),
}
}
_ => todo!("not all categories are implemented yet"),
}
v
}
}

View File

@ -8,6 +8,7 @@ pub enum Kind {
Album,
Song,
Artist,
Genre,
}
#[derive(Clone, Debug)]
@ -53,6 +54,7 @@ impl std::fmt::Display for Kind {
"{}",
match self {
Self::Song => "Song",
Self::Genre => "Genre",
Self::Album => "Album",
Self::Playlist => "Playlist",
Self::Artist => "Artist",

29
src/store/mod.rs Normal file
View File

@ -0,0 +1,29 @@
pub struct Store {}
impl Default for Store {
fn default() -> Self {
Store {}
}
}
impl Store {
pub fn genres(&self) -> Vec<crate::player::ui::entry::Entry> {
todo!()
}
pub fn artists(&self) -> Vec<crate::player::ui::entry::Entry> {
todo!()
}
pub fn playlists(&self) -> Vec<crate::player::ui::entry::Entry> {
todo!()
}
pub fn songs(&self) -> Vec<crate::player::ui::entry::Entry> {
todo!()
}
pub fn albums(&self) -> Vec<crate::player::ui::entry::Entry> {
todo!()
}
}