diff --git a/Cargo.toml b/Cargo.toml index a7c24dc..f652563 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] } diff --git a/src/lib.rs b/src/lib.rs index 17a269d..29c3a6d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,3 +2,5 @@ pub mod backend; pub mod error; pub mod music; pub mod player; +pub mod store; + diff --git a/src/player/mod.rs b/src/player/mod.rs index 09d9cca..aca2b38 100644 --- a/src/player/mod.rs +++ b/src/player/mod.rs @@ -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 { - 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()); - } - } - _ => todo!("not all categories are implemented yet"), + 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(), } - v } } diff --git a/src/player/ui/entry.rs b/src/player/ui/entry.rs index 111f220..495dae0 100644 --- a/src/player/ui/entry.rs +++ b/src/player/ui/entry.rs @@ -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", diff --git a/src/store/mod.rs b/src/store/mod.rs new file mode 100644 index 0000000..4f1b500 --- /dev/null +++ b/src/store/mod.rs @@ -0,0 +1,29 @@ +pub struct Store {} + +impl Default for Store { + fn default() -> Self { + Store {} + } +} + +impl Store { + pub fn genres(&self) -> Vec { + todo!() + } + + pub fn artists(&self) -> Vec { + todo!() + } + + pub fn playlists(&self) -> Vec { + todo!() + } + + pub fn songs(&self) -> Vec { + todo!() + } + + pub fn albums(&self) -> Vec { + todo!() + } +}