Skip to content

Commit

Permalink
rustfmt, updated lofty
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorSatori committed Feb 8, 2024
1 parent b2083fa commit d89bf5b
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 50 deletions.
90 changes: 48 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tui = { version = "0.19", features = ['serde'] }
crossterm = "0.25"
glob = "0.3.1"
rodio = { version = "0.16.0", features = ["symphonia-all"]}
lofty = "0.11.0"
lofty = "0.18.2"
toml = "0.7.2"
serde = {version = "1.0.152", features = ["derive"]}
home = "0.5.4"
14 changes: 7 additions & 7 deletions src/helpers/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ impl Queue {
}

pub fn total_time(&self) -> String {

let days = self.total_time / SECONDS_PER_DAY;
let hours = (self.total_time % SECONDS_PER_DAY) / SECONDS_PER_HOUR;
let minutes = (self.total_time % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE;
Expand All @@ -55,21 +54,22 @@ impl Queue {

if days > 0 {
time_parts.push(format!("{days} days"));
}
}

if hours > 0 || days > 0 {
time_parts.push(format!("{hours} hours"));
}

if minutes > 0 || hours > 0 || days > 0 { // Include minutes if there are any hours or days
if minutes > 0 || hours > 0 || days > 0 {
// Include minutes if there are any hours or days
time_parts.push(format!("{minutes} minutes"));
}
if seconds > 0 || time_parts.is_empty() { // Always include seconds if there's no other component
if seconds > 0 || time_parts.is_empty() {
// Always include seconds if there's no other component
time_parts.push(format!("{seconds} seconds"));
}

format!(" Total Length: {} |", time_parts.join(" "))

}

pub fn is_empty(&self) -> bool {
Expand Down

0 comments on commit d89bf5b

Please sign in to comment.