Krolyxon
Commit 7eac9cf

rmptui7eac9cf

minor changes

Author
krolxon
Date
2024-04-28 18:00 +0530
Parent
6e631a0
Commit
7eac9cfbc66c272edaf8c5207b4beaca247d5209

+15 −15

4 files changed

  1. M README.md +3 −3
  2. M src/browser.rs +1 −7
  3. M src/connection.rs +11 −4
  4. M src/ui.rs +0 −1
M README.md View
@@ -34,10 +34,10 @@ A MPD client in Rust
3434
3535 ### TODO
3636 - [x] fix performance issues
37−- [ ] improvements on queue control
37+- [x] improvements on queue control
3838 - [x] add to playlists
39+- [x] search for songs
40+- [x] Humantime format
3941 - [ ] view playlist
4042 - [ ] change playlist name
41−- [x] search for songs
4243 - [ ] metadata based tree view
43−- [x] Humantime format
M src/browser.rs View
@@ -1,8 +1,4 @@
1−use crate::{
2− app::{App, AppResult},
3− connection::Connection,
4− song::RSong,
5−};
1+use crate::{app::AppResult, connection::Connection, song::RSong};
62
73 #[derive(Debug)]
84 pub struct FileBrowser {
@@ -76,8 +72,6 @@ impl FileBrowser {
7672 }
7773 }
7874
79−
80−
8175 pub fn handle_go_back(&mut self, conn: &mut Connection) -> AppResult<()> {
8276 if self.prev_path != "." {
8377 let r = self.path.rfind("/").unwrap();
M src/connection.rs View
@@ -28,7 +28,7 @@ impl Connection {
2828 let mut conn = Client::connect(addrs).unwrap();
2929
3030 let empty_song = Song {
31− file: "No Song in the Queue".to_string(),
31+ file: "No Song playing or in Queue".to_string(),
3232 artist: None,
3333 title: None,
3434 duration: None,
@@ -52,7 +52,10 @@ impl Connection {
5252 let repeat = status.repeat;
5353 let random = status.random;
5454
55− let current_song = conn.currentsong().unwrap_or_else(|_| Some(empty_song.clone())).unwrap_or_else(|| empty_song);
55+ let current_song = conn
56+ .currentsong()
57+ .unwrap_or_else(|_| Some(empty_song.clone()))
58+ .unwrap_or_else(|| empty_song);
5659 Ok(Self {
5760 conn,
5861 songs_filenames,
@@ -93,8 +96,12 @@ impl Connection {
9396 /// Update status
9497 pub fn update_status(&mut self) {
9598 let status = self.conn.status().unwrap();
96− let empty_song = self.get_song_with_only_filename("No Song in the Queue");
97− let current_song = self.conn.currentsong().unwrap_or_else(|_| Some(empty_song.clone())).unwrap_or_else(|| empty_song);
99+ let empty_song = self.get_song_with_only_filename("No Song playing or in Queue");
100+ let current_song = self
101+ .conn
102+ .currentsong()
103+ .unwrap_or_else(|_| Some(empty_song.clone()))
104+ .unwrap_or_else(|| empty_song);
98105
99106 // Playback State
100107 match status.state {
M src/ui.rs View
@@ -1,5 +1,4 @@
11 use crate::app::{App, SelectedTab};
2−use clap::builder::styling::RgbColor;
32 use ratatui::{
43 prelude::*,
54 widgets::{block::Title, *},