fix highlight delay when song deleted from queue
This commit is contained in:
parent
6338417002
commit
f3fb60a1a0
|
|
@ -12,9 +12,8 @@ pub type AppResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
|
|||
/// Application
|
||||
#[derive(Debug)]
|
||||
pub struct App {
|
||||
/// check if app is running
|
||||
pub running: bool,
|
||||
pub conn: Connection,
|
||||
pub running: bool, // Check if app is running
|
||||
pub conn: Connection, // Connection
|
||||
pub browser: FileBrowser, // Directory browser
|
||||
pub queue_list: ContentList<Song>, // Stores the current playing queue
|
||||
pub pl_list: ContentList<String>, // Stores list of playlists
|
||||
|
|
@ -91,7 +90,6 @@ impl App {
|
|||
// }
|
||||
// });
|
||||
conn.conn.queue().unwrap().into_iter().for_each(|x| {
|
||||
// vec.push(x.title.unwrap());
|
||||
vec.push(x);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,8 +110,7 @@ impl Connection {
|
|||
// Current song
|
||||
self.current_song = current_song;
|
||||
|
||||
//
|
||||
|
||||
// Stats
|
||||
self.stats = stats;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
|
|||
app.queue_list.index -= 1;
|
||||
}
|
||||
|
||||
app.conn.update_status();
|
||||
app.update_queue();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,14 +12,16 @@ pub type Result<T> = core::result::Result<T, Error>;
|
|||
pub type Error = Box<dyn std::error::Error>;
|
||||
|
||||
fn main() -> AppResult<()> {
|
||||
// Connection
|
||||
let env_host = env::var("MPD_HOST").unwrap_or_else(|_| "127.0.0.1".to_string());
|
||||
let env_port = env::var("MPD_PORT").unwrap_or_else(|_| "6600".to_string());
|
||||
let mut app = App::builder(format!("{}:{}", env_host, env_port).as_str())?;
|
||||
let url = format!("{}:{}", env_host, env_port);
|
||||
let mut app = App::builder(&url)?;
|
||||
|
||||
// UI
|
||||
let backend = CrosstermBackend::new(io::stderr());
|
||||
let terminal = Terminal::new(backend)?;
|
||||
let events = EventHandler::new(1000);
|
||||
|
||||
let mut tui = tui::Tui::new(terminal, events);
|
||||
tui.init()?;
|
||||
|
||||
|
|
|
|||
Reference in New Issue