13 Commits

10 changed files with 1265 additions and 1212 deletions

View File

@@ -1,7 +1,7 @@
root = true root = true
[*] [*]
indent_style = space indent_style = tab
indent_size = 4 indent_size = 4
charset = utf-8 charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true

1
.rustfmt.toml Normal file
View File

@@ -0,0 +1 @@
hard_tabs = true

View File

@@ -1,5 +1,14 @@
# Changelog # Changelog
## v1.3.0
* allow multiple values for the tags "musicbrainz-artistid" and "musicbrainz-albumartistid"
* fix "from", "to" & "config" cli argument processing
## v1.2.2
* dependencies upgraded
## v1.2.1 ## v1.2.1
* dependencies upgraded * dependencies upgraded

450
Cargo.lock generated
View File

@@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.7.18" version = "0.7.18"
@@ -9,20 +11,11 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "ansi_term"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.41" version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15af2628f6890fe2609a3b91bef4c83450512802e59489f9c1cb1fa5df064a61" checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27"
[[package]] [[package]]
name = "array-init" name = "array-init"
@@ -43,7 +36,7 @@ dependencies = [
[[package]] [[package]]
name = "audio-conv" name = "audio-conv"
version = "1.2.1" version = "1.3.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@@ -66,30 +59,30 @@ dependencies = [
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.0.1" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.2.1" version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "bstr" name = "bstr"
version = "0.2.16" version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.0.1" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]] [[package]]
name = "cassowary" name = "cassowary"
@@ -99,9 +92,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
[[package]] [[package]]
name = "cfg-expr" name = "cfg-expr"
version = "0.7.4" version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30aa9e2ffbb838c6b451db14f3cd8e63ed622bf859f9956bc93845a10fafc26a" checksum = "5e068cb2806bbc15b439846dc16c5f89f8599f2c3e4d73d4449d38f9b2f0b6c5"
dependencies = [ dependencies = [
"smallvec", "smallvec",
] ]
@@ -114,17 +107,18 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "2.33.3" version = "3.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" checksum = "71c47df61d9e16dc010b55dba1952a57d8c215dbb533fd13cdd13369aac73b1c"
dependencies = [ dependencies = [
"ansi_term",
"atty", "atty",
"bitflags", "bitflags",
"indexmap",
"lazy_static",
"os_str_bytes",
"strsim", "strsim",
"termcolor",
"textwrap", "textwrap",
"unicode-width",
"vec_map",
] ]
[[package]] [[package]]
@@ -135,53 +129,42 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]] [[package]]
name = "crossterm" name = "crossterm"
version = "0.19.0" version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c36c10130df424b2f3552fcc2ddcd9b28a27b1e54b358b45874f88d1ca6888c" checksum = "c85525306c4291d1b73ce93c8acf9c339f9b213aef6c1d85c3830cbf1c16325c"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"crossterm_winapi", "crossterm_winapi",
"lazy_static",
"libc", "libc",
"mio", "mio",
"parking_lot", "parking_lot",
"signal-hook", "signal-hook",
"signal-hook-mio",
"winapi", "winapi",
] ]
[[package]] [[package]]
name = "crossterm_winapi" name = "crossterm_winapi"
version = "0.7.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0da8964ace4d3e4a044fd027919b2237000b24315a37c916f61809f1ff2140b9" checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c"
dependencies = [ dependencies = [
"winapi", "winapi",
] ]
[[package]] [[package]]
name = "derive_more" name = "derive_more"
version = "0.99.14" version = "0.99.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cc7b9cef1e351660e5443924e4f43ab25fbbed3e9a5f052df3677deb4d6b320" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
dependencies = [ dependencies = [
"convert_case", "convert_case",
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustc_version",
"syn", "syn",
] ]
[[package]]
name = "dtoa"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
[[package]]
name = "either"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]] [[package]]
name = "fnv" name = "fnv"
version = "1.0.7" version = "1.0.7"
@@ -190,9 +173,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.15" version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27" checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@@ -205,9 +188,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.15" version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2" checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@@ -215,15 +198,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.15" version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1" checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.15" version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "badaa6a909fac9e7236d0620a2f57f7664640c56575b71a7552fbd68deafab79" checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@@ -232,18 +215,16 @@ dependencies = [
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.15" version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1" checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b"
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.15" version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121" checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512"
dependencies = [ dependencies = [
"autocfg",
"proc-macro-hack",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
@@ -251,23 +232,22 @@ dependencies = [
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.15" version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282" checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.15" version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae" checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a"
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.15" version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967" checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a"
dependencies = [ dependencies = [
"autocfg",
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-io", "futures-io",
@@ -277,16 +257,14 @@ dependencies = [
"memchr", "memchr",
"pin-project-lite", "pin-project-lite",
"pin-utils", "pin-utils",
"proc-macro-hack",
"proc-macro-nested",
"slab", "slab",
] ]
[[package]] [[package]]
name = "glib" name = "glib"
version = "0.14.0" version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0028bbfd270d0778540294abca11141d59cb474da4c1f61ca1e11f579c49247" checksum = "a826fad715b57834920839d7a594c3b5e416358c7d790bdaba847a40d7c1d96d"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"futures-channel", "futures-channel",
@@ -299,13 +277,14 @@ dependencies = [
"libc", "libc",
"once_cell", "once_cell",
"smallvec", "smallvec",
"thiserror",
] ]
[[package]] [[package]]
name = "glib-macros" name = "glib-macros"
version = "0.14.0" version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9eb7bdf41972a6f6dab5d72c23d22789f400059a43ba0d72b4bb2f8664d946a9" checksum = "dac4d47c544af67747652ab1865ace0ffa1155709723ac4f32e97587dd4735b2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"heck", "heck",
@@ -318,9 +297,9 @@ dependencies = [
[[package]] [[package]]
name = "glib-sys" name = "glib-sys"
version = "0.14.0" version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c1d60554a212445e2a858e42a0e48cece1bd57b311a19a9468f70376cf554ae" checksum = "ef4b192f8e65e9cf76cbf4ea71fa8e3be4a0e18ffe3d68b8da6836974cc5bad4"
dependencies = [ dependencies = [
"libc", "libc",
"system-deps", "system-deps",
@@ -341,9 +320,9 @@ dependencies = [
[[package]] [[package]]
name = "gobject-sys" name = "gobject-sys"
version = "0.14.0" version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa92cae29759dae34ab5921d73fff5ad54b3d794ab842c117e36cafc7994c3f5" checksum = "0d57ce44246becd17153bd035ab4d32cfee096a657fc01f2231c9278378d1e0a"
dependencies = [ dependencies = [
"glib-sys", "glib-sys",
"libc", "libc",
@@ -352,9 +331,9 @@ dependencies = [
[[package]] [[package]]
name = "gstreamer" name = "gstreamer"
version = "0.17.0" version = "0.18.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2163b09b359d8b651d627d9c83dcce5550929ad678b8ce7ec750787affa93ec" checksum = "cd58af6f8b268fc335122a3ccc66efa0cd56584948f49a37e5feef0b89dfc29b"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if", "cfg-if",
@@ -368,6 +347,7 @@ dependencies = [
"num-integer", "num-integer",
"num-rational", "num-rational",
"once_cell", "once_cell",
"option-operations",
"paste", "paste",
"pretty-hex", "pretty-hex",
"thiserror", "thiserror",
@@ -375,9 +355,9 @@ dependencies = [
[[package]] [[package]]
name = "gstreamer-audio" name = "gstreamer-audio"
version = "0.17.0" version = "0.18.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba5d560479c5fe704ea9eecdf394cfd514b6628e0c0a4207bb5c1230370d116b" checksum = "9ceb43e669be4c33c38b273fd4ca0511c0a7748987835233c529fc3c805c807e"
dependencies = [ dependencies = [
"array-init", "array-init",
"bitflags", "bitflags",
@@ -392,9 +372,9 @@ dependencies = [
[[package]] [[package]]
name = "gstreamer-audio-sys" name = "gstreamer-audio-sys"
version = "0.17.0" version = "0.18.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d066ddfd05f63836f35ac4a5830d5bb2f7f3d6c33c870e9b15c667d20f65d7f6" checksum = "a34258fb53c558c0f41dad194037cbeaabf49d347570df11b8bd1c4897cf7d7c"
dependencies = [ dependencies = [
"glib-sys", "glib-sys",
"gobject-sys", "gobject-sys",
@@ -406,9 +386,9 @@ dependencies = [
[[package]] [[package]]
name = "gstreamer-base" name = "gstreamer-base"
version = "0.17.0" version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cf50118e1933d9e9e043036f2306d0b9660182ea61a75f266cd9fb3607b7a19" checksum = "224f35f36582407caf58ded74854526beeecc23d0cf64b8d1c3e00584ed6863f"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if", "cfg-if",
@@ -420,9 +400,9 @@ dependencies = [
[[package]] [[package]]
name = "gstreamer-base-sys" name = "gstreamer-base-sys"
version = "0.17.0" version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28169a7b58edb93ad8ac766f0fa12dcd36a2af4257a97ee10194c7103baf3e27" checksum = "a083493c3c340e71fa7c66eebda016e9fafc03eb1b4804cf9b2bad61994b078e"
dependencies = [ dependencies = [
"glib-sys", "glib-sys",
"gobject-sys", "gobject-sys",
@@ -433,9 +413,9 @@ dependencies = [
[[package]] [[package]]
name = "gstreamer-sys" name = "gstreamer-sys"
version = "0.17.0" version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8188ba998999a4a16005c3984812807ff882a87f5f3457c3d5bbbfcbdf631ebd" checksum = "e3517a65d3c2e6f8905b456eba5d53bda158d664863aef960b44f651cb7d33e2"
dependencies = [ dependencies = [
"glib-sys", "glib-sys",
"gobject-sys", "gobject-sys",
@@ -444,13 +424,16 @@ dependencies = [
] ]
[[package]] [[package]]
name = "heck" name = "hashbrown"
version = "0.3.3" version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
dependencies = [
"unicode-segmentation", [[package]]
] name = "heck"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
@@ -462,21 +445,22 @@ dependencies = [
] ]
[[package]] [[package]]
name = "instant" name = "indexmap"
version = "0.1.9" version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee"
dependencies = [ dependencies = [
"cfg-if", "autocfg",
"hashbrown",
] ]
[[package]] [[package]]
name = "itertools" name = "instant"
version = "0.10.1" version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [ dependencies = [
"either", "cfg-if",
] ]
[[package]] [[package]]
@@ -487,9 +471,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.97" version = "0.2.122"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" checksum = "ec647867e2bf0772e28c8bcde4f0d19a9216916e890543b5a03ed8ef27b8f259"
[[package]] [[package]]
name = "linked-hash-map" name = "linked-hash-map"
@@ -499,33 +483,34 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
[[package]] [[package]]
name = "lock_api" name = "lock_api"
version = "0.4.4" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
dependencies = [ dependencies = [
"autocfg",
"scopeguard", "scopeguard",
] ]
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.14" version = "0.4.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.4.0" version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.7.13" version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
@@ -551,9 +536,9 @@ checksum = "b5136edda114182728ccdedb9f5eda882781f35fa6e80cc360af12a8932507f3"
[[package]] [[package]]
name = "ntapi" name = "ntapi"
version = "0.3.6" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
dependencies = [ dependencies = [
"winapi", "winapi",
] ]
@@ -590,9 +575,9 @@ dependencies = [
[[package]] [[package]]
name = "num_cpus" name = "num_cpus"
version = "1.13.0" version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
dependencies = [ dependencies = [
"hermit-abi", "hermit-abi",
"libc", "libc",
@@ -600,15 +585,33 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.8.0" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
[[package]]
name = "option-operations"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95d6113415f41b268f1195907427519769e40ee6f28cbb053795098a2c16f447"
dependencies = [
"paste",
]
[[package]]
name = "os_str_bytes"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.11.1" version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [ dependencies = [
"instant", "instant",
"lock_api", "lock_api",
@@ -617,9 +620,9 @@ dependencies = [
[[package]] [[package]]
name = "parking_lot_core" name = "parking_lot_core"
version = "0.8.3" version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"instant", "instant",
@@ -631,15 +634,15 @@ dependencies = [
[[package]] [[package]]
name = "paste" name = "paste"
version = "1.0.5" version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc"
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.7" version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
@@ -649,9 +652,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.19" version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
[[package]] [[package]]
name = "pretty-hex" name = "pretty-hex"
@@ -661,9 +664,9 @@ checksum = "bc5c99d529f0d30937f6f4b8a86d988047327bb88d04d2c4afc356de74722131"
[[package]] [[package]]
name = "proc-macro-crate" name = "proc-macro-crate"
version = "1.0.0" version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41fdbd1df62156fbc5945f4762632564d7d038153091c3fcf1067f6aef7cff92" checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a"
dependencies = [ dependencies = [
"thiserror", "thiserror",
"toml", "toml",
@@ -693,50 +696,38 @@ dependencies = [
"version_check", "version_check",
] ]
[[package]]
name = "proc-macro-hack"
version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "proc-macro-nested"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.27" version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1"
dependencies = [ dependencies = [
"unicode-xid", "unicode-xid",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.9" version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.2.9" version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
dependencies = [ dependencies = [
"bitflags", "bitflags",
] ]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.5.4" version = "1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -749,6 +740,21 @@ version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver",
]
[[package]]
name = "ryu"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
[[package]] [[package]]
name = "same-file" name = "same-file"
version = "1.0.6" version = "1.0.6"
@@ -765,19 +771,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "serde" name = "semver"
version = "1.0.126" version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4"
[[package]]
name = "serde"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.126" version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -786,25 +798,35 @@ dependencies = [
[[package]] [[package]]
name = "serde_yaml" name = "serde_yaml"
version = "0.8.17" version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23" checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0"
dependencies = [ dependencies = [
"dtoa", "indexmap",
"linked-hash-map", "ryu",
"serde", "serde",
"yaml-rust", "yaml-rust",
] ]
[[package]] [[package]]
name = "signal-hook" name = "signal-hook"
version = "0.1.17" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729" checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d"
dependencies = [
"libc",
"signal-hook-registry",
]
[[package]]
name = "signal-hook-mio"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af"
dependencies = [ dependencies = [
"libc", "libc",
"mio", "mio",
"signal-hook-registry", "signal-hook",
] ]
[[package]] [[package]]
@@ -818,45 +840,27 @@ dependencies = [
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.3" version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.6.1" version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.8.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 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",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.73" version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -865,45 +869,46 @@ dependencies = [
[[package]] [[package]]
name = "system-deps" name = "system-deps"
version = "3.1.2" version = "6.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ab7dbd121ce66af2176147a48c7e01aaf1f001837a18a7cf4317858606bbdf8" checksum = "a1a45a1c4c9015217e12347f2a411b57ce2c4fc543913b14b6fe40483328e709"
dependencies = [ dependencies = [
"anyhow",
"cfg-expr", "cfg-expr",
"heck", "heck",
"itertools",
"pkg-config", "pkg-config",
"strum",
"strum_macros",
"thiserror",
"toml", "toml",
"version-compare", "version-compare",
] ]
[[package]] [[package]]
name = "textwrap" name = "termcolor"
version = "0.11.0" version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [ dependencies = [
"unicode-width", "winapi-util",
] ]
[[package]] [[package]]
name = "thiserror" name = "textwrap"
version = "1.0.26" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]]
name = "thiserror"
version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.26" version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -912,11 +917,10 @@ dependencies = [
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.8.0" version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "570c2eb13b3ab38208130eccd41be92520388791207fde783bda7c1e8ace28d4" checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee"
dependencies = [ dependencies = [
"autocfg",
"bytes", "bytes",
"memchr", "memchr",
"pin-project-lite", "pin-project-lite",
@@ -925,9 +929,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-macros" name = "tokio-macros"
version = "1.2.0" version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c49e3df43841dafb86046472506755d8501c5615673955f6aa17181125d13c37" checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -945,9 +949,9 @@ dependencies = [
[[package]] [[package]]
name = "tui" name = "tui"
version = "0.15.0" version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "861d8f3ad314ede6219bcb2ab844054b1de279ee37a9bc38e3d606f9d3fb2a71" checksum = "23ed0a32c88b039b73f1b6c5acbd0554bfa5b6be94467375fd947c4de3a02271"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cassowary", "cassowary",
@@ -958,15 +962,15 @@ dependencies = [
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-segmentation"
version = "1.8.0" version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.8" version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
@@ -974,23 +978,17 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "version-compare" name = "version-compare"
version = "0.0.11" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b" checksum = "fe88247b92c1df6b6de80ddc290f3976dbdf2f5f5d3fd049a9fb598c6dd5ca73"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.3" version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]] [[package]]
name = "walkdir" name = "walkdir"

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "audio-conv" name = "audio-conv"
version = "1.2.1" version = "1.3.0"
edition = "2018" edition = "2018"
description = "Copies directory structure and converts audio files in it" description = "Copies directory structure and converts audio files in it"
authors = ["Thomas Heck <t@b128.net>"] authors = ["Thomas Heck <t@b128.net>"]
@@ -21,22 +21,22 @@ include = [
] ]
[dependencies] [dependencies]
gstreamer-audio = { version = "0.17", features = ["v1_10"] } gstreamer-audio = { version = "0.18", features = ["v1_10"] }
gstreamer = { version = "0.17", features = ["v1_10"] } gstreamer = { version = "0.18", features = ["v1_10"] }
gstreamer-base = { version = "0.17", features = ["v1_10"] } gstreamer-base = { version = "0.18", features = ["v1_10"] }
glib = "0.14" glib = "0.15"
futures = "0.3" futures = "0.3"
num_cpus = "1" num_cpus = "1"
walkdir = "2" walkdir = "2"
libc = "0.2" libc = "0.2"
anyhow = "1" anyhow = "1"
clap = "2" clap = { version = "3", features = ["cargo"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.8" serde_yaml = "0.8"
regex = "1" regex = "1"
globset = "0.4" globset = "0.4"
derive_more = "0.99" derive_more = "0.99"
tui = { version = "0.15", default-features = false, features = ["crossterm"] } tui = { version = "0.17", default-features = false, features = ["crossterm"] }
[dependencies.tokio] [dependencies.tokio]
version = "1" version = "1"

12
flake.lock generated
View File

@@ -2,11 +2,11 @@
"nodes": { "nodes": {
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1623875721, "lastModified": 1648297722,
"narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", "narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", "rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -32,11 +32,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1625503609, "lastModified": 1649352661,
"narHash": "sha256-g5uv+BoL+GnT4nnCziiXNuKp0UMWtjNdss5AY/GZBzY=", "narHash": "sha256-6IO5W02HKY6pj4uRgStJ2EjIENlpvbb99OlDBBzJMDQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a00a31df2fe83ccf0a9fb6ab6934ff4e71dc0b37", "rev": "2bc410afc423de1fd7ce1d84da9f294eee866b3f",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -3,318 +3,314 @@ use globset::GlobBuilder;
use regex::bytes::{Regex, RegexBuilder}; use regex::bytes::{Regex, RegexBuilder};
use serde::Deserialize; use serde::Deserialize;
use std::{ use std::{
io::Write, io::Write,
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
#[derive(Debug)] #[derive(Debug)]
pub struct Config { pub struct Config {
pub from: PathBuf, pub from: PathBuf,
pub to: PathBuf, pub to: PathBuf,
pub matches: Vec<TranscodeMatch>, pub matches: Vec<TranscodeMatch>,
pub jobs: Option<usize>, pub jobs: Option<usize>,
} }
#[derive(Debug)] #[derive(Debug)]
pub struct TranscodeMatch { pub struct TranscodeMatch {
pub regexes: Vec<Regex>, pub regexes: Vec<Regex>,
pub to: Transcode, pub to: Transcode,
} }
#[derive(Clone, Debug, Deserialize)] #[derive(Clone, Debug, Deserialize)]
#[serde(tag = "codec")] #[serde(tag = "codec")]
pub enum Transcode { pub enum Transcode {
#[serde(rename = "opus")] #[serde(rename = "opus")]
Opus { Opus {
#[serde(default = "default_opus_bitrate")] #[serde(default = "default_opus_bitrate")]
bitrate: u16, bitrate: u16,
#[serde(default = "bitrate_type_vbr")] #[serde(default = "bitrate_type_vbr")]
bitrate_type: BitrateType, bitrate_type: BitrateType,
}, },
#[serde(rename = "flac")] #[serde(rename = "flac")]
Flac { Flac {
#[serde(default = "default_flac_compression")] #[serde(default = "default_flac_compression")]
compression: u8, compression: u8,
}, },
#[serde(rename = "mp3")] #[serde(rename = "mp3")]
Mp3 { Mp3 {
#[serde(default = "default_mp3_bitrate")] #[serde(default = "default_mp3_bitrate")]
bitrate: u16, bitrate: u16,
#[serde(default = "bitrate_type_vbr")] #[serde(default = "bitrate_type_vbr")]
bitrate_type: BitrateType, bitrate_type: BitrateType,
}, },
#[serde(rename = "copy")] #[serde(rename = "copy")]
Copy, Copy,
} }
impl Transcode { impl Transcode {
pub fn extension(&self) -> &'static str { pub fn extension(&self) -> &'static str {
match self { match self {
Transcode::Opus { .. } => "opus", Transcode::Opus { .. } => "opus",
Transcode::Flac { .. } => "flac", Transcode::Flac { .. } => "flac",
Transcode::Mp3 { .. } => "mp3", Transcode::Mp3 { .. } => "mp3",
Transcode::Copy => "", Transcode::Copy => "",
} }
} }
} }
fn default_opus_bitrate() -> u16 { fn default_opus_bitrate() -> u16 {
160 160
} }
fn default_flac_compression() -> u8 { fn default_flac_compression() -> u8 {
5 5
} }
fn bitrate_type_vbr() -> BitrateType { fn bitrate_type_vbr() -> BitrateType {
BitrateType::Vbr BitrateType::Vbr
} }
fn default_mp3_bitrate() -> u16 { fn default_mp3_bitrate() -> u16 {
256 256
} }
impl Default for Transcode { impl Default for Transcode {
fn default() -> Self { fn default() -> Self {
Transcode::Opus { Transcode::Opus {
bitrate: default_opus_bitrate(), bitrate: default_opus_bitrate(),
bitrate_type: bitrate_type_vbr(), bitrate_type: bitrate_type_vbr(),
} }
} }
} }
#[derive(Clone, Debug, Deserialize)] #[derive(Clone, Debug, Deserialize)]
pub enum BitrateType { pub enum BitrateType {
#[serde(rename = "cbr")] #[serde(rename = "cbr")]
Cbr, Cbr,
#[serde(rename = "vbr")] #[serde(rename = "vbr")]
Vbr, Vbr,
} }
#[derive(Debug, Default, Deserialize)] #[derive(Debug, Default, Deserialize)]
struct ConfigFile { struct ConfigFile {
from: Option<PathBuf>, from: Option<PathBuf>,
to: Option<PathBuf>, to: Option<PathBuf>,
#[serde(default)] #[serde(default)]
matches: Vec<TranscodeMatchFile>, matches: Vec<TranscodeMatchFile>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct TranscodeMatchFile { struct TranscodeMatchFile {
glob: Option<String>, glob: Option<String>,
regex: Option<String>, regex: Option<String>,
#[serde(default)] #[serde(default)]
extensions: Vec<String>, extensions: Vec<String>,
to: Transcode, to: Transcode,
} }
pub fn config() -> Result<Config> { pub fn config() -> Result<Config> {
use clap::{App, Arg, SubCommand}; use clap::{Arg, Command};
let arg_matches = App::new("audio-conv") let arg_matches = Command::new("audio-conv")
.version(clap::crate_version!()) .version(clap::crate_version!())
.about("Converts audio files") .about("Converts audio files")
.arg( .arg(
Arg::with_name("config") Arg::new("config")
.short("c") .short('c')
.long("config") .long("config")
.required(false) .allow_invalid_utf8(true)
.takes_value(true) .required(false)
.help("Path to an audio-conv config file, defaults to \"audio-conv.yaml\""), .takes_value(true)
) .help("Path to an audio-conv config file, defaults to \"audio-conv.yaml\""),
.arg( )
Arg::with_name("from") .arg(
.short("f") Arg::new("from")
.long("from") .short('f')
.required(false) .long("from")
.takes_value(true) .allow_invalid_utf8(true)
.help("\"from\" directory path"), .required(false)
) .takes_value(true)
.arg( .help("\"from\" directory path"),
Arg::with_name("to") )
.short("t") .arg(
.long("to") Arg::new("to")
.required(false) .short('t')
.takes_value(true) .long("to")
.help("\"to\" directory path"), .allow_invalid_utf8(true)
) .required(false)
.arg( .takes_value(true)
Arg::with_name("jobs") .help("\"to\" directory path"),
.short("j") )
.long("jobs") .arg(
.required(false) Arg::new("jobs")
.takes_value(true) .short('j')
.help("Allow N jobs/transcodes at once. Defaults to number of logical cores"), .long("jobs")
) .required(false)
.subcommand(SubCommand::with_name("init").about("writes an example config")) .takes_value(true)
.get_matches(); .help("Allow N jobs/transcodes at once. Defaults to number of logical cores"),
)
.subcommand(Command::new("init").about("writes an example config"))
.get_matches();
let current_dir = std::env::current_dir().context("Could not get current directory")?; let current_dir = std::env::current_dir().context("Could not get current directory")?;
let config_path = arg_matches.value_of_os("config"); let config_path = arg_matches.value_of_os("config");
let force_load = config_path.is_some(); let force_load = config_path.is_some();
let config_path = config_path let config_path = config_path
.map(AsRef::<Path>::as_ref) .map(AsRef::<Path>::as_ref)
.unwrap_or_else(|| AsRef::<Path>::as_ref("audio-conv.yaml")); .unwrap_or_else(|| AsRef::<Path>::as_ref("audio-conv.yaml"));
let config_path = current_dir.join(config_path); let config_path = current_dir.join(config_path);
if let Some("init") = arg_matches.subcommand_name() { if let Some("init") = arg_matches.subcommand_name() {
std::fs::OpenOptions::new() std::fs::OpenOptions::new()
.write(true) .write(true)
.create_new(true) .create_new(true)
.open(&config_path) .open(&config_path)
.and_then(|mut f| f.write_all(std::include_bytes!("../example.audio-conv.yaml"))) .and_then(|mut f| f.write_all(std::include_bytes!("../example.audio-conv.yaml")))
.with_context(|| format!("Unable to write config file to {}", config_path.display()))?; .with_context(|| format!("Unable to write config file to {}", config_path.display()))?;
std::process::exit(0); std::process::exit(0);
} }
let config_dir = config_path let config_dir = config_path
.parent() .parent()
.context("Could not get parent directory of the config file")?; .context("Could not get parent directory of the config file")?;
let config_file = load_config_file(&config_path) let config_file = load_config_file(&config_path)
.with_context(|| format!("Failed loading config file {}", config_path.display()))?; .with_context(|| format!("Failed loading config file {}", config_path.display()))?;
if force_load && config_file.is_none() { if force_load && config_file.is_none() {
return Err(Error::msg(format!( return Err(Error::msg(format!(
"could not find config file \"{}\"", "could not find config file \"{}\"",
config_path.display() config_path.display()
))); )));
} }
let default_regex = RegexBuilder::new("\\.(flac|wav)$") let default_regex = RegexBuilder::new("\\.(flac|wav)$")
.case_insensitive(true) .case_insensitive(true)
.build() .build()
.expect("Failed compiling default match regex"); .expect("Failed compiling default match regex");
let transcode_matches = config_file let transcode_matches = config_file
.as_ref() .as_ref()
.map(|config_file| { .map(|config_file| {
config_file config_file
.matches .matches
.iter() .iter()
.map(|m| { .map(|m| {
let glob = m.glob.iter().map(|glob| { let glob = m.glob.iter().map(|glob| {
let glob = GlobBuilder::new(glob) let glob = GlobBuilder::new(glob)
.case_insensitive(true) .case_insensitive(true)
.build() .build()
.context("Failed building glob")?; .context("Failed building glob")?;
let regex = Regex::new(glob.regex()).context("Failed compiling regex")?; let regex = Regex::new(glob.regex()).context("Failed compiling regex")?;
Ok(regex) Ok(regex)
}); });
let regex = m.regex.iter().map(|regex| { let regex = m.regex.iter().map(|regex| {
let regex = RegexBuilder::new(regex) let regex = RegexBuilder::new(regex)
.case_insensitive(true) .case_insensitive(true)
.build() .build()
.context("Failed compiling regex")?; .context("Failed compiling regex")?;
Ok(regex) Ok(regex)
}); });
let extensions = m.extensions.iter().map(|ext| { let extensions = m.extensions.iter().map(|ext| {
let mut ext = regex::escape(ext); let mut ext = regex::escape(ext);
ext.insert_str(0, &"\\."); ext.insert_str(0, &"\\.");
ext.push_str("$"); ext.push_str("$");
let regex = RegexBuilder::new(&ext) let regex = RegexBuilder::new(&ext)
.case_insensitive(true) .case_insensitive(true)
.build() .build()
.context("Failed compiling regex")?; .context("Failed compiling regex")?;
Ok(regex) Ok(regex)
}); });
let mut regexes = glob let mut regexes = glob
.chain(regex) .chain(regex)
.chain(extensions) .chain(extensions)
.collect::<Result<Vec<_>>>()?; .collect::<Result<Vec<_>>>()?;
if regexes.is_empty() { if regexes.is_empty() {
regexes.push(default_regex.clone()); regexes.push(default_regex.clone());
} }
Ok(TranscodeMatch { Ok(TranscodeMatch {
regexes, regexes,
to: m.to.clone(), to: m.to.clone(),
}) })
}) })
.collect::<Result<Vec<_>>>() .collect::<Result<Vec<_>>>()
}) })
.transpose()? .transpose()?
.filter(|matches| !matches.is_empty()) .filter(|matches| !matches.is_empty())
.unwrap_or_else(|| { .unwrap_or_else(|| {
vec![TranscodeMatch { vec![TranscodeMatch {
regexes: vec![default_regex], regexes: vec![default_regex],
to: Transcode::default(), to: Transcode::default(),
}] }]
}); });
Ok(Config { Ok(Config {
from: { from: {
arg_matches arg_matches
.value_of_os("from") .value_of_os("from")
.map(|p| current_dir.join(p)) .map(|p| current_dir.join(p))
.or_else(|| { .or_else(|| {
config_file config_file
.as_ref() .as_ref()
.map(|c| c.from.as_ref()) .map(|c| c.from.as_ref())
.flatten() .flatten()
.map(|p| config_dir.join(p)) .map(|p| config_dir.join(p))
}) })
.ok_or_else(|| Error::msg("\"from\" not configured"))? .ok_or_else(|| Error::msg("\"from\" not configured"))?
.canonicalize() .canonicalize()
.context("Could not canonicalize \"from\" path")? .context("Could not canonicalize \"from\" path")?
}, },
to: arg_matches to: arg_matches
.value_of_os("to") .value_of_os("to")
.map(|p| current_dir.join(p)) .map(|p| current_dir.join(p))
.or_else(|| { .or_else(|| {
config_file config_file
.as_ref() .as_ref()
.map(|c| c.to.as_ref()) .map(|c| c.to.as_ref())
.flatten() .flatten()
.map(|p| config_dir.join(p)) .map(|p| config_dir.join(p))
}) })
.ok_or_else(|| Error::msg("\"to\" not configured"))? .ok_or_else(|| Error::msg("\"to\" not configured"))?
.canonicalize() .canonicalize()
.context("Could not canonicalize \"to\" path")?, .context("Could not canonicalize \"to\" path")?,
matches: transcode_matches, matches: transcode_matches,
jobs: arg_matches jobs: arg_matches
.value_of_os("jobs") .value_of("jobs")
.map(|jobs_os_str| { .map(|jobs_str| {
let jobs_str = jobs_os_str.to_str().with_context(|| { jobs_str.parse().with_context(|| {
// TODO: use `OsStr.display` when it lands format!(
// https://github.com/rust-lang/rust/pull/80841 "Could not parse \"jobs\" argument \"{}\" to a number",
format!( &jobs_str
"Could not convert \"jobs\" argument to string due to invalid characters", )
) })
})?; })
jobs_str.parse().with_context(|| { .transpose()?,
format!( })
"Could not parse \"jobs\" argument \"{}\" to a number",
&jobs_str
)
})
})
.transpose()?,
})
} }
fn load_config_file(path: &Path) -> Result<Option<ConfigFile>> { fn load_config_file(path: &Path) -> Result<Option<ConfigFile>> {
let mut file = match std::fs::File::open(path) { let mut file = match std::fs::File::open(path) {
Ok(file) => file, Ok(file) => file,
Err(err) if err.kind() == std::io::ErrorKind::NotFound => return Ok(None), Err(err) if err.kind() == std::io::ErrorKind::NotFound => return Ok(None),
Err(err) => return Err(Error::new(err)), Err(err) => return Err(Error::new(err)),
}; };
let config: ConfigFile = let config: ConfigFile =
serde_yaml::from_reader(&mut file).context("Could not parse config file")?; serde_yaml::from_reader(&mut file).context("Could not parse config file")?;
Ok(Some(config)) Ok(Some(config))
} }

File diff suppressed because it is too large Load Diff

45
src/tag.rs Normal file
View File

@@ -0,0 +1,45 @@
use glib::Value;
use gstreamer::{
tags::{merge_strings_with_comma, CustomTag},
Tag, TagFlag,
};
pub struct MbArtistId;
impl<'a> Tag<'a> for MbArtistId {
type TagType = &'a str;
fn tag_name<'b>() -> &'b str {
"musicbrainz-artistid"
}
}
impl CustomTag<'_> for MbArtistId {
const FLAG: TagFlag = TagFlag::Meta;
const NICK: &'static str = "artist ID";
const DESCRIPTION: &'static str = "MusicBrainz artist ID";
fn merge_func(src: &Value) -> Value {
merge_strings_with_comma(src)
}
}
pub struct MbAlbumArtistId;
impl<'a> Tag<'a> for MbAlbumArtistId {
type TagType = &'a str;
fn tag_name<'b>() -> &'b str {
"musicbrainz-albumartistid"
}
}
impl CustomTag<'_> for MbAlbumArtistId {
const FLAG: TagFlag = TagFlag::Meta;
const NICK: &'static str = "album artist ID";
const DESCRIPTION: &'static str = "MusicBrainz album artist ID";
fn merge_func(src: &Value) -> Value {
merge_strings_with_comma(src)
}
}

440
src/ui.rs
View File

@@ -2,8 +2,8 @@ use crate::ConversionArgs;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use futures::Future; use futures::Future;
use std::{ use std::{
borrow::Cow, cell::RefCell, collections::HashMap, io, mem, path::PathBuf, rc::Rc, borrow::Cow, cell::RefCell, collections::HashMap, io, mem, path::PathBuf, rc::Rc,
time::Duration, time::Duration,
}; };
use tokio::{task, time::interval}; use tokio::{task, time::interval};
use tui::{backend::CrosstermBackend, Terminal}; use tui::{backend::CrosstermBackend, Terminal};
@@ -12,272 +12,272 @@ pub const UPDATE_INTERVAL_MILLIS: u64 = 100;
#[derive(Debug)] #[derive(Debug)]
pub enum Msg { pub enum Msg {
Init { task_len: usize, log_path: PathBuf }, Init { task_len: usize, log_path: PathBuf },
Exit, Exit,
TaskStart { id: usize, args: ConversionArgs }, TaskStart { id: usize, args: ConversionArgs },
TaskEnd { id: usize }, TaskEnd { id: usize },
TaskProgress { id: usize, ratio: f64 }, TaskProgress { id: usize, ratio: f64 },
TaskError { id: usize }, TaskError { id: usize },
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct MsgQueue { pub struct MsgQueue {
inner: Rc<RefCell<Vec<Msg>>>, inner: Rc<RefCell<Vec<Msg>>>,
} }
impl MsgQueue { impl MsgQueue {
fn new() -> MsgQueue { fn new() -> MsgQueue {
MsgQueue { MsgQueue {
inner: Rc::new(RefCell::new(Vec::new())), inner: Rc::new(RefCell::new(Vec::new())),
} }
} }
pub fn push(&self, msg: Msg) { pub fn push(&self, msg: Msg) {
self.inner.borrow_mut().push(msg); self.inner.borrow_mut().push(msg);
} }
fn swap_inner(&self, other: &mut Vec<Msg>) { fn swap_inner(&self, other: &mut Vec<Msg>) {
let mut inner = self.inner.borrow_mut(); let mut inner = self.inner.borrow_mut();
mem::swap(&mut *inner, other) mem::swap(&mut *inner, other)
} }
} }
struct State { struct State {
terminal: Terminal<CrosstermBackend<io::Stdout>>, terminal: Terminal<CrosstermBackend<io::Stdout>>,
log_path: Option<PathBuf>, log_path: Option<PathBuf>,
task_len: Option<usize>, task_len: Option<usize>,
ended_tasks: usize, ended_tasks: usize,
running_tasks: HashMap<usize, Task>, running_tasks: HashMap<usize, Task>,
has_rendered: bool, has_rendered: bool,
has_errored: bool, has_errored: bool,
} }
impl State { impl State {
fn new() -> Result<State> { fn new() -> Result<State> {
let terminal = Terminal::new(CrosstermBackend::new(io::stdout())) let terminal = Terminal::new(CrosstermBackend::new(io::stdout()))
.context("Unable to create ui terminal")?; .context("Unable to create ui terminal")?;
Ok(State { Ok(State {
terminal, terminal,
log_path: None, log_path: None,
task_len: None, task_len: None,
ended_tasks: 0, ended_tasks: 0,
running_tasks: HashMap::new(), running_tasks: HashMap::new(),
has_rendered: false, has_rendered: false,
has_errored: false, has_errored: false,
}) })
} }
fn process_msg(&mut self, msg: Msg) -> Result<bool> { fn process_msg(&mut self, msg: Msg) -> Result<bool> {
match msg { match msg {
Msg::Init { task_len, log_path } => { Msg::Init { task_len, log_path } => {
self.task_len = Some(task_len); self.task_len = Some(task_len);
self.log_path = Some(log_path); self.log_path = Some(log_path);
} }
Msg::Exit => return Ok(false), Msg::Exit => return Ok(false),
Msg::TaskStart { id, args } => { Msg::TaskStart { id, args } => {
self.running_tasks.insert( self.running_tasks.insert(
id, id,
Task { Task {
id, id,
ratio: None, ratio: None,
args, args,
}, },
); );
} }
Msg::TaskEnd { id } => { Msg::TaskEnd { id } => {
self.running_tasks self.running_tasks
.remove(&id) .remove(&id)
.context("Unable to remove finished task; could't find task")?; .context("Unable to remove finished task; could't find task")?;
self.ended_tasks += 1; self.ended_tasks += 1;
} }
Msg::TaskProgress { id, ratio } => { Msg::TaskProgress { id, ratio } => {
let mut task = self let mut task = self
.running_tasks .running_tasks
.get_mut(&id) .get_mut(&id)
.context("Unable to update task progress; could't find task")?; .context("Unable to update task progress; could't find task")?;
task.ratio = Some(ratio); task.ratio = Some(ratio);
} }
Msg::TaskError { id } => { Msg::TaskError { id } => {
// TODO // TODO
self.running_tasks self.running_tasks
.remove(&id) .remove(&id)
.context("Unable to remove errored task; could't find task")?; .context("Unable to remove errored task; could't find task")?;
self.ended_tasks += 1; self.ended_tasks += 1;
self.has_errored = true; self.has_errored = true;
} }
} }
Ok(true) Ok(true)
} }
fn render(&mut self) -> Result<()> { fn render(&mut self) -> Result<()> {
use tui::{ use tui::{
layout::{Constraint, Direction, Layout, Rect}, layout::{Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style}, style::{Color, Modifier, Style},
text::Text, text::Text,
widgets::{Block, Borders, Gauge, Paragraph}, widgets::{Block, Borders, Gauge, Paragraph},
}; };
let task_len = if let Some(task_len) = self.task_len { let task_len = if let Some(task_len) = self.task_len {
task_len task_len
} else { } else {
return Ok(()); return Ok(());
}; };
if task_len == 0 { if task_len == 0 {
return Ok(()); return Ok(());
} }
let tasks_ended = self.ended_tasks; let tasks_ended = self.ended_tasks;
let mut running_tasks: Vec<_> = self.running_tasks.values().cloned().collect(); let mut running_tasks: Vec<_> = self.running_tasks.values().cloned().collect();
running_tasks.sort_by_key(|task| task.id); running_tasks.sort_by_key(|task| task.id);
if !self.has_rendered { if !self.has_rendered {
self.terminal.clear().context("Clearing ui failed")?; self.terminal.clear().context("Clearing ui failed")?;
self.has_rendered = true; self.has_rendered = true;
} }
let error_text = match self.has_errored { let error_text = match self.has_errored {
true => { true => {
let text: Cow<'static, str> = self let text: Cow<'static, str> = self
.log_path .log_path
.as_ref() .as_ref()
.map(|lp| { .map(|lp| {
let text = format!("Error(s) occurred and were logged to {}", lp.display()); let text = format!("Error(s) occurred and were logged to {}", lp.display());
Cow::Owned(text) Cow::Owned(text)
}) })
.unwrap_or_else(|| Cow::Borrowed("Error(s) occurred")); .unwrap_or_else(|| Cow::Borrowed("Error(s) occurred"));
Some(text) Some(text)
} }
false => None, false => None,
}; };
self.terminal self.terminal
.draw(|f| { .draw(|f| {
let chunks = Layout::default() let chunks = Layout::default()
.direction(Direction::Vertical) .direction(Direction::Vertical)
.margin(1) .margin(1)
.constraints([Constraint::Percentage(90), Constraint::Percentage(10)].as_ref()) .constraints([Constraint::Percentage(90), Constraint::Percentage(10)].as_ref())
.split(f.size()); .split(f.size());
let mut task_rect = chunks[0]; let mut task_rect = chunks[0];
if error_text.is_some() { if error_text.is_some() {
task_rect.height -= 3; task_rect.height -= 3;
} }
for (row, task) in running_tasks for (row, task) in running_tasks
.into_iter() .into_iter()
.take(task_rect.height as usize / 2) .take(task_rect.height as usize / 2)
.enumerate() .enumerate()
{ {
f.render_widget( f.render_widget(
Gauge::default() Gauge::default()
.label(task.args.rel_from_path.to_string_lossy().as_ref()) .label(task.args.rel_from_path.to_string_lossy().as_ref())
.gauge_style( .gauge_style(
Style::default() Style::default()
.fg(Color::White) .fg(Color::White)
.bg(Color::Black) .bg(Color::Black)
.add_modifier(Modifier::ITALIC), .add_modifier(Modifier::ITALIC),
) )
.ratio(task.ratio.unwrap_or(0.0)), .ratio(task.ratio.unwrap_or(0.0)),
Rect::new( Rect::new(
task_rect.x, task_rect.x,
task_rect.y + row as u16 * 2, task_rect.y + row as u16 * 2,
task_rect.width, task_rect.width,
1, 1,
), ),
); );
} }
if let Some(error_text) = error_text { if let Some(error_text) = error_text {
f.render_widget( f.render_widget(
Paragraph::new(Text::raw(error_text)).style( Paragraph::new(Text::raw(error_text)).style(
Style::default() Style::default()
.fg(Color::Red) .fg(Color::Red)
.bg(Color::Black) .bg(Color::Black)
.add_modifier(Modifier::BOLD), .add_modifier(Modifier::BOLD),
), ),
Rect::new(task_rect.x, task_rect.height + 1, task_rect.width, 2), Rect::new(task_rect.x, task_rect.height + 1, task_rect.width, 2),
); );
} }
f.render_widget( f.render_widget(
Gauge::default() Gauge::default()
.block( .block(
Block::default() Block::default()
.borders(Borders::ALL) .borders(Borders::ALL)
.title("Overall Progress"), .title("Overall Progress"),
) )
.gauge_style( .gauge_style(
Style::default() Style::default()
.fg(Color::White) .fg(Color::White)
.bg(Color::Black) .bg(Color::Black)
.add_modifier(Modifier::ITALIC), .add_modifier(Modifier::ITALIC),
) )
.ratio(tasks_ended as f64 / task_len as f64), .ratio(tasks_ended as f64 / task_len as f64),
chunks[1], chunks[1],
); );
}) })
.context("Rendering ui failed")?; .context("Rendering ui failed")?;
Ok(()) Ok(())
} }
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
struct Task { struct Task {
id: usize, id: usize,
ratio: Option<f64>, ratio: Option<f64>,
args: ConversionArgs, args: ConversionArgs,
} }
pub fn init() -> (MsgQueue, impl Future<Output = Result<()>>) { pub fn init() -> (MsgQueue, impl Future<Output = Result<()>>) {
let queue = MsgQueue::new(); let queue = MsgQueue::new();
let queue_clone = queue.clone(); let queue_clone = queue.clone();
let fut = async move { let fut = async move {
let mut interval = interval(Duration::from_millis(UPDATE_INTERVAL_MILLIS)); let mut interval = interval(Duration::from_millis(UPDATE_INTERVAL_MILLIS));
let mut wrapped = Some((Vec::new(), State::new()?)); let mut wrapped = Some((Vec::new(), State::new()?));
loop { loop {
interval.tick().await; interval.tick().await;
let (mut current_queue, mut state) = wrapped.take().context("`wrapped` is None")?; let (mut current_queue, mut state) = wrapped.take().context("`wrapped` is None")?;
queue_clone.swap_inner(&mut current_queue); queue_clone.swap_inner(&mut current_queue);
let render_res = task::spawn_blocking(move || -> Result<_> { let render_res = task::spawn_blocking(move || -> Result<_> {
let mut exit = false; let mut exit = false;
for msg in current_queue.drain(..) { for msg in current_queue.drain(..) {
if !state.process_msg(msg)? { if !state.process_msg(msg)? {
exit = true; exit = true;
} }
} }
state.render()?; state.render()?;
if exit { if exit {
Ok(None) Ok(None)
} else { } else {
Ok(Some((current_queue, state))) Ok(Some((current_queue, state)))
} }
}) })
.await .await
.context("Ui update task failed")? .context("Ui update task failed")?
.context("Ui update failed")?; .context("Ui update failed")?;
match render_res { match render_res {
Some(s) => wrapped = Some(s), Some(s) => wrapped = Some(s),
None => break, None => break,
} }
} }
Result::<_>::Ok(()) Result::<_>::Ok(())
}; };
(queue, fut) (queue, fut)
} }