Switch from MM:SS to HH:MM:SS duration representation if needed

* Contidionally switch from MM:SS to HH:MM:SS duration representation if needed.

* Correct tiny style issue.

* --amend
This commit is contained in:
Thomas Frans
2023-02-17 09:22:12 +01:00
committed by GitHub
parent 829b799cc5
commit a3c4989571
5 changed files with 27 additions and 15 deletions

View File

@@ -2,6 +2,7 @@ use crate::library::Library;
use crate::model::playable::Playable;
use crate::queue::Queue;
use crate::traits::{ListItem, ViewExt};
use crate::utils::ms_to_hms;
use chrono::{DateTime, Utc};
use rspotify::model::show::{FullEpisode, SimplifiedEpisode};
use rspotify::model::Id;
@@ -23,9 +24,7 @@ pub struct Episode {
impl Episode {
pub fn duration_str(&self) -> String {
let minutes = self.duration / 60_000;
let seconds = (self.duration / 1000) % 60;
format!("{minutes:02}:{seconds:02}")
ms_to_hms(self.duration)
}
}