add duration to queue
This commit is contained in:
@@ -14,7 +14,7 @@ use std::sync::Arc;
|
|||||||
use sunk::{
|
use sunk::{
|
||||||
search::{self, SearchPage},
|
search::{self, SearchPage},
|
||||||
song::Song,
|
song::Song,
|
||||||
Media, Streamable,
|
Streamable,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::MusicClient;
|
use crate::MusicClient;
|
||||||
@@ -248,10 +248,15 @@ fn song_message(index: Option<usize>, metadata: &Metadata) -> String {
|
|||||||
None => "Current: ".into(),
|
None => "Current: ".into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let duration = metadata
|
||||||
|
.duration
|
||||||
|
.map(|d| format!("{}:{}", d.as_secs() / 60, d.as_secs() % 60));
|
||||||
|
|
||||||
let song_info = format!(
|
let song_info = format!(
|
||||||
"{} - {} ",
|
"{} - {} ({})",
|
||||||
metadata.artist.to_owned().unwrap_or_default(),
|
metadata.artist.to_owned().unwrap_or_default(),
|
||||||
metadata.track.to_owned().unwrap_or_default(),
|
metadata.track.to_owned().unwrap_or_default(),
|
||||||
|
duration.to_owned().unwrap_or_default(),
|
||||||
);
|
);
|
||||||
|
|
||||||
MessageBuilder::new()
|
MessageBuilder::new()
|
||||||
@@ -283,8 +288,8 @@ async fn queue_song(
|
|||||||
.push("Added ")
|
.push("Added ")
|
||||||
.push_bold_safe(song_info)
|
.push_bold_safe(song_info)
|
||||||
.push("to the queue")
|
.push("to the queue")
|
||||||
.push("\n")
|
// .push("\n")
|
||||||
.push(song.cover_art_url(client, 256)?)
|
// .push(song.cover_art_url(client, 256)?)
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user