Compare commits

...

3 commits

Author SHA1 Message Date
08b78467b5 cargo update 2024-06-24 14:28:58 +09:00
0ddd33a898 Version 0.4.13 2024-06-24 14:28:27 +09:00
8ebeac0499 Refactor time_to_percentage(...) 2024-06-24 14:27:44 +09:00
3 changed files with 29 additions and 33 deletions

54
Cargo.lock generated
View file

@ -233,7 +233,7 @@ dependencies = [
"regex", "regex",
"rustc-hash 1.1.0", "rustc-hash 1.1.0",
"shlex", "shlex",
"syn 2.0.67", "syn 2.0.68",
"which", "which",
] ]
@ -324,7 +324,7 @@ checksum = "1ee891b04274a59bd38b412188e24b849617b2e45a0fd8d057deb63e7403761b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -407,9 +407,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.99" version = "1.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" checksum = "c891175c3fb232128f48de6590095e59198bbeb8620c310be349bfc3afd12c7b"
dependencies = [ dependencies = [
"jobserver", "jobserver",
"libc", "libc",
@ -457,7 +457,7 @@ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
dependencies = [ dependencies = [
"glob", "glob",
"libc", "libc",
"libloading 0.8.3", "libloading 0.8.4",
] ]
[[package]] [[package]]
@ -491,7 +491,7 @@ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -748,7 +748,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
dependencies = [ dependencies = [
"libloading 0.8.3", "libloading 0.8.4",
] ]
[[package]] [[package]]
@ -1390,9 +1390,9 @@ dependencies = [
[[package]] [[package]]
name = "libloading" name = "libloading"
version = "0.8.3" version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"windows-targets 0.52.5", "windows-targets 0.52.5",
@ -1616,7 +1616,7 @@ dependencies = [
[[package]] [[package]]
name = "mpd_info_screen" name = "mpd_info_screen"
version = "0.4.12" version = "0.4.13"
dependencies = [ dependencies = [
"bindgen", "bindgen",
"clap", "clap",
@ -1753,7 +1753,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1814,7 +1814,7 @@ dependencies = [
"proc-macro-crate 1.3.1", "proc-macro-crate 1.3.1",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -1826,7 +1826,7 @@ dependencies = [
"proc-macro-crate 3.1.0", "proc-macro-crate 3.1.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -2030,7 +2030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -2341,7 +2341,7 @@ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -2405,7 +2405,7 @@ checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -2526,9 +2526,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.67" version = "2.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90" checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2573,7 +2573,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -2722,9 +2722,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.8.0" version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" checksum = "3ea73390fe27785838dcbf75b91b1d84799e28f1ce71e6f372a5dc2200c80de5"
[[package]] [[package]]
name = "vec_map" name = "vec_map"
@ -2775,7 +2775,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -2809,7 +2809,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -2979,7 +2979,7 @@ dependencies = [
"js-sys", "js-sys",
"khronos-egl", "khronos-egl",
"libc", "libc",
"libloading 0.8.3", "libloading 0.8.4",
"log", "log",
"metal", "metal",
"naga", "naga",
@ -3117,7 +3117,7 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -3128,7 +3128,7 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]
@ -3436,7 +3436,7 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.67", "syn 2.0.68",
] ]
[[package]] [[package]]

View file

@ -1,6 +1,6 @@
[package] [package]
name = "mpd_info_screen" name = "mpd_info_screen"
version = "0.4.12" version = "0.4.13"
edition = "2021" edition = "2021"
description = "Displays info on currently playing music from an MPD daemon" description = "Displays info on currently playing music from an MPD daemon"
license = "MIT" license = "MIT"

View file

@ -55,11 +55,7 @@ fn seconds_to_time(seconds: f64) -> String {
} }
fn time_to_percentage(total: f64, current: f64) -> String { fn time_to_percentage(total: f64, current: f64) -> String {
let result = (100.0f64 * current / total).round().to_string(); ((100.0f64 * current / total).round() as i32).to_string() + "%"
match result.split_once('.') {
Some((a, _)) => a.to_string() + "%",
None => result + "%",
}
} }
#[cfg(not(feature = "unicode_support"))] #[cfg(not(feature = "unicode_support"))]