From 41cf0effd616420b5ed4c0942eb97761d78b2f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Wed, 4 May 2022 19:45:20 +0200 Subject: [PATCH 1/7] Update ImagePipe, fixes music finder --- .github/workflows/linux.yml | 2 +- Cargo.lock | 276 +++++++++++++---------------- README.md | 4 +- czkawka_core/Cargo.toml | 6 +- czkawka_core/src/bad_extensions.rs | 52 +++++- czkawka_core/src/common.rs | 4 +- czkawka_core/src/same_music.rs | 29 ++- instructions/Compilation.md | 2 +- 8 files changed, 185 insertions(+), 190 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 00864f6f3..02ce4e13a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -130,7 +130,7 @@ jobs: linux-gui: strategy: matrix: - toolchain: [ stable, 1.57.0 ] + toolchain: [ stable, 1.60.0 ] type: [ release ] runs-on: ubuntu-20.04 steps: diff --git a/Cargo.lock b/Cargo.lock index a41298a48..cefe693dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,7 +20,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cipher", "cpufeatures", "opaque-debug", @@ -78,12 +78,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.2" @@ -199,21 +193,6 @@ dependencies = [ "triple_accel", ] -[[package]] -name = "blake3" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "cc", - "cfg-if 0.1.10", - "constant_time_eq", - "crypto-mac", - "digest 0.9.0", -] - [[package]] name = "blake3" version = "1.3.1" @@ -221,9 +200,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec", "cc", - "cfg-if 1.0.0", + "cfg-if", "constant_time_eq", "digest 0.10.3", ] @@ -299,9 +278,9 @@ dependencies = [ [[package]] name = "cairo-rs" -version = "0.15.10" +version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "129e928d3eda625f53ce257589efbe5143416875fd01bddd08c8c6feb8b9962b" +checksum = "62be3562254e90c1c6050a72aa638f6315593e98c5cdaba9017cedbabf0a5dee" dependencies = [ "bitflags", "cairo-sys-rs", @@ -364,12 +343,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -438,9 +411,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "combine" -version = "4.6.3" +version = "4.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50b727aacc797f9fc28e355d21f34709ac4fc9adecfe470ad07b8f4464f53062" +checksum = "2a604e93b79d1808327a6fca85a6f2d69de66461e7620f5a4cbf5fb4d1d7c948" dependencies = [ "bytes", "memchr", @@ -517,7 +490,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -526,7 +499,7 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -536,7 +509,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] @@ -548,7 +521,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", "lazy_static", "memoffset", @@ -561,7 +534,7 @@ version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "lazy_static", ] @@ -575,16 +548,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "czkawka_cli" version = "4.1.0" @@ -601,7 +564,7 @@ dependencies = [ "bincode", "bitflags", "bk-tree", - "blake3 1.3.1", + "blake3", "crc32fast", "crossbeam-channel", "directories-next", @@ -611,7 +574,7 @@ dependencies = [ "humansize", "i18n-embed", "i18n-embed-fl", - "image 0.24.1", + "image 0.24.2", "image_hasher", "imagepipe", "infer", @@ -646,7 +609,7 @@ dependencies = [ "humansize", "i18n-embed", "i18n-embed-fl", - "image 0.24.1", + "image 0.24.2", "image_hasher", "once_cell", "open", @@ -693,13 +656,13 @@ dependencies = [ [[package]] name = "dashmap" -version = "5.2.0" +version = "5.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c" +checksum = "391b56fbd302e585b7a9494fb70e40949567b1cf9003a8e4a6041a1687c26573" dependencies = [ - "cfg-if 1.0.0", - "num_cpus", - "parking_lot 0.12.0", + "cfg-if", + "hashbrown 0.12.1", + "lock_api", ] [[package]] @@ -747,7 +710,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "dirs-sys-next", ] @@ -770,9 +733,9 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "enumn" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e58b112d5099aa0857c5d05f0eacab86406dd8c0f85fe5d320a13256d29ecf4" +checksum = "052bc8773a98bd051ff37db74a8a25f00e6bfa2cbd03373390c72e9f7afbf344" dependencies = [ "proc-macro2", "quote", @@ -843,7 +806,7 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crc32fast", "libc", "miniz_oxide 0.5.1", @@ -1025,9 +988,9 @@ dependencies = [ [[package]] name = "gdk-pixbuf" -version = "0.15.10" +version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678516f1baef591d270ca10587c01a12542a731a7879cc62391a18191a470831" +checksum = "ad38dd9cc8b099cceecdf41375bb6d481b1b5a7cd5cd603e10a69a9383f8619a" dependencies = [ "bitflags", "gdk-pixbuf-sys", @@ -1082,7 +1045,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "libc", "wasi", @@ -1101,9 +1064,9 @@ dependencies = [ [[package]] name = "gio" -version = "0.15.10" +version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76cd21a7a674ea811749661012512b0ba5237ba404ccbcab2850db5537549b64" +checksum = "0f132be35e05d9662b9fa0fee3f349c6621f7782e0105917f4cc73c1bf47eceb" dependencies = [ "bitflags", "futures-channel", @@ -1131,9 +1094,9 @@ dependencies = [ [[package]] name = "glib" -version = "0.15.10" +version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a826fad715b57834920839d7a594c3b5e416358c7d790bdaba847a40d7c1d96d" +checksum = "bd124026a2fa8c33a3d17a3fe59c103f2d9fa5bd92c19e029e037736729abeab" dependencies = [ "bitflags", "futures-channel", @@ -1151,9 +1114,9 @@ dependencies = [ [[package]] name = "glib-macros" -version = "0.15.10" +version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac4d47c544af67747652ab1865ace0ffa1155709723ac4f32e97587dd4735b2" +checksum = "25a68131a662b04931e71891fb14aaf65ee4b44d08e8abc10f49e77418c86c64" dependencies = [ "anyhow", "heck 0.4.0", @@ -1193,9 +1156,9 @@ dependencies = [ [[package]] name = "gtk" -version = "0.15.4" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f2d1326b36af927fe46ae2f89a8fec38c6f0d279ebc5ef07ffeeabb70300bfc" +checksum = "92e3004a2d5d6d8b5057d2b57b3712c9529b62e82c77f25c1fecde1fd5c23bd0" dependencies = [ "atk", "bitflags", @@ -1264,6 +1227,12 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +[[package]] +name = "hashbrown" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" + [[package]] name = "heck" version = "0.3.3" @@ -1405,16 +1374,16 @@ dependencies = [ [[package]] name = "image" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db207d030ae38f1eb6f240d5a1c1c88ff422aa005d10f8c6c6fc5e75286ab30e" +checksum = "28edd9d7bc256be2502e325ac0628bde30b7001b9b52e0abe31a1a9dc2701212" dependencies = [ "bytemuck", "byteorder", "color_quant", "exr", "gif", - "jpeg-decoder 0.2.4", + "jpeg-decoder 0.2.5", "num-iter", "num-rational 0.4.0", "num-traits", @@ -1430,7 +1399,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c887ed1c9c32854da1c3c9539711814ae48e53926400c5e1ceac0f0491f59a72" dependencies = [ "base64 0.20.0-alpha.1", - "image 0.24.1", + "image 0.24.2", "rustdct 0.5.1", "serde", "transpose", @@ -1438,16 +1407,17 @@ dependencies = [ [[package]] name = "imagepipe" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f85c5d23491dee7e51d21b04f4116352899174943026278a2d91db13ffc142cd" +checksum = "7af2d89e882e4be2e9b1ef50454aaa8da2c58924960e24521145f16ea4f7fd1c" dependencies = [ "bincode", - "blake3 0.3.8", - "image 0.23.14", + "blake3", + "image 0.24.2", "lazy_static", "log", "multicache", + "num-traits", "rawloader", "rayon", "serde", @@ -1462,7 +1432,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.11.2", ] [[package]] @@ -1489,7 +1459,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1558,9 +1528,9 @@ dependencies = [ [[package]] name = "jpeg-decoder" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744c24117572563a98a7e9168a5ac1ee4a1ca7f702211258797bbe0ed0346c3c" +checksum = "be7ef4b99870f0c9f2fc2f20dbef72707e2bcca675bb9196734cf433e999b0c5" dependencies = [ "rayon", ] @@ -1605,9 +1575,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.124" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50" +checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" [[package]] name = "libloading" @@ -1615,7 +1585,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "winapi", ] @@ -1650,13 +1620,13 @@ dependencies = [ [[package]] name = "lofty" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45967792fc531850b544d0e50065ffda8ce814a0d2142a6cbe7009961964e17c" +checksum = "e9b0ac50022c34427688f83800b865c8a324ba2fe9f41f232b899b7517b3786c" dependencies = [ "base64 0.13.0", "byteorder", - "cfg-if 1.0.0", + "cfg-if", "flate2", "ogg_pager", "once_cell", @@ -1665,11 +1635,11 @@ dependencies = [ [[package]] name = "log" -version = "0.4.16" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1692,9 +1662,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" @@ -1857,7 +1827,7 @@ checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" dependencies = [ "bitflags", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset", ] @@ -1894,9 +1864,9 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", "num-traits", @@ -1904,9 +1874,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.42" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ "autocfg", "num-integer", @@ -1937,9 +1907,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", ] @@ -2015,13 +1985,13 @@ dependencies = [ [[package]] name = "oboe" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2463c8f2e19b4e0d0710a21f8e4011501ff28db1c95d7a5482a553b2100502d2" +checksum = "27f63c358b4fa0fbcfefd7c8be5cfc39c08ce2389f5325687e7762a48d30a5c1" dependencies = [ "jni", "ndk", - "ndk-glue", + "ndk-context", "num-derive", "num-traits", "oboe-sys", @@ -2068,9 +2038,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "open" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9213e7b66aa06a7722828ee2980c1adff22a3922b582baaa1e62e30ca2a6c018" +checksum = "e0524af9508f9b5c4eb41dce095860456727748f63b478d625f119a70e0d764a" dependencies = [ "pathdiff", "winapi", @@ -2119,7 +2089,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" dependencies = [ "lock_api", - "parking_lot_core 0.9.2", + "parking_lot_core 0.9.3", ] [[package]] @@ -2128,7 +2098,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", "redox_syscall", @@ -2138,11 +2108,11 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "995f667a6c822200b0433ac218e05582f0e2efa1b922a3fd2fbaadc5f87bab37" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", @@ -2221,9 +2191,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -2511,7 +2481,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.7", + "semver 1.0.9", ] [[package]] @@ -2603,9 +2573,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4" +checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd" [[package]] name = "semver-parser" @@ -2618,18 +2588,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" dependencies = [ "proc-macro2", "quote", @@ -2638,9 +2608,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.79" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" +checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" dependencies = [ "itoa", "ryu", @@ -2649,9 +2619,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0" +checksum = "707d15895415db6628332b737c838b88c598522e4dc70647e59b72312924aebc" dependencies = [ "indexmap", "ryu", @@ -2665,7 +2635,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c77f4e7f65455545c2153c1253d25056825e77ee2533f0e41deb65a93a34852f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.3", ] @@ -2677,7 +2647,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug", @@ -2689,7 +2659,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.3", ] @@ -2788,9 +2758,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.91" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d" +checksum = "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52" dependencies = [ "proc-macro2", "quote", @@ -2816,7 +2786,7 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", "redox_syscall", @@ -2835,18 +2805,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" dependencies = [ "proc-macro2", "quote", @@ -2880,7 +2850,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7cfada0986f446a770eca461e8c6566cb879682f7d687c8348aa0c857bd52286" dependencies = [ "flate2", - "jpeg-decoder 0.2.4", + "jpeg-decoder 0.2.5", "weezl", ] @@ -2921,9 +2891,9 @@ checksum = "29738eedb4388d9ea620eeab9384884fc3f06f586a2eddb56bedc5885126c7c1" [[package]] name = "tinyvec" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -3031,9 +3001,9 @@ checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] name = "uuid" @@ -3099,7 +3069,7 @@ version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -3196,9 +3166,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.34.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5acdd78cb4ba54c0045ac14f62d8f94a03d10047904ae2a40afa1e99d8f70825" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ "windows_aarch64_msvc", "windows_i686_gnu", @@ -3209,33 +3179,33 @@ dependencies = [ [[package]] name = "windows_aarch64_msvc" -version = "0.34.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] name = "windows_i686_gnu" -version = "0.34.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] name = "windows_i686_msvc" -version = "0.34.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] name = "windows_x86_64_gnu" -version = "0.34.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] name = "windows_x86_64_msvc" -version = "0.34.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] name = "xxhash-rust" diff --git a/README.md b/README.md index bfd403c64..9ec5450cb 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ You can help by creating: - Bug reports - memory leaks, unexpected behavior, crashes - Feature proposals - proposal to change/add/delete some features - Pull Requests - implementing a new feature yourself or fixing bugs. - If the change is bigger, then it's a good idea to open a new issue to discuss changes. + If the change is bigger, then it's a good idea to open a new issue to discuss changes, but issues with label `PR welcome` are already checked and accepted to implement. - Documentation - There is an [instruction](instructions/Instruction.md) which you can improve. - Translations - Instruction how to translate files is available [here](instructions/Translations.md) @@ -178,5 +178,7 @@ Big thanks to Pádraig Brady, creator of fantastic FSlint, because without his w Thanks also to all the people who create patches for this program, make it available on other systems, create videos, articles about it etc. +Also I really appreciate work of people that create crates on which Czkawka basing and for that I try to report bugs to make it even better. + ## Donations If you are using the app, I would appreciate a donation for its further development, which can be done [here](https://github.com/sponsors/qarmin). diff --git a/czkawka_core/Cargo.toml b/czkawka_core/Cargo.toml index 95ba6b35b..2b67972f3 100644 --- a/czkawka_core/Cargo.toml +++ b/czkawka_core/Cargo.toml @@ -53,12 +53,12 @@ serde_json = "1.0.79" # Language i18n-embed = { version = "0.13.4", features = ["fluent-system", "desktop-requester"] } i18n-embed-fl = "0.6.4" -rust-embed = "6.3.0" +rust-embed = "6.4.0" once_cell = "1.10.0" # Raw image files -rawloader = "0.37.0" -imagepipe = "0.4.0" +rawloader = "0.37.1" +imagepipe = "0.5.0" # Checking for invalid extensions mime_guess = "2.0.4" diff --git a/czkawka_core/src/bad_extensions.rs b/czkawka_core/src/bad_extensions.rs index 7758ff3c5..86bd1b4ca 100644 --- a/czkawka_core/src/bad_extensions.rs +++ b/czkawka_core/src/bad_extensions.rs @@ -21,6 +21,8 @@ use crate::common_items::ExcludedItems; use crate::common_messages::Messages; use crate::common_traits::*; +static DISABLED_EXTENSIONS: &[&str] = &["file", "cache", "bak"]; // Such files can have any type inside + // This adds several workarounds for bugs/invalid recognizing types by external libraries // ("real_content_extension", "current_file_extension") static WORKAROUNDS: &[(&str, &str)] = &[ @@ -43,9 +45,14 @@ static WORKAROUNDS: &[(&str, &str)] = &[ ("exe", "sys"), ("exe", "tlb"), ("exe", "vxd"), - // Other - ("exe", "doc"), // Not sure whe docx is not recognized ("exe", "sys"), + ("exe", "mod16"), + // Other + ("zip", "odg"), // Libreoffice + ("ods", "ots"), // Libreoffice + ("exe", "efi"), + ("sh", "sample"), // Git + ("exe", "signed"), ("gz", "blend"), ("gz", "crate"), ("gz", "svgz"), @@ -53,16 +60,28 @@ static WORKAROUNDS: &[(&str, &str)] = &[ ("html", "md"), ("html", "svg"), // Quite strange, but yes it works ("jpg", "jfif"), + ("mobi", "azw3"), ("obj", "o"), + ("obj", "bin"), ("odp", "otp"), ("odt", "ott"), ("ogg", "ogv"), ("pptx", "ppsx"), ("sh", "bash"), ("sh", "py"), + ("sh", "pyx"), + ("xml", "sopcinfo"), // Quartus + ("xml", "bsp"), // Quartus + ("xml", "fb2"), + ("xml", "user"), // Qtcreator ("sh", "rs"), + ("sh", "pl"), // Gnome/Linux + ("sh", "pm"), // Gnome/Linux + ("xml", "cbp"), // CodeBlocks config ("xml", "cmb"), + ("xml", "cfg"), ("xml", "conf"), + ("xml", "config"), ("xml", "dae"), ("xml", "docbook"), ("xml", "gir"), @@ -71,16 +90,29 @@ static WORKAROUNDS: &[(&str, &str)] = &[ ("xml", "kdenlive"), ("xml", "lang"), ("xml", "svg"), - ("xml", "ui"), - ("xml", "vcproj"), + ("xml", "ui"), // Cambalache, Glade + ("xml", "vcproj"), // VisualStudio + ("xml", "iml"), // Intelij Idea + ("xml", "manifest"), + ("xml", "xcd"), // Libreoffice files + ("xml", "policy"), + ("xml", "qsys"), // Quartus + ("xml", "xba"), // Libreoffice ("zip", "apk"), + ("zip", "doc"), + ("zip", "docx"), ("zip", "dat"), - ("zip", "jar"), - ("zip", "kra"), + ("zip", "jar"), // Java + ("zip", "kra"), // Krita ("zip", "nupkg"), ("zip", "pptx"), ("zip", "whl"), ("zip", "xpi"), + ("zip", "zcos"), + ("zip", "cbr"), // Komiksy + // Probably bug in external library + ("exe", "doc"), // Not sure whe doc is not recognized + ("exe", "xls"), // Not sure whe xls is not recognized ]; #[derive(Clone)] @@ -285,8 +317,6 @@ impl BadExtensions { return None; } - let current_extension; - // Check what exactly content file contains let kind = match infer::get_from_path(&file_entry.path) { Ok(k) => match k { @@ -298,8 +328,12 @@ impl BadExtensions { let proper_extension = kind.extension(); // Extract current extension from file + let current_extension; if let Some(extension) = file_entry.path.extension() { let extension = extension.to_string_lossy().to_lowercase(); + if DISABLED_EXTENSIONS.contains(&extension.as_str()) { + return Some(None); + } // Text longer than 10 characters is not considered as extension if extension.len() > 10 { current_extension = "".to_string(); @@ -335,7 +369,7 @@ impl BadExtensions { } } - let mut guessed_multiple_extensions = "".to_string(); + let mut guessed_multiple_extensions = format!("({}) - ", proper_extension); for ext in &all_available_extensions { guessed_multiple_extensions.push_str(ext); guessed_multiple_extensions.push(','); diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 27dc6ec59..61ffb1e78 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -86,11 +86,9 @@ pub fn get_dynamic_image_from_raw_image(path: impl AsRef + std::fmt::Debug } }; - let width = raw.width; - let height = raw.height; let source = ImageSource::Raw(raw); - let mut pipeline = match Pipeline::new_from_source(source, width, height, true) { + let mut pipeline = match Pipeline::new_from_source(source) { Ok(pipeline) => pipeline, Err(_e) => { return None; diff --git a/czkawka_core/src/same_music.rs b/czkawka_core/src/same_music.rs index 96f8ffc9d..b5bfc178b 100644 --- a/czkawka_core/src/same_music.rs +++ b/czkawka_core/src/same_music.rs @@ -372,26 +372,18 @@ impl SameMusic { let properties = tagged_file.properties(); - let mut track_title; - let mut track_artist; - let mut year; - let mut length; - let mut genre; + let mut track_title = "".to_string(); + let mut track_artist = "".to_string(); + let mut year = "".to_string(); + let mut genre = "".to_string(); let bitrate = properties.audio_bitrate().unwrap_or(0); + let mut length = properties.duration().as_millis().to_string(); - let tag = match tagged_file.primary_tag() { - Some(t) => t, - None => { - // println!("File {} don't have valid tag", path); - return Some(Some(music_entry)); - } - }; - { + if let Some(tag) = tagged_file.primary_tag() { track_title = tag.get_string(&ItemKey::TrackTitle).unwrap_or("").to_string(); track_artist = tag.get_string(&ItemKey::TrackArtist).unwrap_or("").to_string(); year = tag.get_string(&ItemKey::Year).unwrap_or("").to_string(); - length = tag.get_string(&ItemKey::Length).unwrap_or("").to_string(); genre = tag.get_string(&ItemKey::Genre).unwrap_or("").to_string(); } @@ -411,16 +403,12 @@ impl SameMusic { year = tag_value.to_string(); } } - if length.is_empty() { - if let Some(tag_value) = tag.get_string(&ItemKey::Length) { - length = tag_value.to_string(); - } - } if genre.is_empty() { if let Some(tag_value) = tag.get_string(&ItemKey::Genre) { genre = tag_value.to_string(); } } + // println!("{:?}", tag.items()); } // println!("{:?}", tag.items()); @@ -431,6 +419,9 @@ impl SameMusic { let seconds = (length_number % 1000) * 6 / 100; if minutes != 0 || seconds != 0 { length = format!("{}:{:02}", minutes, seconds); + } else if length_number > 0 { + // That means, that audio have length smaller that second, but length is properly read + length = "0:01".to_string(); } else { length = "".to_string(); } diff --git a/instructions/Compilation.md b/instructions/Compilation.md index 51ee4bdf2..84dbd8b14 100644 --- a/instructions/Compilation.md +++ b/instructions/Compilation.md @@ -9,7 +9,7 @@ FFmpeg is not included here, because is not needed to build because it is dynami | Program | Min | What for | |---------|------|-------------------------------------------------------------------------------| -| Rust | 1.57 | Czkawka, aims to support the latest available version of Rust on Ubuntu 20.04 | +| Rust | 1.60 | Czkawka, aims to support the latest available version of Rust on Ubuntu 20.04 | | GTK | 3.24 | Only for the `GTK` backend | #### Debian / Ubuntu From 1135490a204e9650c744473ae13edaa21f7cb5c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 6 May 2022 22:55:48 +0200 Subject: [PATCH 2/7] Change rodio library, enable by default checking for broken audio files --- Cargo.lock | 719 +++++++++---------------------- README.md | 4 +- czkawka_core/Cargo.toml | 9 +- czkawka_core/src/broken_files.rs | 18 +- czkawka_core/src/same_music.rs | 8 +- instructions/Instruction.md | 7 +- 6 files changed, 214 insertions(+), 551 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cefe693dd..8a98c57c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,28 +35,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "alsa" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5915f52fe2cf65e83924d037b6c5290b7cee097c6b5c8700746e6168a343fd6b" -dependencies = [ - "alsa-sys", - "bitflags", - "libc", - "nix", -] - -[[package]] -name = "alsa-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" -dependencies = [ - "libc", - "pkg-config", -] - [[package]] name = "ansi_term" version = "0.12.1" @@ -119,6 +97,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "audio_checker" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20234f0225492ef6ee5b9258277720993b343c694873da45b3c46221816d8831" +dependencies = [ + "symphonia", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -152,25 +139,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bindgen" -version = "0.59.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" -dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", -] - [[package]] name = "bit_field" version = "0.10.1" @@ -249,12 +217,6 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "bytes" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" - [[package]] name = "bzip2" version = "0.4.3" @@ -305,24 +267,6 @@ name = "cc" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" -dependencies = [ - "jobserver", -] - -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] [[package]] name = "cfb" @@ -371,17 +315,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "clang-sys" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21" -dependencies = [ - "glob", - "libc", - "libloading", -] - [[package]] name = "clap" version = "2.34.0" @@ -397,84 +330,18 @@ dependencies = [ "vec_map", ] -[[package]] -name = "claxon" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bfbf56724aa9eca8afa4fcfadeb479e722935bb2a0900c2d37e0cc477af0688" - [[package]] name = "color_quant" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" -[[package]] -name = "combine" -version = "4.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a604e93b79d1808327a6fca85a6f2d69de66461e7620f5a4cbf5fb4d1d7c948" -dependencies = [ - "bytes", - "memchr", -] - [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - -[[package]] -name = "coreaudio-rs" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11894b20ebfe1ff903cbdc52259693389eea03b94918a2def2c30c3bf227ad88" -dependencies = [ - "bitflags", - "coreaudio-sys", -] - -[[package]] -name = "coreaudio-sys" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dff444d80630d7073077d38d40b4501fd518bd2b922c2a55edcc8b0f7be57e6" -dependencies = [ - "bindgen", -] - -[[package]] -name = "cpal" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74117836a5124f3629e4b474eed03e479abaf98988b4bb317e29f08cfe0e4116" -dependencies = [ - "alsa", - "core-foundation-sys", - "coreaudio-rs", - "jni", - "js-sys", - "lazy_static", - "libc", - "mach", - "ndk", - "ndk-glue", - "nix", - "oboe", - "parking_lot 0.11.2", - "stdweb", - "thiserror", - "web-sys", - "winapi", -] - [[package]] name = "cpufeatures" version = "0.2.2" @@ -561,6 +428,7 @@ dependencies = [ name = "czkawka_core" version = "4.1.0" dependencies = [ + "audio_checker", "bincode", "bitflags", "bk-tree", @@ -583,7 +451,6 @@ dependencies = [ "once_cell", "rawloader", "rayon", - "rodio", "rust-embed", "serde", "serde_json", @@ -619,41 +486,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core", - "quote", - "syn", -] - [[package]] name = "dashmap" version = "5.3.3" @@ -731,6 +563,15 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "encoding_rs" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +dependencies = [ + "cfg-if", +] + [[package]] name = "enumn" version = "0.1.4" @@ -1266,12 +1107,6 @@ dependencies = [ "digest 0.10.3", ] -[[package]] -name = "hound" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549" - [[package]] name = "humansize" version = "1.1.1" @@ -1306,7 +1141,7 @@ dependencies = [ "lazy_static", "locale_config", "log", - "parking_lot 0.12.0", + "parking_lot", "rust-embed", "thiserror", "unic-langid", @@ -1347,12 +1182,6 @@ dependencies = [ "syn", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "image" version = "0.23.14" @@ -1488,35 +1317,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" -[[package]] -name = "jni" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" -dependencies = [ - "cesu8", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", -] - -[[package]] -name = "jni-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - -[[package]] -name = "jobserver" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" -dependencies = [ - "libc", -] - [[package]] name = "jpeg-decoder" version = "0.1.22" @@ -1550,45 +1350,18 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "lebe" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7efd1d698db0759e6ef11a7cd44407407399a910c774dd804c64c032da7826ff" -[[package]] -name = "lewton" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "777b48df9aaab155475a83a7df3070395ea1ac6902f5cd062b8f2b028075c030" -dependencies = [ - "byteorder", - "ogg", - "tinyvec", -] - [[package]] name = "libc" version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" -[[package]] -name = "libloading" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" -dependencies = [ - "cfg-if", - "winapi", -] - [[package]] name = "linked-hash-map" version = "0.5.4" @@ -1642,15 +1415,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - [[package]] name = "malloc_buf" version = "0.0.6" @@ -1691,32 +1455,6 @@ dependencies = [ "unicase", ] -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "minimp3" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985438f75febf74c392071a975a29641b420dd84431135a6e6db721de4b74372" -dependencies = [ - "minimp3-sys", - "slice-deque", - "thiserror", -] - -[[package]] -name = "minimp3-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e21c73734c69dc95696c9ed8926a2b393171d98b3f5f5935686a26a487ab9b90" -dependencies = [ - "cc", -] - [[package]] name = "miniz_oxide" version = "0.3.7" @@ -1763,85 +1501,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "ndk" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" -dependencies = [ - "bitflags", - "jni-sys", - "ndk-sys", - "num_enum", - "thiserror", -] - -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - -[[package]] -name = "ndk-glue" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d0c4a7b83860226e6b4183edac21851f05d5a51756e97a1144b7f5a6b63e65f" -dependencies = [ - "lazy_static", - "libc", - "log", - "ndk", - "ndk-context", - "ndk-macro", - "ndk-sys", -] - -[[package]] -name = "ndk-macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" -dependencies = [ - "darling", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "ndk-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" -dependencies = [ - "jni-sys", -] - -[[package]] -name = "nix" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" -dependencies = [ - "bitflags", - "cc", - "cfg-if", - "libc", - "memoffset", -] - -[[package]] -name = "nom" -version = "7.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" -dependencies = [ - "memchr", - "minimal-lexical", -] - [[package]] name = "num-complex" version = "0.3.1" @@ -1851,17 +1510,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "num-integer" version = "0.1.45" @@ -1924,32 +1572,11 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "num_threads" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aba1801fb138d8e85e11d0fc70baf4fe1cdfffda7c6cd34a854905df588e5ed0" +checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" dependencies = [ "libc", ] @@ -1983,38 +1610,6 @@ dependencies = [ "objc", ] -[[package]] -name = "oboe" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f63c358b4fa0fbcfefd7c8be5cfc39c08ce2389f5325687e7762a48d30a5c1" -dependencies = [ - "jni", - "ndk", - "ndk-context", - "num-derive", - "num-traits", - "oboe-sys", -] - -[[package]] -name = "oboe-sys" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3370abb7372ed744232c12954d920d1a40f1c4686de9e79e800021ef492294bd" -dependencies = [ - "cc", -] - -[[package]] -name = "ogg" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6951b4e8bf21c8193da321bcce9c9dd2e13c858fe078bf9054a288b419ae5d6e" -dependencies = [ - "byteorder", -] - [[package]] name = "ogg_pager" version = "0.3.2" @@ -2071,17 +1666,6 @@ dependencies = [ "system-deps", ] -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.5", -] - [[package]] name = "parking_lot" version = "0.12.0" @@ -2089,21 +1673,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" dependencies = [ "lock_api", - "parking_lot_core 0.9.3", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -2154,12 +1724,6 @@ dependencies = [ "sha2 0.10.2", ] -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "pest" version = "2.1.3" @@ -2282,9 +1846,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" +checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa" dependencies = [ "unicode-xid", ] @@ -2413,19 +1977,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rodio" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0939e9f626e6c6f1989adb6226a039c855ca483053f0ee7c98b90e41cf731e" -dependencies = [ - "claxon", - "cpal", - "hound", - "lewton", - "minimp3", -] - [[package]] name = "rust-embed" version = "6.4.0" @@ -2664,29 +2215,12 @@ dependencies = [ "digest 0.10.3", ] -[[package]] -name = "shlex" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" - [[package]] name = "slab" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" -[[package]] -name = "slice-deque" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31ef6ee280cdefba6d2d0b4b78a84a1c1a3f3a4cec98c2d4231c8bc225de0f25" -dependencies = [ - "libc", - "mach", - "winapi", -] - [[package]] name = "smallvec" version = "1.8.0" @@ -2702,12 +2236,6 @@ dependencies = [ "lock_api", ] -[[package]] -name = "stdweb" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" - [[package]] name = "strength_reduce" version = "0.2.3" @@ -2756,6 +2284,178 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "symphonia" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb30457ee7a904dae1e4ace25156dcabaf71e425db318e7885267f09cd8fb648" +dependencies = [ + "lazy_static", + "symphonia-bundle-flac", + "symphonia-bundle-mp3", + "symphonia-codec-aac", + "symphonia-codec-alac", + "symphonia-codec-pcm", + "symphonia-codec-vorbis", + "symphonia-core", + "symphonia-format-isomp4", + "symphonia-format-mkv", + "symphonia-format-ogg", + "symphonia-format-wav", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-bundle-flac" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f34f8f90825ee2692df0ee64981312267d6cf640358c3db7a4805d1805340665" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-bundle-mp3" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9130cae661447f234b58759d74d23500e9c95697b698589b34196cb0fb488a61" +dependencies = [ + "bitflags", + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-codec-aac" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96671dbcf83a4415e899812c5820dd26f48b9a6fece8b8d680e3004553080468" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-alac" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a95d0cc9d94c55d9467e71e26990e509bd5a602fabde3ee422d87f77bbda860a" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-pcm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0812a197602dff1f963ff212f174c4aa4d9b695d6511ba7a8fe2470296cf8310" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-vorbis" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "746fc459966b37e277565f9632e5ffd6cbd83d9381152727123f68484cb8f9c4" +dependencies = [ + "log", + "symphonia-core", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edcb254d25e02b688b6f8a290a778153fa5f29674ac50773d03e0a16060391d" +dependencies = [ + "arrayvec", + "bitflags", + "bytemuck", + "lazy_static", + "log", +] + +[[package]] +name = "symphonia-format-isomp4" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a335816c1840bf3ce92b968a93b7b5c14a5d74737ad9ed63567ea451eac1951" +dependencies = [ + "encoding_rs", + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-mkv" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901a52e62285b3794a3ecb9b8a00b1d92d639e0dabf51eac0823a16493752726" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-ogg" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00f5b92a2a6370873d9dbe3326dad1bf795b3151efcadca6e5f47d732499a518" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-wav" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b2016576a9f7e5e95f9354993116458170a9077845a908ee67a4c81e8072c0" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-metadata" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04ee665c99fd2b919b87261c86a5312e996b720ca142646a163d9583e72bd0e" +dependencies = [ + "encoding_rs", + "lazy_static", + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-utils-xiph" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abadfa53359fa437836f2554a0019dd06bfdf742fbb735d0645db3b6c5a763e0" +dependencies = [ + "symphonia-core", + "symphonia-metadata", +] + [[package]] name = "syn" version = "1.0.92" @@ -2889,21 +2589,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29738eedb4388d9ea620eeab9384884fc3f06f586a2eddb56bedc5885126c7c1" -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - [[package]] name = "toml" version = "0.5.9" @@ -3117,16 +2802,6 @@ version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" -[[package]] -name = "web-sys" -version = "0.3.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "weezl" version = "0.1.6" diff --git a/README.md b/README.md index 9ec5450cb..ba14ee11a 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ You can help by creating: - Bug reports - memory leaks, unexpected behavior, crashes - Feature proposals - proposal to change/add/delete some features - Pull Requests - implementing a new feature yourself or fixing bugs. - If the change is bigger, then it's a good idea to open a new issue to discuss changes, but issues with label `PR welcome` are already checked and accepted to implement. + If the change is bigger, then it's a good idea to open a new issue to discuss changes, but issues with label `PR welcome` are already checked and accepted. - Documentation - There is an [instruction](instructions/Instruction.md) which you can improve. - Translations - Instruction how to translate files is available [here](instructions/Translations.md) @@ -178,7 +178,7 @@ Big thanks to Pádraig Brady, creator of fantastic FSlint, because without his w Thanks also to all the people who create patches for this program, make it available on other systems, create videos, articles about it etc. -Also I really appreciate work of people that create crates on which Czkawka basing and for that I try to report bugs to make it even better. +Also I really appreciate work of people that create crates on which Czkawka is based and for that I try to report bugs to make it even better. ## Donations If you are using the app, I would appreciate a donation for its further development, which can be done [here](https://github.com/sponsors/qarmin). diff --git a/czkawka_core/Cargo.toml b/czkawka_core/Cargo.toml index 2b67972f3..d1348bcf2 100644 --- a/czkawka_core/Cargo.toml +++ b/czkawka_core/Cargo.toml @@ -32,7 +32,7 @@ futures = "0.3.21" # Needed by broken files zip = { version = "0.6.2", features=["aes-crypto", "bzip2", "deflate", "time"], default-features = false} -rodio = { version = "0.15.0", optional = true } +audio_checker = "0.1.0" # Hashes for duplicate files blake3 = "1.3.1" @@ -62,9 +62,4 @@ imagepipe = "0.5.0" # Checking for invalid extensions mime_guess = "2.0.4" -infer = "0.7.0" - -[features] -default = [] - -broken_audio = ["rodio"] +infer = "0.7.0" \ No newline at end of file diff --git a/czkawka_core/src/broken_files.rs b/czkawka_core/src/broken_files.rs index 72ef14ebc..47ad93faa 100644 --- a/czkawka_core/src/broken_files.rs +++ b/czkawka_core/src/broken_files.rs @@ -51,7 +51,6 @@ pub enum TypeOfFile { Unknown = -1, Image = 0, ArchiveZip, - #[cfg(feature = "broken_audio")] Audio, } @@ -296,7 +295,7 @@ impl BrokenFiles { continue 'dir; } - let type_of_file = check_extension_avaibility(&file_name_lowercase); + let type_of_file = check_extension_availability(&file_name_lowercase); if type_of_file == TypeOfFile::Unknown { continue 'dir; } @@ -468,9 +467,8 @@ impl BrokenFiles { }, Err(_inspected) => Some(None), // TODO maybe throw error or something }, - #[cfg(feature = "broken_audio")] TypeOfFile::Audio => match fs::File::open(&file_entry.path) { - Ok(file) => match rodio::Decoder::new(BufReader::new(file)) { + Ok(file) => match audio_checker::parse_audio_file(file) { Ok(_) => Some(None), Err(e) => { file_entry.error_string = e.to_string(); @@ -717,21 +715,13 @@ fn get_cache_file() -> String { "cache_broken_files.bin".to_string() } -fn check_extension_avaibility(file_name_lowercase: &str) -> TypeOfFile { +fn check_extension_availability(file_name_lowercase: &str) -> TypeOfFile { if IMAGE_RS_BROKEN_FILES_EXTENSIONS.iter().any(|e| file_name_lowercase.ends_with(e)) { TypeOfFile::Image } else if ZIP_FILES_EXTENSIONS.iter().any(|e| file_name_lowercase.ends_with(e)) { TypeOfFile::ArchiveZip } else if AUDIO_FILES_EXTENSIONS.iter().any(|e| file_name_lowercase.ends_with(e)) { - #[cfg(feature = "broken_audio")] - { - TypeOfFile::Audio - } - - #[cfg(not(feature = "broken_audio"))] - { - TypeOfFile::Unknown - } + TypeOfFile::Audio } else { TypeOfFile::Unknown } diff --git a/czkawka_core/src/same_music.rs b/czkawka_core/src/same_music.rs index b5bfc178b..6bc1f73f5 100644 --- a/czkawka_core/src/same_music.rs +++ b/czkawka_core/src/same_music.rs @@ -411,15 +411,13 @@ impl SameMusic { // println!("{:?}", tag.items()); } - // println!("{:?}", tag.items()); - - if let Ok(mut length_number) = length.parse::() { - length_number /= 60; + if let Ok(old_length_number) = length.parse::() { + let length_number = old_length_number / 60; let minutes = length_number / 1000; let seconds = (length_number % 1000) * 6 / 100; if minutes != 0 || seconds != 0 { length = format!("{}:{:02}", minutes, seconds); - } else if length_number > 0 { + } else if old_length_number > 0 { // That means, that audio have length smaller that second, but length is properly read length = "0:01".to_string(); } else { diff --git a/instructions/Instruction.md b/instructions/Instruction.md index aba9b2253..c60ac2a00 100644 --- a/instructions/Instruction.md +++ b/instructions/Instruction.md @@ -102,7 +102,8 @@ Windows - `C:\Users\Username\AppData\Local\Qarmin\Czkawka\cache` By default for all files grouped by same size are computed partial hash(hash from only of 2KB each file). Such hash is computed usually very fast, especially on SSD and fast multicore processors. But when scanning a hundred of thousands or millions of files with HDD or slow processor, usually this step can take much time. In settings exists option `Use prehash cache` which enables caching such things. It is disabled by default because can increase time of loading/saving cache, with big number of entries. - **Permanent store of cache entries** After each scan, entries in cache are validated and outdated ones(which points at non-existent files) are removed. This may be problematic when scanning external drivers(like pendrives, disks etc.) and later unplugging and plugging them again. In settings exists option `Delete outdated cache entries automatically` which automatically clear this, but this can be disabled. Disabling such option may create big cache files, so button `Remove outdated results` will do it manually. - +- **Partial scanning** + If you know that you can't scan all files at once, you can still try to scan all files and during scan just stop it, so already calculated hashes/data will be saved to cache and will speedup later scans. # Tools @@ -272,3 +273,7 @@ It works in this way: - Returns all file extensions that are connected to this mime type e.g. `rar,7z,zip,p7` - Basing on file extension, adds more elements to list from above(needed because some files e.g. `exe` and `dll` begins with similar/same bytes) - If current file extensions is inside list then probably have proper extension, if is not inside, then is shown as file with invalid extension + +In `Proper Extension` column, inside parentheses is visible extension guessed by Infer library, and outside there are extensions which have same mime type as guessed one. +![ABC](https://user-images.githubusercontent.com/41945903/167214811-7d811829-6dba-4da0-9788-9e2f780e7279.png) + From 49a917f9d2e499ed7d5e6d970bf6de804930f9e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 7 May 2022 22:06:02 +0200 Subject: [PATCH 3/7] Don't crash when checking for broken files --- .github/workflows/quality.yml | 2 +- czkawka_core/src/broken_files.rs | 27 +++++++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index ad5874fae..7eba93aab 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -10,7 +10,7 @@ env: jobs: quality: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 diff --git a/czkawka_core/src/broken_files.rs b/czkawka_core/src/broken_files.rs index 47ad93faa..a30c3d607 100644 --- a/czkawka_core/src/broken_files.rs +++ b/czkawka_core/src/broken_files.rs @@ -468,12 +468,27 @@ impl BrokenFiles { Err(_inspected) => Some(None), // TODO maybe throw error or something }, TypeOfFile::Audio => match fs::File::open(&file_entry.path) { - Ok(file) => match audio_checker::parse_audio_file(file) { - Ok(_) => Some(None), - Err(e) => { - file_entry.error_string = e.to_string(); - Some(Some(file_entry)) - } + Ok(file) => + { + let file_entry_clone = file_entry.clone(); + + let result = panic::catch_unwind(|| { + match audio_checker::parse_audio_file(file) { + Ok(_) => Some(None), + Err(e) => { + file_entry.error_string = e.to_string(); + Some(Some(file_entry)) + } + } + }); + + if let Ok(audio_result) = result { + audio_result + } else { + println!("External parsing audio library crashed when opening \"{:?}\" audio file, please report bug here - https://github.com/qarmin/audio_checker/issues", file_entry_clone.path); + Some(Some(file_entry_clone)) + } + }, Err(_inspected) => Some(None), // TODO maybe throw error or something }, From 6e00d7e75956c3946dbabdaa66b36fe300d8c80c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 9 May 2022 21:12:39 +0200 Subject: [PATCH 4/7] Fix stopping of scan in broken files --- Cargo.lock | 8 +++--- czkawka_core/src/broken_files.rs | 49 ++++++++++++++------------------ 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a98c57c3..c9af31813 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1212,7 +1212,7 @@ dependencies = [ "color_quant", "exr", "gif", - "jpeg-decoder 0.2.5", + "jpeg-decoder 0.2.6", "num-iter", "num-rational 0.4.0", "num-traits", @@ -1328,9 +1328,9 @@ dependencies = [ [[package]] name = "jpeg-decoder" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be7ef4b99870f0c9f2fc2f20dbef72707e2bcca675bb9196734cf433e999b0c5" +checksum = "9478aa10f73e7528198d75109c8be5cd7d15fb530238040148d5f9a22d4c5b3b" dependencies = [ "rayon", ] @@ -2550,7 +2550,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7cfada0986f446a770eca461e8c6566cb879682f7d687c8348aa0c857bd52286" dependencies = [ "flate2", - "jpeg-decoder 0.2.5", + "jpeg-decoder 0.2.6", "weezl", ] diff --git a/czkawka_core/src/broken_files.rs b/czkawka_core/src/broken_files.rs index a30c3d607..3394ec1b2 100644 --- a/czkawka_core/src/broken_files.rs +++ b/czkawka_core/src/broken_files.rs @@ -430,62 +430,55 @@ impl BrokenFiles { match file_entry.type_of_file { TypeOfFile::Image => { - let file_entry_clone = file_entry.clone(); + let mut file_entry_clone = file_entry.clone(); let result = panic::catch_unwind(|| { - match image::open(&file_entry.path) { - Ok(_) => Some(None), - Err(t) => { - let error_string = t.to_string(); - // This error is a problem with image library, remove check when https://github.com/image-rs/jpeg-decoder/issues/130 will be fixed - if !error_string.contains("spectral selection is not allowed in non-progressive scan") { - file_entry.error_string = error_string; - Some(Some(file_entry)) - } else { - Some(None) - } + if let Err(e) = image::open(&file_entry.path){ + let error_string = e.to_string(); + // This error is a problem with image library, remove check when https://github.com/image-rs/jpeg-decoder/issues/130 will be fixed + if error_string.contains("spectral selection is not allowed in non-progressive scan") { + return Some(None); } + file_entry.error_string = error_string; } + Some(Some(file_entry)) }); - // If image crashed during opening, we just skip checking its hash and go on + // If image crashed during opening, needs to be printed info about crashes thing if let Ok(image_result) = result { image_result } else { println!("Image-rs library crashed when opening \"{:?}\" image, please check if problem happens with latest image-rs version(this can be checked via https://github.com/qarmin/ImageOpening tool) and if it is not reported, please report bug here - https://github.com/image-rs/image/issues", file_entry_clone.path); - Some(Some(file_entry_clone)) + file_entry_clone.error_string = "Image crashes due parsing, please check if problem happens with updated https://github.com/qarmin/ImageOpening and later report here https://github.com/image-rs/image/issues".to_string(); + Some(Some(file_entry_clone)) } } TypeOfFile::ArchiveZip => match fs::File::open(&file_entry.path) { - Ok(file) => match zip::ZipArchive::new(file) { - Ok(_) => Some(None), - Err(e) => { - // TODO Maybe filter out unnecessary types of errors + Ok(file) => { + if let Err(e) = zip::ZipArchive::new(file){ file_entry.error_string = e.to_string(); - Some(Some(file_entry)) } + Some(Some(file_entry)) }, - Err(_inspected) => Some(None), // TODO maybe throw error or something + Err(_inspected) => Some(None) }, TypeOfFile::Audio => match fs::File::open(&file_entry.path) { Ok(file) => { - let file_entry_clone = file_entry.clone(); + let mut file_entry_clone = file_entry.clone(); let result = panic::catch_unwind(|| { - match audio_checker::parse_audio_file(file) { - Ok(_) => Some(None), - Err(e) => { - file_entry.error_string = e.to_string(); - Some(Some(file_entry)) - } + if let Err(e) = audio_checker::parse_audio_file(file) { + file_entry.error_string = e.to_string(); } + Some(Some(file_entry)) }); if let Ok(audio_result) = result { audio_result } else { println!("External parsing audio library crashed when opening \"{:?}\" audio file, please report bug here - https://github.com/qarmin/audio_checker/issues", file_entry_clone.path); + file_entry_clone.error_string = "Audio crashes due parsing, please report bug here - https://github.com/qarmin/audio_checker/issues".to_string(); Some(Some(file_entry_clone)) } @@ -513,7 +506,7 @@ impl BrokenFiles { if self.use_cache { // Must save all results to file, old loaded from file with all currently counted results - let mut all_results: BTreeMap = self.files_to_check.clone(); + let mut all_results: BTreeMap = Default::default(); for file_entry in vec_file_entry.clone() { all_results.insert(file_entry.path.to_string_lossy().to_string(), file_entry); From ac4d02ba1db3358d43806a77bd660820e2b2dc56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 13 May 2022 22:11:37 +0200 Subject: [PATCH 5/7] No more --- Cargo.lock | 52 +++++++++++------------------- czkawka_core/Cargo.toml | 2 +- czkawka_core/src/broken_files.rs | 10 +----- czkawka_core/src/common.rs | 27 ++++++++++++++++ czkawka_core/src/same_music.rs | 4 +-- czkawka_core/src/similar_images.rs | 26 ++------------- czkawka_core/src/similar_videos.rs | 4 +-- czkawka_gui/src/initialize_gui.rs | 3 +- czkawka_gui/src/saving_loading.rs | 4 +-- 9 files changed, 58 insertions(+), 74 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c9af31813..f3c7fc8cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -100,8 +100,6 @@ dependencies = [ [[package]] name = "audio_checker" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20234f0225492ef6ee5b9258277720993b343c694873da45b3c46221816d8831" dependencies = [ "symphonia", ] @@ -1921,9 +1919,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f51245e1e62e1f1629cbfec37b5793bbabcaeb90f30e94d2ba03564687353e4" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -2287,8 +2285,7 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "symphonia" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb30457ee7a904dae1e4ace25156dcabaf71e425db318e7885267f09cd8fb648" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "lazy_static", "symphonia-bundle-flac", @@ -2308,8 +2305,7 @@ dependencies = [ [[package]] name = "symphonia-bundle-flac" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34f8f90825ee2692df0ee64981312267d6cf640358c3db7a4805d1805340665" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "log", "symphonia-core", @@ -2320,8 +2316,7 @@ dependencies = [ [[package]] name = "symphonia-bundle-mp3" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9130cae661447f234b58759d74d23500e9c95697b698589b34196cb0fb488a61" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "bitflags", "lazy_static", @@ -2333,8 +2328,7 @@ dependencies = [ [[package]] name = "symphonia-codec-aac" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96671dbcf83a4415e899812c5820dd26f48b9a6fece8b8d680e3004553080468" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "lazy_static", "log", @@ -2344,8 +2338,7 @@ dependencies = [ [[package]] name = "symphonia-codec-alac" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a95d0cc9d94c55d9467e71e26990e509bd5a602fabde3ee422d87f77bbda860a" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "log", "symphonia-core", @@ -2354,8 +2347,7 @@ dependencies = [ [[package]] name = "symphonia-codec-pcm" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0812a197602dff1f963ff212f174c4aa4d9b695d6511ba7a8fe2470296cf8310" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "log", "symphonia-core", @@ -2364,8 +2356,7 @@ dependencies = [ [[package]] name = "symphonia-codec-vorbis" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "746fc459966b37e277565f9632e5ffd6cbd83d9381152727123f68484cb8f9c4" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "log", "symphonia-core", @@ -2375,8 +2366,7 @@ dependencies = [ [[package]] name = "symphonia-core" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edcb254d25e02b688b6f8a290a778153fa5f29674ac50773d03e0a16060391d" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "arrayvec", "bitflags", @@ -2388,8 +2378,7 @@ dependencies = [ [[package]] name = "symphonia-format-isomp4" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a335816c1840bf3ce92b968a93b7b5c14a5d74737ad9ed63567ea451eac1951" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "encoding_rs", "log", @@ -2401,8 +2390,7 @@ dependencies = [ [[package]] name = "symphonia-format-mkv" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901a52e62285b3794a3ecb9b8a00b1d92d639e0dabf51eac0823a16493752726" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "lazy_static", "log", @@ -2414,8 +2402,7 @@ dependencies = [ [[package]] name = "symphonia-format-ogg" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5b92a2a6370873d9dbe3326dad1bf795b3151efcadca6e5f47d732499a518" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "log", "symphonia-core", @@ -2426,8 +2413,7 @@ dependencies = [ [[package]] name = "symphonia-format-wav" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b2016576a9f7e5e95f9354993116458170a9077845a908ee67a4c81e8072c0" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "log", "symphonia-core", @@ -2437,8 +2423,7 @@ dependencies = [ [[package]] name = "symphonia-metadata" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04ee665c99fd2b919b87261c86a5312e996b720ca142646a163d9583e72bd0e" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "encoding_rs", "lazy_static", @@ -2449,8 +2434,7 @@ dependencies = [ [[package]] name = "symphonia-utils-xiph" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abadfa53359fa437836f2554a0019dd06bfdf742fbb735d0645db3b6c5a763e0" +source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" dependencies = [ "symphonia-core", "symphonia-metadata", @@ -2458,9 +2442,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52" +checksum = "a07e33e919ebcd69113d5be0e4d70c5707004ff45188910106854f38b960df4a" dependencies = [ "proc-macro2", "quote", diff --git a/czkawka_core/Cargo.toml b/czkawka_core/Cargo.toml index d1348bcf2..f37a27e83 100644 --- a/czkawka_core/Cargo.toml +++ b/czkawka_core/Cargo.toml @@ -32,7 +32,7 @@ futures = "0.3.21" # Needed by broken files zip = { version = "0.6.2", features=["aes-crypto", "bzip2", "deflate", "time"], default-features = false} -audio_checker = "0.1.0" +audio_checker = {path = "/home/rafal/test/Symlpp"} # Hashes for duplicate files blake3 = "1.3.1" diff --git a/czkawka_core/src/broken_files.rs b/czkawka_core/src/broken_files.rs index 3394ec1b2..ae426db4b 100644 --- a/czkawka_core/src/broken_files.rs +++ b/czkawka_core/src/broken_files.rs @@ -14,6 +14,7 @@ use rayon::prelude::*; use serde::{Deserialize, Serialize}; use crate::common::{open_cache_folder, Common, LOOP_DURATION}; +use crate::common::{AUDIO_FILES_EXTENSIONS, IMAGE_RS_BROKEN_FILES_EXTENSIONS, ZIP_FILES_EXTENSIONS}; use crate::common_directory::Directories; use crate::common_extensions::Extensions; use crate::common_items::ExcludedItems; @@ -21,7 +22,6 @@ use crate::common_messages::Messages; use crate::common_traits::*; use crate::flc; use crate::localizer_core::generate_translation_hashmap; -use crate::similar_images::{AUDIO_FILES_EXTENSIONS, IMAGE_RS_BROKEN_FILES_EXTENSIONS, ZIP_FILES_EXTENSIONS}; #[derive(Debug)] pub struct ProgressData { @@ -391,8 +391,6 @@ impl BrokenFiles { } //// PROGRESS THREAD START - let check_was_stopped = AtomicBool::new(false); // Used for breaking from GUI and ending check thread - let progress_thread_run = Arc::new(AtomicBool::new(true)); let atomic_file_counter = Arc::new(AtomicUsize::new(0)); @@ -424,7 +422,6 @@ impl BrokenFiles { .map(|(_, mut file_entry)| { atomic_file_counter.fetch_add(1, Ordering::Relaxed); if stop_receiver.is_some() && stop_receiver.unwrap().try_recv().is_ok() { - check_was_stopped.store(true, Ordering::Relaxed); return None; } @@ -517,11 +514,6 @@ impl BrokenFiles { save_cache_to_file(&all_results, &mut self.text_messages, self.save_also_as_json); } - // Break if stop was clicked after saving to cache - if check_was_stopped.load(Ordering::Relaxed) { - return false; - } - self.broken_files = vec_file_entry .into_par_iter() .filter_map(|f| if f.error_string.is_empty() { None } else { Some(f) }) diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 61ffb1e78..c0a62e0c2 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -9,6 +9,33 @@ use std::path::{Path, PathBuf}; use std::time::SystemTime; /// Class for common functions used across other class/functions +pub const RAW_IMAGE_EXTENSIONS: &[&str] = &[ + ".mrw", ".arw", ".srf", ".sr2", ".mef", ".orf", ".srw", ".erf", ".kdc", ".kdc", ".dcs", ".rw2", ".raf", ".dcr", ".dng", ".pef", ".crw", ".iiq", ".3fr", ".nrw", ".nef", ".mos", + ".cr2", ".ari", +]; +pub const IMAGE_RS_EXTENSIONS: &[&str] = &[ + ".jpg", ".jpeg", ".png", ".bmp", ".tiff", ".tif", ".tga", ".ff", ".jif", ".jfi", ".webp", ".gif", ".ico", ".exr", ".hdr", "dds", +]; + +pub const IMAGE_RS_SIMILAR_IMAGES_EXTENSIONS: &[&str] = &[ + ".jpg", ".jpeg", ".png", ".tiff", ".tif", ".tga", ".ff", ".jif", ".jfi", ".bmp", ".webp", ".exr", ".hdr", "dds", +]; + +pub const IMAGE_RS_BROKEN_FILES_EXTENSIONS: &[&str] = &[ + ".jpg", ".jpeg", ".png", ".tiff", ".tif", ".tga", ".ff", ".jif", ".jfi", ".gif", ".bmp", ".ico", ".jfif", ".jpe", ".pnz", ".dib", ".webp", ".exr", ".hdr", "dds", +]; +pub const ZIP_FILES_EXTENSIONS: &[&str] = &[".zip"]; + +pub const AUDIO_FILES_EXTENSIONS: &[&str] = &[ + ".mp3", ".flac", ".wav", ".ogg", ".m4a", ".aac", ".aiff", ".pcm", ".aif", ".aiff", ".aifc", ".m3a", ".mp2", ".mp4a", ".mp2a", ".mpga", ".wave", ".weba", + ".wma", + /*".ac3",*/ + /*".oga", https://github.com/Serial-ATA/lofty-rs/issues/47#issuecomment-1120414259*/ +]; + +pub const VIDEO_FILES_EXTENSIONS: &[&str] = &[ + ".mp4", ".mpv", ".flv", ".mp4a", ".webm", ".mpg", ".mp2", ".mpeg", ".m4p", ".m4v", ".avi", ".wmv", ".qt", ".mov", ".swf", ".mkv", +]; pub const LOOP_DURATION: u32 = 200; //ms diff --git a/czkawka_core/src/same_music.rs b/czkawka_core/src/same_music.rs index 6bc1f73f5..fc8f38dcd 100644 --- a/czkawka_core/src/same_music.rs +++ b/czkawka_core/src/same_music.rs @@ -14,6 +14,7 @@ use lofty::{read_from_path, AudioFile, ItemKey}; use rayon::prelude::*; use serde::{Deserialize, Serialize}; +use crate::common::AUDIO_FILES_EXTENSIONS; use crate::common::{open_cache_folder, Common, LOOP_DURATION}; use crate::common_dir_traversal::{CheckingMethod, DirTraversalBuilder, DirTraversalResult, FileEntry, ProgressData}; use crate::common_directory::Directories; @@ -21,7 +22,6 @@ use crate::common_extensions::Extensions; use crate::common_items::ExcludedItems; use crate::common_messages::Messages; use crate::common_traits::*; -use crate::similar_images::AUDIO_FILES_EXTENSIONS; #[derive(Eq, PartialEq, Clone, Debug)] pub enum DeleteMethod { @@ -250,7 +250,7 @@ impl SameMusic { fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&futures::channel::mpsc::UnboundedSender>) -> bool { if !self.allowed_extensions.using_custom_extensions() { - self.allowed_extensions.extend_allowed_extensions(&AUDIO_FILES_EXTENSIONS); + self.allowed_extensions.extend_allowed_extensions(AUDIO_FILES_EXTENSIONS); } let result = DirTraversalBuilder::new() .root_dirs(self.directories.included_directories.clone()) diff --git a/czkawka_core/src/similar_images.rs b/czkawka_core/src/similar_images.rs index 4c9a6d3cf..41986acbe 100644 --- a/czkawka_core/src/similar_images.rs +++ b/czkawka_core/src/similar_images.rs @@ -18,7 +18,7 @@ use image_hasher::{FilterType, HashAlg, HasherConfig}; use rayon::prelude::*; use serde::{Deserialize, Serialize}; -use crate::common::{get_dynamic_image_from_raw_image, open_cache_folder, Common, LOOP_DURATION}; +use crate::common::{get_dynamic_image_from_raw_image, open_cache_folder, Common, IMAGE_RS_SIMILAR_IMAGES_EXTENSIONS, LOOP_DURATION, RAW_IMAGE_EXTENSIONS}; use crate::common_directory::Directories; use crate::common_extensions::Extensions; use crate::common_items::ExcludedItems; @@ -27,26 +27,6 @@ use crate::common_traits::{DebugPrint, PrintResults, SaveResults}; use crate::flc; use crate::localizer_core::generate_translation_hashmap; -pub const RAW_IMAGE_EXTENSIONS: [&str; 24] = [ - ".mrw", ".arw", ".srf", ".sr2", ".mef", ".orf", ".srw", ".erf", ".kdc", ".kdc", ".dcs", ".rw2", ".raf", ".dcr", ".dng", ".pef", ".crw", ".iiq", ".3fr", ".nrw", ".nef", ".mos", - ".cr2", ".ari", -]; -pub const IMAGE_RS_EXTENSIONS: [&str; 13] = [".jpg", ".jpeg", ".png", ".bmp", ".tiff", ".tif", ".tga", ".ff", ".jif", ".jfi", ".webp", ".gif", ".ico"]; - -pub const IMAGE_RS_SIMILAR_IMAGES_EXTENSIONS: [&str; 9] = [ - ".jpg", ".jpeg", ".png", ".tiff", ".tif", ".tga", ".ff", ".jif", ".jfi", //,".bmp", -]; -pub const IMAGE_RS_BROKEN_FILES_EXTENSIONS: [&str; 10] = [ - ".jpg", ".jpeg", ".png", ".tiff", ".tif", ".tga", ".ff", ".jif", ".jfi", ".gif", //,".bmp", ".ico" -]; -pub const ZIP_FILES_EXTENSIONS: [&str; 1] = [".zip"]; - -pub const AUDIO_FILES_EXTENSIONS: [&str; 8] = [".mp3", ".flac", ".wav", ".ogg", ".m4a", ".aac", ".aiff", ".pcm"]; - -pub const VIDEO_FILES_EXTENSIONS: [&str; 16] = [ - ".mp4", ".mpv", ".flv", ".mp4a", ".webm", ".mpg", ".mp2", ".mpeg", ".m4p", ".m4v", ".avi", ".wmv", ".qt", ".mov", ".swf", ".mkv", -]; - pub const SIMILAR_VALUES: [[u32; 6]; 4] = [ [0, 2, 5, 7, 14, 20], // 8 [2, 5, 15, 30, 40, 40], // 16 @@ -297,8 +277,8 @@ impl SimilarImages { let mut folders_to_check: Vec = Vec::with_capacity(1024 * 2); // This should be small enough too not see to big difference and big enough to store most of paths without needing to resize vector if !self.allowed_extensions.using_custom_extensions() { - self.allowed_extensions.extend_allowed_extensions(&IMAGE_RS_SIMILAR_IMAGES_EXTENSIONS); - self.allowed_extensions.extend_allowed_extensions(&RAW_IMAGE_EXTENSIONS); + self.allowed_extensions.extend_allowed_extensions(IMAGE_RS_SIMILAR_IMAGES_EXTENSIONS); + self.allowed_extensions.extend_allowed_extensions(RAW_IMAGE_EXTENSIONS); } // Add root folders for finding diff --git a/czkawka_core/src/similar_videos.rs b/czkawka_core/src/similar_videos.rs index 9bacfbe54..22815a724 100644 --- a/czkawka_core/src/similar_videos.rs +++ b/czkawka_core/src/similar_videos.rs @@ -17,6 +17,7 @@ use serde::{Deserialize, Serialize}; use vid_dup_finder_lib::HashCreationErrorKind::DetermineVideo; use vid_dup_finder_lib::{NormalizedTolerance, VideoHash}; +use crate::common::VIDEO_FILES_EXTENSIONS; use crate::common::{open_cache_folder, Common, LOOP_DURATION}; use crate::common_directory::Directories; use crate::common_extensions::Extensions; @@ -25,7 +26,6 @@ use crate::common_messages::Messages; use crate::common_traits::{DebugPrint, PrintResults, SaveResults}; use crate::flc; use crate::localizer_core::generate_translation_hashmap; -use crate::similar_images::VIDEO_FILES_EXTENSIONS; pub const MAX_TOLERANCE: i32 = 20; @@ -236,7 +236,7 @@ impl SimilarVideos { let mut folders_to_check: Vec = Vec::with_capacity(1024 * 2); // This should be small enough too not see to big difference and big enough to store most of paths without needing to resize vector if !self.allowed_extensions.using_custom_extensions() { - self.allowed_extensions.extend_allowed_extensions(&VIDEO_FILES_EXTENSIONS); + self.allowed_extensions.extend_allowed_extensions(VIDEO_FILES_EXTENSIONS); } // Add root folders for finding diff --git a/czkawka_gui/src/initialize_gui.rs b/czkawka_gui/src/initialize_gui.rs index 899570519..67a9a3ce4 100644 --- a/czkawka_gui/src/initialize_gui.rs +++ b/czkawka_gui/src/initialize_gui.rs @@ -9,7 +9,8 @@ use gtk::prelude::*; use gtk::{CheckButton, Image, SelectionMode, TextView, TreeView}; use crate::flg; -use czkawka_core::similar_images::{IMAGE_RS_EXTENSIONS, RAW_IMAGE_EXTENSIONS, SIMILAR_VALUES}; +use czkawka_core::common::{IMAGE_RS_EXTENSIONS, RAW_IMAGE_EXTENSIONS}; +use czkawka_core::similar_images::SIMILAR_VALUES; use czkawka_core::similar_videos::MAX_TOLERANCE; use crate::create_tree_view::*; diff --git a/czkawka_gui/src/saving_loading.rs b/czkawka_gui/src/saving_loading.rs index 79c9fa19e..08158a442 100644 --- a/czkawka_gui/src/saving_loading.rs +++ b/czkawka_gui/src/saving_loading.rs @@ -58,9 +58,9 @@ const DEFAULT_EXCLUDED_ITEMS: &str = "*/.git/*,*/node_modules/*,*/lost+found/*,* const DEFAULT_EXCLUDED_ITEMS: &str = "*\\.git\\*,*\\node_modules\\*,*\\lost+found\\*,*:\\windows\\*"; #[cfg(target_family = "unix")] -const DEFAULT_EXCLUDED_DIRECTORIES: [&str; 5] = ["/proc", "/dev", "/sys", "/run", "/snap"]; +const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["/proc", "/dev", "/sys", "/run", "/snap"]; #[cfg(not(target_family = "unix"))] -const DEFAULT_EXCLUDED_DIRECTORIES: [&str; 1] = ["C:\\Windows"]; +const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["C:\\Windows"]; struct LoadSaveStruct { loaded_items: HashMap>, From 224c4eb29125a1d504432c115bc5d6c1730196e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 15 May 2022 00:31:32 +0200 Subject: [PATCH 6/7] PDF Support --- Cargo.lock | 265 ++++++++++++++++++++++++++++--- czkawka_core/Cargo.toml | 3 +- czkawka_core/src/broken_files.rs | 68 +++++++- czkawka_core/src/common.rs | 3 + 4 files changed, 313 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f3c7fc8cd..20431fa81 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,6 +14,17 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" +[[package]] +name = "aes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +dependencies = [ + "aes-soft", + "aesni", + "cipher 0.2.5", +] + [[package]] name = "aes" version = "0.7.5" @@ -21,11 +32,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ "cfg-if", - "cipher", + "cipher 0.3.0", "cpufeatures", "opaque-debug", ] +[[package]] +name = "aes-soft" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" +dependencies = [ + "cipher 0.2.5", + "opaque-debug", +] + +[[package]] +name = "aesni" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +dependencies = [ + "cipher 0.2.5", + "opaque-debug", +] + [[package]] name = "aho-corasick" version = "0.7.18" @@ -100,6 +131,8 @@ dependencies = [ [[package]] name = "audio_checker" version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20234f0225492ef6ee5b9258277720993b343c694873da45b3c46221816d8831" dependencies = [ "symphonia", ] @@ -197,6 +230,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-modes" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" +dependencies = [ + "block-padding", + "cipher 0.2.5", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + [[package]] name = "bumpalo" version = "3.9.1" @@ -304,6 +353,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array", +] + [[package]] name = "cipher" version = "0.3.0" @@ -447,6 +505,7 @@ dependencies = [ "lofty", "mime_guess", "once_cell", + "pdf", "rawloader", "rayon", "rust-embed", @@ -505,6 +564,15 @@ dependencies = [ "byteorder", ] +[[package]] +name = "deflate" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f95bf05dffba6e6cce8dfbb30def788154949ccd9aed761b472119c21e01c70" +dependencies = [ + "adler32", +] + [[package]] name = "deflate" version = "1.0.0" @@ -555,6 +623,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + [[package]] name = "either" version = "1.6.1" @@ -606,6 +680,26 @@ dependencies = [ "instant", ] +[[package]] +name = "fax" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be28317220fbcf14cead021ae0a973a4433df68fd3c3a022bf8a4fb3bdc3ba8e" +dependencies = [ + "fax_derive", +] + +[[package]] +name = "fax_derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c1d7ffc9f2dc8316348c75281a99c8fdc60c1ddf4f82a366d117bf1b74d5a39" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "ffmpeg_cmdline_utils" version = "0.1.1" @@ -1309,6 +1403,15 @@ dependencies = [ "unic-langid", ] +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.1" @@ -1422,6 +1525,12 @@ dependencies = [ "libc", ] +[[package]] +name = "md5" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" + [[package]] name = "memchr" version = "2.5.0" @@ -1639,6 +1748,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "ordermap" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91409674c628d07a6b4b79cc877c6b63ba5ccbfbadddd77ca822f55069ed1bd4" + [[package]] name = "pango" version = "0.15.10" @@ -1722,6 +1837,45 @@ dependencies = [ "sha2 0.10.2", ] +[[package]] +name = "pdf" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f48644b2f4e9c3f3468d7c31fa75e9b823dfb167c8581ec15e90a90c34430d9" +dependencies = [ + "aes 0.6.0", + "block-modes", + "byteorder", + "chrono", + "deflate 0.9.1", + "fax", + "glob", + "inflate", + "itertools", + "jpeg-decoder 0.1.22", + "log", + "md5", + "num-traits", + "once_cell", + "ordermap", + "pdf_derive", + "sha2 0.9.9", + "snafu", + "stringprep", + "weezl", +] + +[[package]] +name = "pdf_derive" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4007262775d0798de87b15cbc64cf1aed5f7ee87eec847e297b69d8ed4b4f8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pest" version = "2.1.3" @@ -1907,9 +2061,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd249e82c21598a9a426a4e00dd7adc1d640b22445ec8545feef801d1a74c221" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" dependencies = [ "autocfg", "crossbeam-deque", @@ -2225,6 +2379,27 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +[[package]] +name = "snafu" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7" +dependencies = [ + "doc-comment", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "spin" version = "0.9.3" @@ -2240,6 +2415,16 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3ff2f71c82567c565ba4b3009a9350a96a7269eaa4001ebedae926230bc2254" +[[package]] +name = "stringprep" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "strsim" version = "0.8.0" @@ -2285,7 +2470,8 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "symphonia" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb30457ee7a904dae1e4ace25156dcabaf71e425db318e7885267f09cd8fb648" dependencies = [ "lazy_static", "symphonia-bundle-flac", @@ -2305,7 +2491,8 @@ dependencies = [ [[package]] name = "symphonia-bundle-flac" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f34f8f90825ee2692df0ee64981312267d6cf640358c3db7a4805d1805340665" dependencies = [ "log", "symphonia-core", @@ -2316,7 +2503,8 @@ dependencies = [ [[package]] name = "symphonia-bundle-mp3" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9130cae661447f234b58759d74d23500e9c95697b698589b34196cb0fb488a61" dependencies = [ "bitflags", "lazy_static", @@ -2328,7 +2516,8 @@ dependencies = [ [[package]] name = "symphonia-codec-aac" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96671dbcf83a4415e899812c5820dd26f48b9a6fece8b8d680e3004553080468" dependencies = [ "lazy_static", "log", @@ -2338,7 +2527,8 @@ dependencies = [ [[package]] name = "symphonia-codec-alac" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a95d0cc9d94c55d9467e71e26990e509bd5a602fabde3ee422d87f77bbda860a" dependencies = [ "log", "symphonia-core", @@ -2347,7 +2537,8 @@ dependencies = [ [[package]] name = "symphonia-codec-pcm" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0812a197602dff1f963ff212f174c4aa4d9b695d6511ba7a8fe2470296cf8310" dependencies = [ "log", "symphonia-core", @@ -2356,7 +2547,8 @@ dependencies = [ [[package]] name = "symphonia-codec-vorbis" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "746fc459966b37e277565f9632e5ffd6cbd83d9381152727123f68484cb8f9c4" dependencies = [ "log", "symphonia-core", @@ -2366,7 +2558,8 @@ dependencies = [ [[package]] name = "symphonia-core" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edcb254d25e02b688b6f8a290a778153fa5f29674ac50773d03e0a16060391d" dependencies = [ "arrayvec", "bitflags", @@ -2378,7 +2571,8 @@ dependencies = [ [[package]] name = "symphonia-format-isomp4" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a335816c1840bf3ce92b968a93b7b5c14a5d74737ad9ed63567ea451eac1951" dependencies = [ "encoding_rs", "log", @@ -2390,7 +2584,8 @@ dependencies = [ [[package]] name = "symphonia-format-mkv" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901a52e62285b3794a3ecb9b8a00b1d92d639e0dabf51eac0823a16493752726" dependencies = [ "lazy_static", "log", @@ -2402,7 +2597,8 @@ dependencies = [ [[package]] name = "symphonia-format-ogg" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00f5b92a2a6370873d9dbe3326dad1bf795b3151efcadca6e5f47d732499a518" dependencies = [ "log", "symphonia-core", @@ -2413,7 +2609,8 @@ dependencies = [ [[package]] name = "symphonia-format-wav" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b2016576a9f7e5e95f9354993116458170a9077845a908ee67a4c81e8072c0" dependencies = [ "log", "symphonia-core", @@ -2423,7 +2620,8 @@ dependencies = [ [[package]] name = "symphonia-metadata" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04ee665c99fd2b919b87261c86a5312e996b720ca142646a163d9583e72bd0e" dependencies = [ "encoding_rs", "lazy_static", @@ -2434,7 +2632,8 @@ dependencies = [ [[package]] name = "symphonia-utils-xiph" version = "0.5.0" -source = "git+https://github.com/pdeljanov/Symphonia#8f4aaed599ba8c23aab55d1bdad65ed621a68b92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abadfa53359fa437836f2554a0019dd06bfdf742fbb735d0645db3b6c5a763e0" dependencies = [ "symphonia-core", "symphonia-metadata", @@ -2573,6 +2772,21 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29738eedb4388d9ea620eeab9384884fc3f06f586a2eddb56bedc5885126c7c1" +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + [[package]] name = "toml" version = "0.5.9" @@ -2656,6 +2870,21 @@ dependencies = [ "version_check", ] +[[package]] +name = "unicode-bidi" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + +[[package]] +name = "unicode-normalization" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.9.0" @@ -2887,7 +3116,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf225bcf73bb52cbb496e70475c7bd7a3f769df699c0020f6c7bd9a96dcf0b8d" dependencies = [ - "aes", + "aes 0.7.5", "byteorder", "bzip2", "constant_time_eq", diff --git a/czkawka_core/Cargo.toml b/czkawka_core/Cargo.toml index f37a27e83..ac0c8ebc7 100644 --- a/czkawka_core/Cargo.toml +++ b/czkawka_core/Cargo.toml @@ -32,7 +32,8 @@ futures = "0.3.21" # Needed by broken files zip = { version = "0.6.2", features=["aes-crypto", "bzip2", "deflate", "time"], default-features = false} -audio_checker = {path = "/home/rafal/test/Symlpp"} +audio_checker = "0.1.0" +pdf = "0.7.2" # Hashes for duplicate files blake3 = "1.3.1" diff --git a/czkawka_core/src/broken_files.rs b/czkawka_core/src/broken_files.rs index ae426db4b..2e66df372 100644 --- a/czkawka_core/src/broken_files.rs +++ b/czkawka_core/src/broken_files.rs @@ -10,10 +10,12 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH}; use std::{fs, mem, panic, thread}; use crossbeam_channel::Receiver; +use pdf::PdfError; +use pdf::PdfError::Try; use rayon::prelude::*; use serde::{Deserialize, Serialize}; -use crate::common::{open_cache_folder, Common, LOOP_DURATION}; +use crate::common::{open_cache_folder, Common, LOOP_DURATION, PDF_FILES_EXTENSIONS}; use crate::common::{AUDIO_FILES_EXTENSIONS, IMAGE_RS_BROKEN_FILES_EXTENSIONS, ZIP_FILES_EXTENSIONS}; use crate::common_directory::Directories; use crate::common_extensions::Extensions; @@ -52,6 +54,7 @@ pub enum TypeOfFile { Image = 0, ArchiveZip, Audio, + PDF, } /// Info struck with helpful information's about results @@ -430,7 +433,7 @@ impl BrokenFiles { let mut file_entry_clone = file_entry.clone(); let result = panic::catch_unwind(|| { - if let Err(e) = image::open(&file_entry.path){ + if let Err(e) = image::open(&file_entry.path) { let error_string = e.to_string(); // This error is a problem with image library, remove check when https://github.com/image-rs/jpeg-decoder/issues/130 will be fixed if error_string.contains("spectral selection is not allowed in non-progressive scan") { @@ -443,7 +446,7 @@ impl BrokenFiles { // If image crashed during opening, needs to be printed info about crashes thing if let Ok(image_result) = result { - image_result + image_result } else { println!("Image-rs library crashed when opening \"{:?}\" image, please check if problem happens with latest image-rs version(this can be checked via https://github.com/qarmin/ImageOpening tool) and if it is not reported, please report bug here - https://github.com/image-rs/image/issues", file_entry_clone.path); file_entry_clone.error_string = "Image crashes due parsing, please check if problem happens with updated https://github.com/qarmin/ImageOpening and later report here https://github.com/image-rs/image/issues".to_string(); @@ -452,7 +455,7 @@ impl BrokenFiles { } TypeOfFile::ArchiveZip => match fs::File::open(&file_entry.path) { Ok(file) => { - if let Err(e) = zip::ZipArchive::new(file){ + if let Err(e) = zip::ZipArchive::new(file) { file_entry.error_string = e.to_string(); } Some(Some(file_entry)) @@ -465,7 +468,7 @@ impl BrokenFiles { let mut file_entry_clone = file_entry.clone(); let result = panic::catch_unwind(|| { - if let Err(e) = audio_checker::parse_audio_file(file) { + if let Err(e) = audio_checker::parse_audio_file(file) { file_entry.error_string = e.to_string(); } Some(Some(file_entry)) @@ -478,11 +481,45 @@ impl BrokenFiles { file_entry_clone.error_string = "Audio crashes due parsing, please report bug here - https://github.com/qarmin/audio_checker/issues".to_string(); Some(Some(file_entry_clone)) } - - }, + }, Err(_inspected) => Some(None), // TODO maybe throw error or something }, + TypeOfFile::PDF => { + match fs::read(&file_entry.path) { + Ok(content) => { + // Will be available in pdf > 0.7.2 + // let parser_options = ParseOptions { + // allow_error_in_option: true, + // allow_xref_error: true, + // allow_invalid_ops: true, + // allow_missing_endobj: true, + // }; + // if let Err(e) = pdf::file::File::from_data_with_options(content, parser_options) { + + let mut file_entry_clone = file_entry.clone(); + let result = panic::catch_unwind(|| { + if let Err(e) = pdf::file::File::from_data(content) { + file_entry.error_string = e.to_string(); + let error = unpack_pdf_error(e); + if let pdf::PdfError::InvalidPassword = error { + return Some(None); + } + } + Some(Some(file_entry)) + }); + if let Ok(pdf_result) = result { + pdf_result + } else { + println!("PDF-rs library crashed when opening \"{:?}\" pdf, and if it is not reported, please report bug here - https://github.com/pdf-rs/pdf", file_entry_clone.path); + file_entry_clone.error_string = "PDF-rs library crashed when opening pdf, and if it is not reported, please report bug here - https://github.com/pdf-rs/pdf".to_string(); + Some(Some(file_entry_clone)) + } + }, + Err(_inspected) => Some(None) + } + } + // This means that cache read invalid value because maybe cache comes from different czkawka version TypeOfFile::Unknown => Some(None), } @@ -722,7 +759,24 @@ fn check_extension_availability(file_name_lowercase: &str) -> TypeOfFile { TypeOfFile::ArchiveZip } else if AUDIO_FILES_EXTENSIONS.iter().any(|e| file_name_lowercase.ends_with(e)) { TypeOfFile::Audio + } else if PDF_FILES_EXTENSIONS.iter().any(|e| file_name_lowercase.ends_with(e)) { + TypeOfFile::PDF } else { TypeOfFile::Unknown } } + +fn unpack_pdf_error(e: PdfError) -> PdfError { + if let Try { + file: _, + line: _, + column: _, + // context: _, + source, + } = e + { + unpack_pdf_error(*source) + } else { + e + } +} diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index c0a62e0c2..95317c92f 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -24,8 +24,11 @@ pub const IMAGE_RS_SIMILAR_IMAGES_EXTENSIONS: &[&str] = &[ pub const IMAGE_RS_BROKEN_FILES_EXTENSIONS: &[&str] = &[ ".jpg", ".jpeg", ".png", ".tiff", ".tif", ".tga", ".ff", ".jif", ".jfi", ".gif", ".bmp", ".ico", ".jfif", ".jpe", ".pnz", ".dib", ".webp", ".exr", ".hdr", "dds", ]; + pub const ZIP_FILES_EXTENSIONS: &[&str] = &[".zip"]; +pub const PDF_FILES_EXTENSIONS: &[&str] = &[".pdf"]; + pub const AUDIO_FILES_EXTENSIONS: &[&str] = &[ ".mp3", ".flac", ".wav", ".ogg", ".m4a", ".aac", ".aiff", ".pcm", ".aif", ".aiff", ".aifc", ".m3a", ".mp2", ".mp4a", ".mp2a", ".mpga", ".wave", ".weba", ".wma", From 38ff034d0ee46c2a842bc4073a333918abe5f386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 16 May 2022 18:07:19 +0200 Subject: [PATCH 7/7] Infer and crash handler for music --- Cargo.lock | 21 +++++++++++---------- czkawka_core/Cargo.toml | 12 ++++++------ czkawka_core/src/same_music.rs | 27 +++++++++++++++++++++------ czkawka_gui/Cargo.toml | 8 ++++---- 4 files changed, 42 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 20431fa81..37a939673 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -317,11 +317,12 @@ checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" [[package]] name = "cfb" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f89d248799e3f15f91b70917f65381062a01bb8e222700ea0e5a7ff9785f9c" +checksum = "25f6cc832d96f9961bfe67da666f1fb96387305d385db5222cbb7bce21121016" dependencies = [ "byteorder", + "fnv", "uuid", ] @@ -1358,9 +1359,9 @@ dependencies = [ [[package]] name = "infer" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20b2b533137b9cad970793453d4f921c2e91312a6d88b1085c07bc15fc51bb3b" +checksum = "16f98856089d7ef1e861afada561bc23897918cfdfda49fe4f90ae9152ac86c3" dependencies = [ "cfb", ] @@ -1414,9 +1415,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" [[package]] name = "jpeg-decoder" @@ -2234,9 +2235,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "same-file" @@ -2905,9 +2906,9 @@ checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] name = "uuid" -version = "0.8.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +checksum = "8cfcd319456c4d6ea10087ed423473267e1a071f3bc0aa89f80d60997843c6f0" [[package]] name = "vec_map" diff --git a/czkawka_core/Cargo.toml b/czkawka_core/Cargo.toml index ac0c8ebc7..8016e764a 100644 --- a/czkawka_core/Cargo.toml +++ b/czkawka_core/Cargo.toml @@ -20,12 +20,12 @@ directories-next = "2.0.0" # Needed by similar images image_hasher = "1.0.0" bk-tree = "0.4.0" -image = "0.24.1" +image = "0.24.2" hamming = "0.1.3" # Needed by same music bitflags = "1.3.2" -lofty="0.6.0" +lofty="0.6.2" # Futures - needed by async progress sender futures = "0.3.21" @@ -38,7 +38,7 @@ pdf = "0.7.2" # Hashes for duplicate files blake3 = "1.3.1" crc32fast = "1.3.2" -xxhash-rust = { version = "0.8.4", features = ["xxh3"] } +xxhash-rust = { version = "0.8.5", features = ["xxh3"] } tempfile = "3.3.0" @@ -47,9 +47,9 @@ vid_dup_finder_lib = "0.1.0" ffmpeg_cmdline_utils = "0.1.1" # Saving/Loading Cache -serde = "1.0.136" +serde = "1.0.137" bincode = "1.3.3" -serde_json = "1.0.79" +serde_json = "1.0.81" # Language i18n-embed = { version = "0.13.4", features = ["fluent-system", "desktop-requester"] } @@ -63,4 +63,4 @@ imagepipe = "0.5.0" # Checking for invalid extensions mime_guess = "2.0.4" -infer = "0.7.0" \ No newline at end of file +infer = "0.8.0" \ No newline at end of file diff --git a/czkawka_core/src/same_music.rs b/czkawka_core/src/same_music.rs index fc8f38dcd..3240d9154 100644 --- a/czkawka_core/src/same_music.rs +++ b/czkawka_core/src/same_music.rs @@ -7,7 +7,7 @@ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::Arc; use std::thread::sleep; use std::time::{Duration, SystemTime}; -use std::{mem, thread}; +use std::{mem, panic, thread}; use crossbeam_channel::Receiver; use lofty::{read_from_path, AudioFile, ItemKey}; @@ -362,11 +362,26 @@ impl SameMusic { return None; } - let tagged_file = match read_from_path(&path, true) { - Ok(t) => t, - Err(_inspected) => { - // println!("Failed to open {}", path); - return Some(Some(music_entry)); + let result = panic::catch_unwind(|| { + match read_from_path(&path, true) { + Ok(t) => Some(t), + Err(_inspected) => { + // println!("Failed to open {}", path); + None + } + } + }); + + let tagged_file = match result { + Ok(t) => match t { + Some(r) => r, + None => { + return Some(Some(music_entry)); + } + }, + Err(_) => { + println!("File {} crashed during reading tags, please report bug", path); + return Some(None); } }; diff --git a/czkawka_gui/Cargo.toml b/czkawka_gui/Cargo.toml index df55aec8b..345207de5 100644 --- a/czkawka_gui/Cargo.toml +++ b/czkawka_gui/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/qarmin/czkawka" [dependencies] czkawka_core = { path = "../czkawka_core", version = "4.1.0"} gdk = "0.15.4" -glib = "0.15.10" +glib = "0.15.11" humansize = "1.1.1" chrono = "0.4.19" @@ -26,10 +26,10 @@ futures = "0.3.21" directories-next = "2.0.0" # For opening files -open = "2.1.1" +open = "2.1.2" # To get image preview -image = "0.24.1" +image = "0.24.2" # To be able to use custom select regex = "1.5.5" @@ -53,7 +53,7 @@ once_cell = "1.10.0" winapi = { version = "0.3.9", features = ["combaseapi", "objbase", "shobjidl_core", "windef", "winerror", "wtypesbase", "winuser"] } [dependencies.gtk] -version = "0.15.4" +version = "0.15.5" default-features = false # just in case features = ["v3_24_9"]