diff --git a/src/app.rs b/src/app.rs index d120661..a7495bd 100644 --- a/src/app.rs +++ b/src/app.rs @@ -22,6 +22,7 @@ impl App { options, should_quit: false, playback: Playback::new(), + // TODO: Maybe read from some configuration (args, file, etc...) track_change_options: Default::default(), } } @@ -66,11 +67,7 @@ impl App { pub fn on_down(&mut self) {} pub fn on_enter(&mut self) { - self.play( - // "".into() - // "/home/hheikkinen/Music/Casiopea - Mint Jams (1982) FULL ALBUM/001 Take Me.opus".into(), - "/home/hheikkinen/Music/A Groovy Thing/01 - Flamingosis - A Groovy Intro.mp3".into(), - ); // TODO: Remove hardcoding + self.play("".into()); // TODO: Remove hardcoding } pub fn on_tab(&mut self) {} diff --git a/src/lib.rs b/src/lib.rs index 8af55de..889dba6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,14 +1,12 @@ use std::{path::PathBuf, str::FromStr}; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, Default)] +#[derive(Debug, Default)] pub struct ServerState { pub track_change_options: TrackChangeOptions, pub player: Option, } -#[derive(Serialize, Deserialize, Debug, Default)] +#[derive(Debug, Default)] pub struct PlayerState { pub track: PlaylistElement, pub is_paused: bool, @@ -23,7 +21,7 @@ pub enum PlaylistType { Queue, } -#[derive(Serialize, Deserialize, Debug, Default)] +#[derive(Debug, Default)] pub struct Playlist { pub items: Vec, pub current: Option, @@ -31,18 +29,18 @@ pub struct Playlist { impl Playlist {} -#[derive(Serialize, Deserialize, Debug)] +#[derive(Debug)] pub struct DirectoryPlaylist { pub directory: PathBuf, pub playlist: Playlist, } -#[derive(Serialize, Deserialize, Debug, Default)] +#[derive(Debug, Default)] pub struct QueuePlaylist { pub playlist: Playlist, } -#[derive(Serialize, Deserialize, Debug)] +#[derive(Debug)] pub struct TrackChangeOptions { pub shuffle: bool, pub next: bool, diff --git a/src/main.rs b/src/main.rs index 0645c02..239ea9a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,49 +10,13 @@ pub mod ui; /// rmp: Rust Music Player #[derive(Debug, FromArgs, Clone)] pub struct CliArgs { - /// run the server - #[argh(switch, short = 's')] - server: bool, - - /// randomize next track? - #[argh(option, default = "false")] - shuffle: bool, - - /// change track after the current one is finished? - #[argh(option, default = "true")] - next: bool, - - /// repeat the playlist (or track if 'next' is disabled) after it's finished - #[argh(option, default = "true")] - repeat: bool, - - /// kill server - #[argh(switch, short = 'x')] - exit: bool, - - /// don't start server even if it's not running - #[argh(switch, short = 'c')] - client_only: bool, - /// time in ms between two ticks. #[argh(option, default = "100")] tick_rate: u64, - /// interval in ms for clearing the request queue. - #[argh(option, default = "100")] - message_rate: u64, - - /// should client automatically sync the server state? (used mainly for debugging) - #[argh(option, default = "true")] - sync_state: bool, - /// whether unicode symbols are used to improve the overall look of the app #[argh(option, default = "true")] enhanced_graphics: bool, - - /// server-side log level (quiet, error, all) - #[argh(option)] - log_level: Option, } fn main() { diff --git a/src/ui.rs b/src/ui.rs index a2b3f3b..baf07b1 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -19,29 +19,6 @@ static SECONDARY_COLOR: Color = Color::Rgb(200, 200, 200); static PRIMARY_CONTRAST: Color = Color::Black; static CLEAR_CONTRAST: Color = Color::Rgb(100, 100, 100); -fn draw_no_connection(f: &mut Frame) { - let message = "Not connected"; - let width = message.len() as u16 + 4; - let height = 3; - - let x = (f.size().width as i16 - width as i16).max(0) as u16 / 2; - let y = (f.size().height as i16 - height as i16).max(0) as u16 / 2; - - let area = Rect { - x, - y, - width: u16::min(width, f.size().width - x), - height: u16::min(height, f.size().height - y), - }; - f.render_widget( - Paragraph::new(message) - .fg(SECONDARY_COLOR) - .block(Block::default().borders(Borders::ALL).fg(PRIMARY_COLOR)) - .alignment(Alignment::Center), - area, - ); -} - fn draw_playlist(f: &mut Frame, _app: &App, area: Rect) { let playlist = List::new(vec![]) .block(