diff --git a/Cargo.lock b/Cargo.lock index 81f090a..8b7055a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "ahash" version = "0.7.6" @@ -69,12 +75,33 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bindgen" -version = "0.56.0" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239" +checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5" dependencies = [ "bitflags", "cexpr", + "cfg-if 0.1.10", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", +] + +[[package]] +name = "bindgen" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66c0bb6167449588ff70803f4127f0684f9063097eca5016f37eb52b92c2cf36" +dependencies = [ + "bitflags", + "cexpr", + "cfg-if 0.1.10", "clang-sys", "lazy_static", "lazycell", @@ -92,12 +119,91 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bliss-audio" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d0b2c4717cf81f58eb01c3134061f948ec65c7675d4055dbc8740389ee961f0" +dependencies = [ + "bliss-audio-aubio-rs", + "crossbeam", + "env_logger", + "ffmpeg-next", + "lazy_static", + "log", + "ndarray", + "ndarray-npy", + "ndarray-stats", + "noisy_float", + "num_cpus", + "rayon", + "ripemd160", + "rustfft", + "strum", + "strum_macros", + "thiserror", +] + +[[package]] +name = "bliss-audio-aubio-rs" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe01698d293ee91e334339d6436f17eac30d94bebaa668c5799c8206384dfeb1" +dependencies = [ + "bliss-audio-aubio-sys", +] + +[[package]] +name = "bliss-audio-aubio-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ef9fab7b922bdd057bb06fa2a2fa79d2a93bec3dd576320511cb3dfe21e78a9" +dependencies = [ + "cc", +] + +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.5", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + [[package]] name = "bumpalo" version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + [[package]] name = "bytemuck" version = "1.7.3" @@ -140,6 +246,12 @@ dependencies = [ "nom 5.1.2", ] +[[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" @@ -148,9 +260,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clang-sys" -version = "1.3.0" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa66045b9cb23c2e9c1520732030608b02ee07e5cfaa5a521ec15ded7fa24c90" +checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a" dependencies = [ "glob", "libc", @@ -159,9 +271,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.0.10" +version = "3.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a30c3bf9ff12dfe5dae53f0a96e0febcd18420d1c0e7fad77796d9d5c4b5375" +checksum = "2afefa54b5c7dd40918dc1e09f213a171ab5937aadccab45e804780b238f9f43" dependencies = [ "atty", "bitflags", @@ -176,11 +288,11 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.0.6" +version = "3.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "517358c28fcef6607bf6f76108e02afad7e82297d132a6b846dcc1fc3efcd153" +checksum = "0fd2078197a22f338bd4fbf7d6387eb6f0d6a3c69e6cbc09f5c93e97321fd92a" dependencies = [ - "heck", + "heck 0.4.0", "proc-macro-error", "proc-macro2", "quote", @@ -221,11 +333,11 @@ dependencies = [ [[package]] name = "coreaudio-sys" -version = "0.2.8" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b7e3347be6a09b46aba228d6608386739fb70beff4f61e07422da87b0bb31fa" +checksum = "17f73df0f29f4c3c374854f076c47dc018f19acaa63538880dba0937ad4fa8d7" dependencies = [ - "bindgen", + "bindgen 0.53.3", ] [[package]] @@ -253,6 +365,83 @@ dependencies = [ "winapi", ] +[[package]] +name = "crc32fast" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2209c310e29876f7f0b2721e7e26b84aff178aa3da5d091f9bfbf47669e60e3" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "crossbeam" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97242a70df9b89a65d0b6df3c4bf5b9ce03c5b7309019777fbde37e7537f8762" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b979d76c9fcb84dffc80a73f7290da0f83e4c95773494674cb44b76d13a7a110" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120" +dependencies = [ + "cfg-if 1.0.0", + "lazy_static", +] + [[package]] name = "darling" version = "0.10.2" @@ -333,6 +522,24 @@ dependencies = [ "libdbus-sys", ] +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.5", +] + [[package]] name = "dirs" version = "4.0.0" @@ -348,7 +555,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "dirs-sys-next", ] @@ -374,15 +581,40 @@ dependencies = [ "winapi", ] +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + [[package]] name = "encoding_rs" version = "0.8.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dc8abb250ffdda33912550faa54c88ec8b998dec0b2c55ab224921ce11df" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] +[[package]] +name = "env_logger" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + [[package]] name = "fallible-iterator" version = "0.2.0" @@ -395,19 +627,75 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" +[[package]] +name = "ffmpeg-next" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4676cda947a87a1e8a42e154059c567e75de64860252cce52c684acd8c074fa0" +dependencies = [ + "bitflags", + "ffmpeg-sys-next", + "libc", +] + +[[package]] +name = "ffmpeg-sys-next" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de57234f2c49c6e093fe67bbbaa9142c228f6e2d5533ef27980993d5b6adef2a" +dependencies = [ + "bindgen 0.54.0", + "cc", + "libc", + "num_cpus", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "flate2" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" +dependencies = [ + "cfg-if 1.0.0", + "crc32fast", + "libc", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getrandom" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", "wasi", ] @@ -436,6 +724,15 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "heck" version = "0.4.0" @@ -457,6 +754,12 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "ident_case" version = "1.0.1" @@ -479,7 +782,16 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", ] [[package]] @@ -560,11 +872,11 @@ dependencies = [ [[package]] name = "libloading" -version = "0.7.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" +checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" dependencies = [ - "cfg-if", + "cc", "winapi", ] @@ -593,7 +905,7 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -614,12 +926,36 @@ dependencies = [ "libc", ] +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + +[[package]] +name = "matrixmultiply" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add85d4dd35074e6fedc608f8c8f513a3548619a9024b751949ef0e8e45a4d84" +dependencies = [ + "rawpointer", +] + [[package]] name = "memchr" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -646,6 +982,16 @@ dependencies = [ "cc", ] +[[package]] +name = "miniz_oxide" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +dependencies = [ + "adler", + "autocfg", +] + [[package]] name = "mpris-player" version = "0.6.1" @@ -666,6 +1012,7 @@ dependencies = [ name = "mps-interpreter" version = "0.3.0" dependencies = [ + "bliss-audio", "dirs", "regex", "rusqlite", @@ -683,6 +1030,49 @@ dependencies = [ "rodio", ] +[[package]] +name = "ndarray" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec23e6762830658d2b3d385a75aa212af2f67a4586d4442907144f3bb6a1ca8" +dependencies = [ + "matrixmultiply", + "num-complex 0.4.0", + "num-integer", + "num-traits", + "rawpointer", + "rayon", +] + +[[package]] +name = "ndarray-npy" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f85776816e34becd8bd9540818d7dc77bf28307f3b3dcc51cc82403c6931680c" +dependencies = [ + "byteorder", + "ndarray", + "num-complex 0.4.0", + "num-traits", + "py_literal", + "zip", +] + +[[package]] +name = "ndarray-stats" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22877ad014bafa2f7dcfa5d556b0c7a52b0546cc98061a1ebef6d1834957b069" +dependencies = [ + "indexmap", + "itertools", + "ndarray", + "noisy_float", + "num-integer", + "num-traits", + "rand", +] + [[package]] name = "ndk" version = "0.3.0" @@ -785,10 +1175,19 @@ checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" dependencies = [ "bitflags", "cc", - "cfg-if", + "cfg-if 1.0.0", "libc", ] +[[package]] +name = "noisy_float" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978fe6e6ebc0bf53de533cd456ca2d9de13de13856eda1518a285d7705a213af" +dependencies = [ + "num-traits", +] + [[package]] name = "nom" version = "5.1.2" @@ -810,6 +1209,35 @@ dependencies = [ "version_check", ] +[[package]] +name = "num-bigint" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085" +dependencies = [ + "num-traits", +] + [[package]] name = "num-derive" version = "0.3.3" @@ -821,6 +1249,16 @@ dependencies = [ "syn", ] +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.14" @@ -830,6 +1268,16 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "num_enum" version = "0.5.6" @@ -889,6 +1337,18 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "os_str_bytes" version = "6.0.0" @@ -915,7 +1375,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "instant", "libc", "redox_syscall", @@ -929,12 +1389,70 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" +dependencies = [ + "maplit", + "pest", + "sha-1", +] + [[package]] name = "pkg-config" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + +[[package]] +name = "primal-check" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01419cee72c1a1ca944554e23d83e483e1bccf378753344e881de28b5487511d" +dependencies = [ + "num-integer", +] + [[package]] name = "proc-macro-crate" version = "0.1.5" @@ -988,14 +1506,98 @@ dependencies = [ ] [[package]] -name = "quote" -version = "1.0.14" +name = "py_literal" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" +checksum = "102df7a3d46db9d3891f178dcc826dc270a6746277a9ae6436f8d29fd490a8e1" +dependencies = [ + "num-bigint", + "num-complex 0.4.0", + "num-traits", + "pest", + "pest_derive", +] + +[[package]] +name = "quote" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + +[[package]] +name = "rayon" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", +] + [[package]] name = "redox_syscall" version = "0.2.10" @@ -1032,6 +1634,17 @@ version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +[[package]] +name = "ripemd160" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + [[package]] name = "rodio" version = "0.14.0" @@ -1066,6 +1679,20 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustfft" +version = "5.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1869bb2a6ff77380d52ff4bc631f165637035a55855c76aa462c85474dadc42f" +dependencies = [ + "num-complex 0.3.1", + "num-integer", + "num-traits", + "primal-check", + "strength_reduce", + "transpose", +] + [[package]] name = "same-file" version = "1.0.6" @@ -1083,9 +1710,21 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.133" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a" +checksum = "2cf9235533494ea2ddcdb794665461814781c53f19d87b76e571a1c35acbad2b" + +[[package]] +name = "sha-1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] [[package]] name = "shellexpand" @@ -1125,6 +1764,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" +[[package]] +name = "strength_reduce" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ff2f71c82567c565ba4b3009a9350a96a7269eaa4001ebedae926230bc2254" + [[package]] name = "strsim" version = "0.9.3" @@ -1137,6 +1782,24 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strum" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2" + +[[package]] +name = "strum_macros" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec" +dependencies = [ + "heck 0.3.3", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "symphonia" version = "0.4.0" @@ -1353,6 +2016,34 @@ dependencies = [ "serde", ] +[[package]] +name = "transpose" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95f9c900aa98b6ea43aee227fd680550cdec726526aab8ac801549eadb25e39f" +dependencies = [ + "num-integer", + "strength_reduce", +] + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + +[[package]] +name = "unicode-segmentation" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" + [[package]] name = "unicode-xid" version = "0.2.2" @@ -1394,7 +2085,7 @@ version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "wasm-bindgen-macro", ] @@ -1482,3 +2173,15 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "zip" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" +dependencies = [ + "byteorder", + "crc32fast", + "flate2", + "thiserror", +] diff --git a/mps-interpreter/Cargo.toml b/mps-interpreter/Cargo.toml index 0b9303f..841f0ad 100644 --- a/mps-interpreter/Cargo.toml +++ b/mps-interpreter/Cargo.toml @@ -13,8 +13,10 @@ symphonia = { version = "0.4.0", optional = true, features = [ dirs = { version = "4.0.0" } regex = { version = "1" } shellexpand = { version = "2.1", optional = true } +bliss-audio = { version = "0.4", optional = true } [features] -default = [ "music_library", "ergonomics" ] +default = [ "music_library", "ergonomics", "advanced" ] music_library = [ "symphonia" ] # song metadata parsing and database auto-population -ergonomics = ["shellexpand"] +ergonomics = ["shellexpand"] # niceties like ~ in pathes +advanced = ["bliss-audio"] # advanced language features like bliss playlist generation diff --git a/mps-interpreter/src/interpretor.rs b/mps-interpreter/src/interpretor.rs index cf91c7c..106a097 100644 --- a/mps-interpreter/src/interpretor.rs +++ b/mps-interpreter/src/interpretor.rs @@ -166,6 +166,7 @@ pub(crate) fn standard_vocab(vocabulary: &mut MpsLanguageDictionary) { // sorters .add(crate::lang::vocabulary::sorters::empty_sort()) .add(crate::lang::vocabulary::sorters::field_sort()) + .add(crate::lang::vocabulary::sorters::bliss_sort()) // functions and misc .add(crate::lang::vocabulary::sql_function_factory()) .add(crate::lang::vocabulary::simple_sql_function_factory()) diff --git a/mps-interpreter/src/lang/sorter.rs b/mps-interpreter/src/lang/sorter.rs index 84110fe..c479ed6 100644 --- a/mps-interpreter/src/lang/sorter.rs +++ b/mps-interpreter/src/lang/sorter.rs @@ -7,16 +7,18 @@ use crate::lang::utility::{assert_name, assert_token_raw, check_name}; use crate::lang::MpsLanguageDictionary; use crate::lang::{BoxedMpsOpFactory, MpsIteratorItem, MpsOp, PseudoOp}; use crate::lang::{RuntimeError, SyntaxError}; +use crate::processing::OpGetter; use crate::tokens::MpsToken; use crate::MpsContext; const SORTER_ITEM_CACHE_SIZE: usize = 8; pub trait MpsSorter: Clone + Debug + Display { - fn sort( + fn sort<'a>( &mut self, iterator: &mut dyn MpsOp, item_buf: &mut VecDeque, + op: &'a mut OpGetter, ) -> Result<(), RuntimeError>; } @@ -81,11 +83,16 @@ impl Iterator for MpsSortStatement { type Item = MpsIteratorItem; fn next(&mut self) -> Option { + let pseudo_self = PseudoOp::from_printable(self); let real_op = match self.iterable.try_real() { Ok(op) => op, Err(e) => return Some(Err(e)), }; - match self.orderer.sort(real_op.as_mut(), &mut self.item_cache) { + match self + .orderer + .sort(real_op.as_mut(), &mut self.item_cache, &mut move || { + pseudo_self.clone() + }) { Ok(_) => {} Err(e) => return Some(Err(e)), } diff --git a/mps-interpreter/src/lang/vocabulary/sorters/bliss_sorter.rs b/mps-interpreter/src/lang/vocabulary/sorters/bliss_sorter.rs new file mode 100644 index 0000000..c2e2bff --- /dev/null +++ b/mps-interpreter/src/lang/vocabulary/sorters/bliss_sorter.rs @@ -0,0 +1,236 @@ +use std::collections::VecDeque; +#[cfg(feature = "bliss-audio")] +use std::fmt::{Debug, Display, Error, Formatter}; +#[cfg(feature = "bliss-audio")] +use std::sync::mpsc::{channel, Receiver}; + +#[cfg(feature = "bliss-audio")] +use std::collections::HashMap; + +#[cfg(feature = "bliss-audio")] +use bliss_audio::Song; + +use crate::lang::utility::{assert_name, check_name}; +use crate::lang::SyntaxError; +#[cfg(feature = "bliss-audio")] +use crate::lang::{MpsIteratorItem, MpsOp, MpsSorter, MpsTypePrimitive, RuntimeError}; +use crate::lang::{MpsLanguageDictionary, MpsSortStatementFactory, MpsSorterFactory}; +#[cfg(feature = "bliss-audio")] +use crate::processing::OpGetter; +use crate::tokens::MpsToken; + +#[cfg(feature = "bliss-audio")] +const DEFAULT_ORDER: std::cmp::Ordering = std::cmp::Ordering::Greater; + +#[cfg(feature = "bliss-audio")] +#[derive(Debug)] +pub struct BlissSorter { + up_to: usize, + float_map: HashMap, + first_song: Option, + rx: Option>>, + errors: Vec, +} + +#[cfg(feature = "bliss-audio")] +impl BlissSorter { + fn get_or_wait(&mut self, path: &str) -> Option { + if let Some(distance) = self.float_map.get(path) { + Some(*distance) + } else { + // wait on threads until matching result is found + for result in self.rx.as_ref().unwrap() { + match result { + Ok((key, distance)) => { + if path == key { + self.float_map.insert(key, distance); + return Some(distance); + } else { + self.float_map.insert(key, distance); + } + } + Err(e) => { + self.errors.push(e); + return None; + } + } + } + None + } + } + + #[inline] + fn compare_songs( + song1: Song, + path_2: String, + ) -> Result<(String, f32), bliss_audio::BlissError> { + let song2 = Song::new(&path_2)?; + let distance = song1.distance(&song2); + Ok((path_2, distance)) + } +} + +#[cfg(feature = "bliss-audio")] +impl std::clone::Clone for BlissSorter { + fn clone(&self) -> Self { + Self { + up_to: self.up_to.clone(), + float_map: self.float_map.clone(), + first_song: self.first_song.clone(), + rx: None, + errors: Vec::new(), + } + } +} + +#[cfg(feature = "bliss-audio")] +impl Default for BlissSorter { + fn default() -> Self { + Self { + up_to: usize::MAX, + float_map: HashMap::new(), + first_song: None, + rx: None, + errors: Vec::new(), + } + } +} + +#[cfg(feature = "bliss-audio")] +impl MpsSorter for BlissSorter { + fn sort( + &mut self, + iterator: &mut dyn MpsOp, + item_buf: &mut VecDeque, + op: &mut OpGetter, + ) -> Result<(), RuntimeError> { + let buf_len_old = item_buf.len(); // save buffer length before modifying buffer + if item_buf.len() < self.up_to { + for item in iterator { + item_buf.push_back(item); + if item_buf.len() >= self.up_to { + break; + } + } + } + if buf_len_old != item_buf.len() && !item_buf.is_empty() { + // when buf_len_old == item_buf.len(), iterator was already complete + // no need to sort in that case, since buffer was sorted in last call to sort or buffer never had any items to sort + if self.first_song.is_none() { + let (tx_chann, rx_chann) = channel(); + let mut item_paths = Vec::with_capacity(item_buf.len() - 1); + for item in item_buf.iter() { + if let Ok(item) = item { + // build comparison table + if let Some(MpsTypePrimitive::String(path)) = item.field("filename") { + if self.first_song.is_none() { + // find first valid song (ie first item with field "filename") + self.first_song = Some(path.to_owned()); + //self.first_song = Some(Song::new(path).map_err(|e| bliss_err(e, op))?); + self.float_map.insert(path.to_owned(), 0.0); // distance to itself should be 0 + } else { + item_paths.push(path.to_owned()); + } + } + } + } + if let Some(first_song_path) = &self.first_song { + // spawn threads for processing song distances + let path1_clone = first_song_path.to_owned(); + std::thread::spawn(move || match Song::new(path1_clone) { + Err(e) => tx_chann.send(Err(e)).unwrap_or(()), + Ok(song1) => { + for path2 in item_paths { + let result_chann = tx_chann.clone(); + let song1_clone = song1.clone(); + std::thread::spawn(move || { + result_chann + .send(Self::compare_songs(song1_clone, path2)) + .unwrap_or(()); + }); + } + } + }); + } + self.rx = Some(rx_chann); + // unordered list returned on first call to this function + // note that only the first item will be used by sorter, + // since the second time this function is called the remaining items are sorted properly + } + } else if self.first_song.is_some() { + // Sort songs on second call to this function + self.first_song = None; + item_buf.make_contiguous().sort_by(|a, b| { + if let Ok(a) = a { + if let Some(MpsTypePrimitive::String(a_path)) = a.field("filename") { + if let Ok(b) = b { + if let Some(MpsTypePrimitive::String(b_path)) = b.field("filename") { + if let Some(float_a) = self.get_or_wait(a_path) { + if let Some(float_b) = self.get_or_wait(b_path) { + println!( + "A:{} distance {}, B:{} distance {}", + a_path, float_a, b_path, float_b + ); + return float_a + .partial_cmp(&float_b) + .unwrap_or(DEFAULT_ORDER); + } + } + } + } + } + } + DEFAULT_ORDER + }); + } + if self.errors.is_empty() { + Ok(()) + } else { + Err(bliss_err(self.errors.pop().unwrap(), op)) + } + } +} + +#[cfg(feature = "bliss-audio")] +fn bliss_err(error: D, op: &mut OpGetter) -> RuntimeError { + RuntimeError { + line: 0, + op: op(), + msg: format!("Bliss error: {}", error), + } +} + +#[cfg(not(feature = "bliss-audio"))] +pub type BlissSorter = crate::lang::vocabulary::sorters::EmptySorter; + +#[cfg(feature = "bliss-audio")] +impl Display for BlissSorter { + fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { + write!(f, "distance bliss") + } +} + +pub struct BlissSorterFactory; + +impl MpsSorterFactory for BlissSorterFactory { + fn is_sorter(&self, tokens: &VecDeque<&MpsToken>) -> bool { + tokens.len() == 2 && check_name("distance", &tokens[0]) && check_name("bliss", &tokens[1]) + } + + fn build_sorter( + &self, + tokens: &mut VecDeque, + _dict: &MpsLanguageDictionary, + ) -> Result { + assert_name("distance", tokens)?; + assert_name("bliss", tokens)?; + Ok(BlissSorter::default()) + } +} + +pub type BlissSorterStatementFactory = MpsSortStatementFactory; + +#[inline(always)] +pub fn bliss_sort() -> BlissSorterStatementFactory { + BlissSorterStatementFactory::new(BlissSorterFactory) +} diff --git a/mps-interpreter/src/lang/vocabulary/sorters/empty_sorter.rs b/mps-interpreter/src/lang/vocabulary/sorters/empty_sorter.rs index bffe55a..d649259 100644 --- a/mps-interpreter/src/lang/vocabulary/sorters/empty_sorter.rs +++ b/mps-interpreter/src/lang/vocabulary/sorters/empty_sorter.rs @@ -4,9 +4,10 @@ use std::fmt::{Debug, Display, Error, Formatter}; use crate::lang::{MpsIteratorItem, MpsLanguageDictionary, MpsOp}; use crate::lang::{MpsSortStatementFactory, MpsSorter, MpsSorterFactory}; use crate::lang::{RuntimeError, SyntaxError}; +use crate::processing::OpGetter; use crate::tokens::MpsToken; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)] pub struct EmptySorter; impl MpsSorter for EmptySorter { @@ -14,6 +15,7 @@ impl MpsSorter for EmptySorter { &mut self, iterator: &mut dyn MpsOp, item_buf: &mut VecDeque, + _op: &mut OpGetter, ) -> Result<(), RuntimeError> { if let Some(item) = iterator.next() { item_buf.push_back(item) diff --git a/mps-interpreter/src/lang/vocabulary/sorters/field_sorter.rs b/mps-interpreter/src/lang/vocabulary/sorters/field_sorter.rs index 543f998..7764229 100644 --- a/mps-interpreter/src/lang/vocabulary/sorters/field_sorter.rs +++ b/mps-interpreter/src/lang/vocabulary/sorters/field_sorter.rs @@ -6,6 +6,7 @@ use crate::lang::utility::assert_token; use crate::lang::{MpsIteratorItem, MpsLanguageDictionary, MpsOp}; use crate::lang::{MpsSortStatementFactory, MpsSorter, MpsSorterFactory}; use crate::lang::{RuntimeError, SyntaxError}; +use crate::processing::OpGetter; use crate::tokens::MpsToken; #[derive(Debug, Clone)] @@ -20,6 +21,7 @@ impl MpsSorter for FieldSorter { &mut self, iterator: &mut dyn MpsOp, item_buf: &mut VecDeque, + _op: &mut OpGetter, ) -> Result<(), RuntimeError> { let buf_len_old = item_buf.len(); // save buffer length before modifying buffer if item_buf.len() < self.up_to { @@ -45,7 +47,6 @@ impl MpsSorter for FieldSorter { } self.default_order }); - println!("Field-sorted item_buf: {:?}", item_buf); } Ok(()) } @@ -80,7 +81,7 @@ impl MpsSorterFactory for FieldSorterFactory { Ok(FieldSorter { field_name: name, up_to: usize::MAX, - default_order: Ordering::Equal, + default_order: Ordering::Greater, }) } } diff --git a/mps-interpreter/src/lang/vocabulary/sorters/mod.rs b/mps-interpreter/src/lang/vocabulary/sorters/mod.rs index 57c0443..dd90e5b 100644 --- a/mps-interpreter/src/lang/vocabulary/sorters/mod.rs +++ b/mps-interpreter/src/lang/vocabulary/sorters/mod.rs @@ -1,5 +1,7 @@ +mod bliss_sorter; mod empty_sorter; mod field_sorter; +pub use bliss_sorter::{bliss_sort, BlissSorter, BlissSorterFactory, BlissSorterStatementFactory}; pub use empty_sorter::{empty_sort, EmptySorter, EmptySorterFactory, EmptySorterStatementFactory}; pub use field_sorter::{field_sort, FieldSorter, FieldSorterFactory, FieldSorterStatementFactory}; diff --git a/mps-interpreter/tests/single_line.rs b/mps-interpreter/tests/single_line.rs index 2dff584..905ba29 100644 --- a/mps-interpreter/tests/single_line.rs +++ b/mps-interpreter/tests/single_line.rs @@ -358,3 +358,12 @@ fn execute_fieldsort_line() -> Result<(), Box> { true, ) } + +#[test] +fn execute_blisssort_line() -> Result<(), Box> { + execute_single_line( + "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`)~(distance bliss)", + false, + true, + ) +}