From bb1a0128226edf1e15cf363d5fa893e79e1afa13 Mon Sep 17 00:00:00 2001 From: Marekkon5 Date: Fri, 23 Feb 2024 22:38:19 +0100 Subject: [PATCH] Update ID3 dep --- .gitignore | 6 +- Cargo.lock | 104 ++++++++++++++-------------- crates/onetagger-autotag/src/lib.rs | 6 +- crates/onetagger-tag/src/id3.rs | 4 +- 4 files changed, 62 insertions(+), 58 deletions(-) diff --git a/.gitignore b/.gitignore index a446abcb..a83e94d0 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,8 @@ test/ vc_redist.x64.exe assets/vc_redist.x64.exe crates/onetagger-python/pyembedded -*.dll \ No newline at end of file +*.dll + +perf.data +perf.data.old +flamegraph.svg \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index e341938f..debfb47b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1259,9 +1259,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.15.2" +version = "3.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3b1be7772ee4501dba05acbe66bb1e8760f6a6c474a36035631638e4415f130" +checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" [[package]] name = "bytecheck" @@ -1524,7 +1524,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.2", + "windows-targets 0.52.3", ] [[package]] @@ -3134,9 +3134,9 @@ dependencies = [ [[package]] name = "gif" -version = "0.12.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045" +checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" dependencies = [ "color_quant", "weezl", @@ -3637,7 +3637,7 @@ dependencies = [ "httpdate", "itoa 1.0.10", "pin-project-lite", - "socket2 0.5.5", + "socket2 0.5.6", "tokio", "tower-service", "tracing", @@ -3706,7 +3706,7 @@ dependencies = [ "http-body 1.0.0", "hyper 1.2.0", "pin-project-lite", - "socket2 0.5.5", + "socket2 0.5.6", "tokio", ] @@ -3762,9 +3762,9 @@ dependencies = [ [[package]] name = "image" -version = "0.24.8" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034bbe799d1909622a74d1193aa50147769440040ff36cb2baa947609b0a4e23" +checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" dependencies = [ "bytemuck", "byteorder", @@ -4218,9 +4218,9 @@ dependencies = [ [[package]] name = "lightningcss" -version = "1.0.0-alpha.53" +version = "1.0.0-alpha.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae8ba2b1b450cefc6a7a6ee93868992f56f662869b90404de2a7319da18640f" +checksum = "07d306844e5af1753490c420c0d6ae3d814b00725092d106332762827ca8f0fe" dependencies = [ "ahash 0.8.9", "bitflags 2.4.2", @@ -7449,12 +7449,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -8093,7 +8093,7 @@ dependencies = [ "mio", "num_cpus", "pin-project-lite", - "socket2 0.5.5", + "socket2 0.5.6", "tokio-macros", "windows-sys 0.48.0", ] @@ -9073,7 +9073,7 @@ dependencies = [ "windows-core", "windows-implement", "windows-interface", - "windows-targets 0.52.2", + "windows-targets 0.52.3", ] [[package]] @@ -9082,7 +9082,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.2", + "windows-targets 0.52.3", ] [[package]] @@ -9131,7 +9131,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.2", + "windows-targets 0.52.3", ] [[package]] @@ -9166,17 +9166,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d98532992affa02e52709d5b4d145a3668ae10d9081eea4a7f26f719a8476f71" +checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" dependencies = [ - "windows_aarch64_gnullvm 0.52.1", - "windows_aarch64_msvc 0.52.1", - "windows_i686_gnu 0.52.1", - "windows_i686_msvc 0.52.1", - "windows_x86_64_gnu 0.52.1", - "windows_x86_64_gnullvm 0.52.1", - "windows_x86_64_msvc 0.52.1", + "windows_aarch64_gnullvm 0.52.3", + "windows_aarch64_msvc 0.52.3", + "windows_i686_gnu 0.52.3", + "windows_i686_msvc 0.52.3", + "windows_x86_64_gnu 0.52.3", + "windows_x86_64_gnullvm 0.52.3", + "windows_x86_64_msvc 0.52.3", ] [[package]] @@ -9185,7 +9185,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75aa004c988e080ad34aff5739c39d0312f4684699d6d71fc8a198d057b8b9b4" dependencies = [ - "windows-targets 0.52.2", + "windows-targets 0.52.3", ] [[package]] @@ -9202,9 +9202,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.1" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7269c1442e75af9fa59290383f7665b828efc76c429cc0b7f2ecb33cf51ebae" +checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" [[package]] name = "windows_aarch64_msvc" @@ -9220,9 +9220,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.1" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f70ab2cebf332b7ecbdd98900c2da5298a8c862472fb35c75fc297eabb9d89b8" +checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" [[package]] name = "windows_i686_gnu" @@ -9238,9 +9238,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.1" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "679f235acf6b1639408c0f6db295697a19d103b0cdc88146aa1b992c580c647d" +checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" [[package]] name = "windows_i686_msvc" @@ -9256,9 +9256,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.1" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3480ac194b55ae274a7e135c21645656825da4a7f5b6e9286291b2113c94a78b" +checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" [[package]] name = "windows_x86_64_gnu" @@ -9274,9 +9274,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.1" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42c46bab241c121402d1cb47d028ea3680ee2f359dcc287482dcf7fdddc73363" +checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" [[package]] name = "windows_x86_64_gnullvm" @@ -9292,9 +9292,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.1" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc885a4332ee1afb9a1bacf11514801011725570d35675abc229ce7e3afe4d20" +checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" [[package]] name = "windows_x86_64_msvc" @@ -9310,9 +9310,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.1" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e440c60457f84b0bee09208e62acc7ade264b38c4453f6312b8c9ab1613e73c" +checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" [[package]] name = "winnow" @@ -9519,9 +9519,9 @@ dependencies = [ [[package]] name = "zbus" -version = "3.15.0" +version = "3.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c45d06ae3b0f9ba1fb2671268b975557d8f5a84bb5ec6e43964f87e763d8bca8" +checksum = "5acecd3f8422f198b1a2f954bcc812fe89f3fa4281646f3da1da7925db80085d" dependencies = [ "async-broadcast", "async-executor", @@ -9560,9 +9560,9 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "3.15.0" +version = "3.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4a1ba45ed0ad344b85a2bb5a1fe9830aed23d67812ea39a586e7d0136439c7d" +checksum = "2207eb71efebda17221a579ca78b45c4c5f116f074eb745c3a172e688ccf89f5" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -9713,9 +9713,9 @@ dependencies = [ [[package]] name = "zvariant" -version = "3.15.0" +version = "3.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44b291bee0d960c53170780af148dca5fa260a63cdd24f1962fa82e03e53338c" +checksum = "c5b4fcf3660d30fc33ae5cd97e2017b23a96e85afd7a1dd014534cd0bf34ba67" dependencies = [ "byteorder", "enumflags2", @@ -9727,9 +9727,9 @@ dependencies = [ [[package]] name = "zvariant_derive" -version = "3.15.0" +version = "3.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934d7a7dfc310d6ee06c87ffe88ef4eca7d3e37bb251dece2ef93da8f17d8ecd" +checksum = "0277758a8a0afc0e573e80ed5bfd9d9c2b48bd3108ffe09384f9f738c83f4a55" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -9740,9 +9740,9 @@ dependencies = [ [[package]] name = "zvariant_utils" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200" +checksum = "00bedb16a193cc12451873fee2a1bc6550225acece0e36f333e68326c73c8172" dependencies = [ "proc-macro2", "quote", diff --git a/crates/onetagger-autotag/src/lib.rs b/crates/onetagger-autotag/src/lib.rs index 6805a1ff..3d80b6cd 100644 --- a/crates/onetagger-autotag/src/lib.rs +++ b/crates/onetagger-autotag/src/lib.rs @@ -411,8 +411,8 @@ impl AudioFileInfoImpl for AudioFileInfo { // Parse filename if (title.is_none() || artists.is_none()) && filename_template.is_some() { let filename = path.as_ref().file_name().ok_or(anyhow!("Missing filename!"))?.to_str().ok_or(anyhow!("Missing filename"))?; - if let Some(captures) = filename_template.unwrap().captures(filename) { + // Title if title.is_none() { if let Some(m) = captures.name("title") { @@ -490,9 +490,9 @@ impl AudioFileInfoImpl for AudioFileInfo { let re = Regex::new("%[a-zA-Z0-9 ]+%").unwrap(); template = re.replace_all(&template, "(.+)").to_string(); // Extension - template = format!("{}\\.[a-zA-Z0-9]{{2,4}}$", template); + template = format!("{}\\.[a-zA-Z0-9]{{2,4}}$", template).trim().to_string(); // Final regex - Regex::new(template.trim()).ok() + Regex::new(&template).ok() } // Recognize on Shazam diff --git a/crates/onetagger-tag/src/id3.rs b/crates/onetagger-tag/src/id3.rs index e667a60f..299f99f8 100644 --- a/crates/onetagger-tag/src/id3.rs +++ b/crates/onetagger-tag/src/id3.rs @@ -64,7 +64,7 @@ impl ID3Tag { } // AIFF if ext == "aif" || ext == "aiff" { - let tag = Tag::read_from_aiff_path(path)?; + let tag = Tag::read_from_path(path)?; let version = tag.version(); return Ok(ID3Tag { tag, @@ -220,7 +220,7 @@ impl TagImpl for ID3Tag { .padding(2048) .write_to_path(&self.tag, path)?; }, - ID3AudioFormat::AIFF => self.tag.write_to_aiff_path(path, version)?, + ID3AudioFormat::AIFF => self.tag.write_to_path(path, version)?, ID3AudioFormat::WAV => crate::wav::write_wav(path, self.tag.clone(), version)?, }