Show tracks + duration of album, playlist, queue
Stats are in the top right Fixes #475
This commit is contained in:
@@ -66,6 +66,17 @@ impl ViewExt for AlbumView {
|
||||
format!("{} ({})", self.album.title, self.album.year)
|
||||
}
|
||||
|
||||
fn title_sub(&self) -> String {
|
||||
if let Some(tracks) = &self.album.tracks {
|
||||
let duration_secs: u64 = tracks.iter().map(|t| t.duration as u64 / 1000).sum();
|
||||
let duration = std::time::Duration::from_secs(duration_secs);
|
||||
let duration_str = crate::utils::format_duration(&duration);
|
||||
format!("{} tracks, {}", tracks.len(), duration_str)
|
||||
} else {
|
||||
"".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
fn on_command(&mut self, s: &mut Cursive, cmd: &Command) -> Result<CommandResult, String> {
|
||||
self.tabs.on_command(s, cmd)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user