From db89c513ed308d26e93437877009fbb01b107883 Mon Sep 17 00:00:00 2001 From: Lucy Date: Fri, 11 Oct 2024 19:09:02 -0400 Subject: [PATCH] Remove `round_to` from `audio_length`; update lockfile --- Cargo.lock | 32 ++++++++++++++++---------------- crates/audio/src/lib.rs | 11 ++--------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index edb2021..1e7377a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -552,9 +552,9 @@ checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cc" -version = "1.1.28" +version = "1.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" +checksum = "58e804ac3194a48bb129643eb1d62fcc20d18c6b8c181704489353d13120bcd1" dependencies = [ "jobserver", "libc", @@ -1881,9 +1881,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -3355,9 +3355,9 @@ dependencies = [ [[package]] name = "thread-counter" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92222e2f8c3d597afd37094b702f24ccd78e1c3bc7ede8ba60ef372f5c4128d9" +checksum = "0858a68bb16513eb4bcf70064757aafd544e843e033952172e0aa5d3f9dcc46c" dependencies = [ "parking_lot", ] @@ -3640,9 +3640,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -3651,9 +3651,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -3666,9 +3666,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3676,9 +3676,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -3689,9 +3689,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "webpki" diff --git a/crates/audio/src/lib.rs b/crates/audio/src/lib.rs index 3bfa50c..152a98a 100644 --- a/crates/audio/src/lib.rs +++ b/crates/audio/src/lib.rs @@ -19,8 +19,7 @@ use symphonia::core::{ }; #[byond_fn] -pub fn audio_length(path: PathBuf, round_to: Option) -> Option { - let round_to = round_to.unwrap_or(5); +pub fn audio_length(path: PathBuf) -> Option { // Open the file let file = File::open(path).ok()?; @@ -50,11 +49,5 @@ pub fn audio_length(path: PathBuf, round_to: Option) -> Option { })?; // Convert to deciseconds - let deciseconds = (duration.as_secs_f64() * 10.0).ceil() as u32; - - // Round to the specified number of deciseconds - match round_to { - 0 => Some(deciseconds), - _ => Some(((deciseconds + round_to - 1) / round_to) * round_to), - } + Some((duration.as_secs_f64() * 10.0).ceil() as u32) }