Show refreshing status during library scan
- Add is_refreshing flag to AppState - Display 'Refreshing library...' in status panel during scan - Note: scan is currently blocking, message may be brief - Infrastructure ready for future async scanning
This commit is contained in:
parent
afc58a7920
commit
71b43d644c
@ -178,12 +178,14 @@ async fn handle_key_event(state: &mut AppState, player: &mut player::Player, key
|
||||
}
|
||||
}
|
||||
KeyCode::Char('r') => {
|
||||
state.is_refreshing = true;
|
||||
tracing::info!("Rescanning...");
|
||||
let cache_dir = cache::get_cache_dir()?;
|
||||
let new_cache = scanner::scan_paths(&state.config.scan_paths.paths)?;
|
||||
new_cache.save(&cache_dir)?;
|
||||
state.cache = new_cache;
|
||||
state.refresh_flattened_items();
|
||||
state.is_refreshing = false;
|
||||
tracing::info!("Rescan complete");
|
||||
}
|
||||
_ => {}
|
||||
|
||||
@ -26,6 +26,7 @@ pub struct AppState {
|
||||
pub marked_files: HashSet<PathBuf>,
|
||||
pub playlist: Vec<PathBuf>,
|
||||
pub playlist_index: usize,
|
||||
pub is_refreshing: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@ -58,6 +59,7 @@ impl AppState {
|
||||
marked_files: HashSet::new(),
|
||||
playlist: Vec::new(),
|
||||
playlist_index: 0,
|
||||
is_refreshing: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -65,11 +65,15 @@ fn render_status_panel(frame: &mut Frame, state: &AppState, area: Rect) {
|
||||
])
|
||||
.split(area);
|
||||
|
||||
// Player state
|
||||
let state_text = match state.player_state {
|
||||
PlayerState::Stopped => "Stopped",
|
||||
PlayerState::Playing => "Playing",
|
||||
PlayerState::Paused => "Paused",
|
||||
// Player state or refreshing status
|
||||
let state_text = if state.is_refreshing {
|
||||
"Refreshing library..."
|
||||
} else {
|
||||
match state.player_state {
|
||||
PlayerState::Stopped => "Stopped",
|
||||
PlayerState::Playing => "Playing",
|
||||
PlayerState::Paused => "Paused",
|
||||
}
|
||||
};
|
||||
let state_widget = Paragraph::new(state_text)
|
||||
.block(Block::default().borders(Borders::ALL).title("Status"))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user