minor changes
This commit is contained in:
parent
6e631a0520
commit
7eac9cfbc6
|
|
@ -34,10 +34,10 @@ A MPD client in Rust
|
||||||
|
|
||||||
### TODO
|
### TODO
|
||||||
- [x] fix performance issues
|
- [x] fix performance issues
|
||||||
- [ ] improvements on queue control
|
- [x] improvements on queue control
|
||||||
- [x] add to playlists
|
- [x] add to playlists
|
||||||
|
- [x] search for songs
|
||||||
|
- [x] Humantime format
|
||||||
- [ ] view playlist
|
- [ ] view playlist
|
||||||
- [ ] change playlist name
|
- [ ] change playlist name
|
||||||
- [x] search for songs
|
|
||||||
- [ ] metadata based tree view
|
- [ ] metadata based tree view
|
||||||
- [x] Humantime format
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
use crate::{
|
use crate::{app::AppResult, connection::Connection, song::RSong};
|
||||||
app::{App, AppResult},
|
|
||||||
connection::Connection,
|
|
||||||
song::RSong,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct FileBrowser {
|
pub struct FileBrowser {
|
||||||
|
|
@ -76,8 +72,6 @@ impl FileBrowser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pub fn handle_go_back(&mut self, conn: &mut Connection) -> AppResult<()> {
|
pub fn handle_go_back(&mut self, conn: &mut Connection) -> AppResult<()> {
|
||||||
if self.prev_path != "." {
|
if self.prev_path != "." {
|
||||||
let r = self.path.rfind("/").unwrap();
|
let r = self.path.rfind("/").unwrap();
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ impl Connection {
|
||||||
let mut conn = Client::connect(addrs).unwrap();
|
let mut conn = Client::connect(addrs).unwrap();
|
||||||
|
|
||||||
let empty_song = Song {
|
let empty_song = Song {
|
||||||
file: "No Song in the Queue".to_string(),
|
file: "No Song playing or in Queue".to_string(),
|
||||||
artist: None,
|
artist: None,
|
||||||
title: None,
|
title: None,
|
||||||
duration: None,
|
duration: None,
|
||||||
|
|
@ -52,7 +52,10 @@ impl Connection {
|
||||||
let repeat = status.repeat;
|
let repeat = status.repeat;
|
||||||
let random = status.random;
|
let random = status.random;
|
||||||
|
|
||||||
let current_song = conn.currentsong().unwrap_or_else(|_| Some(empty_song.clone())).unwrap_or_else(|| empty_song);
|
let current_song = conn
|
||||||
|
.currentsong()
|
||||||
|
.unwrap_or_else(|_| Some(empty_song.clone()))
|
||||||
|
.unwrap_or_else(|| empty_song);
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
conn,
|
conn,
|
||||||
songs_filenames,
|
songs_filenames,
|
||||||
|
|
@ -93,8 +96,12 @@ impl Connection {
|
||||||
/// Update status
|
/// Update status
|
||||||
pub fn update_status(&mut self) {
|
pub fn update_status(&mut self) {
|
||||||
let status = self.conn.status().unwrap();
|
let status = self.conn.status().unwrap();
|
||||||
let empty_song = self.get_song_with_only_filename("No Song in the Queue");
|
let empty_song = self.get_song_with_only_filename("No Song playing or in Queue");
|
||||||
let current_song = self.conn.currentsong().unwrap_or_else(|_| Some(empty_song.clone())).unwrap_or_else(|| empty_song);
|
let current_song = self
|
||||||
|
.conn
|
||||||
|
.currentsong()
|
||||||
|
.unwrap_or_else(|_| Some(empty_song.clone()))
|
||||||
|
.unwrap_or_else(|| empty_song);
|
||||||
|
|
||||||
// Playback State
|
// Playback State
|
||||||
match status.state {
|
match status.state {
|
||||||
|
|
|
||||||
Reference in New Issue