Add the debug feature
This commit is contained in:
parent
fdc1670fdc
commit
59ec23a363
10 changed files with 293 additions and 489 deletions
511
Cargo.lock
generated
511
Cargo.lock
generated
|
@ -17,24 +17,6 @@ dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ansi_colours"
|
|
||||||
version = "1.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7db9d9767fde724f83933a716ee182539788f293828244e9d999695ce0f7ba1e"
|
|
||||||
dependencies = [
|
|
||||||
"rgb",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ansi_term"
|
|
||||||
version = "0.12.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
|
||||||
dependencies = [
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-broadcast"
|
name = "async-broadcast"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
|
@ -135,58 +117,6 @@ 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 = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bat"
|
|
||||||
version = "0.22.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fbfdea7507f0848118a3be1a76643a92705a9ff675796f9cadb309b7e95ab65d"
|
|
||||||
dependencies = [
|
|
||||||
"ansi_colours",
|
|
||||||
"ansi_term",
|
|
||||||
"bincode",
|
|
||||||
"bytesize",
|
|
||||||
"clircle",
|
|
||||||
"console",
|
|
||||||
"content_inspector",
|
|
||||||
"encoding",
|
|
||||||
"flate2",
|
|
||||||
"globset",
|
|
||||||
"grep-cli",
|
|
||||||
"once_cell",
|
|
||||||
"path_abs",
|
|
||||||
"semver 1.0.16",
|
|
||||||
"serde",
|
|
||||||
"serde_yaml",
|
|
||||||
"shell-words",
|
|
||||||
"syntect",
|
|
||||||
"thiserror",
|
|
||||||
"unicode-width",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bincode"
|
|
||||||
version = "1.3.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bit-set"
|
|
||||||
version = "0.5.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
|
|
||||||
dependencies = [
|
|
||||||
"bit-vec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bit-vec"
|
|
||||||
version = "0.6.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bit_field"
|
name = "bit_field"
|
||||||
version = "0.10.1"
|
version = "0.10.1"
|
||||||
|
@ -214,18 +144,6 @@ dependencies = [
|
||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bstr"
|
|
||||||
version = "1.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b7f0778972c64420fdedc63f09919c8a88bda7b25135357fd25a5d9f3257e832"
|
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
"once_cell",
|
|
||||||
"regex-automata",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
version = "3.12.0"
|
version = "3.12.0"
|
||||||
|
@ -244,40 +162,6 @@ version = "1.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bytesize"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6c58ec36aac5066d5ca17df51b3e70279f5670a72102f5752cb7e7c856adfc70"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cargo-expand"
|
|
||||||
version = "1.0.40"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cafe8e8eaaa2526fba9ed255ac6407b2b023e3537048548af96be0f7556c3e01"
|
|
||||||
dependencies = [
|
|
||||||
"atty",
|
|
||||||
"bat",
|
|
||||||
"cargo-subcommand-metadata",
|
|
||||||
"clap",
|
|
||||||
"prettyplease",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"serde",
|
|
||||||
"syn",
|
|
||||||
"syn-select",
|
|
||||||
"tempfile",
|
|
||||||
"termcolor",
|
|
||||||
"toml",
|
|
||||||
"toolchain_find",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cargo-subcommand-metadata"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a33d3b80a8db16c4ad7676653766a8e59b5f95443c8823cb7cff587b90cb91ba"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.79"
|
version = "1.0.79"
|
||||||
|
@ -328,28 +212,17 @@ dependencies = [
|
||||||
"os_str_bytes",
|
"os_str_bytes",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clircle"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e68bbd985a63de680ab4d1ad77b6306611a8f961b282c8b5ab513e6de934e396"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"libc",
|
|
||||||
"serde",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cmus-notify"
|
name = "cmus-notify"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-expand",
|
|
||||||
"clap",
|
"clap",
|
||||||
"confy",
|
"confy",
|
||||||
"id3",
|
"id3",
|
||||||
|
"log",
|
||||||
"lrc",
|
"lrc",
|
||||||
"notify-rust",
|
"notify-rust",
|
||||||
|
"pretty_env_logger",
|
||||||
"regex",
|
"regex",
|
||||||
"serde",
|
"serde",
|
||||||
"temp-file",
|
"temp-file",
|
||||||
|
@ -384,28 +257,6 @@ dependencies = [
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "console"
|
|
||||||
version = "0.15.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60"
|
|
||||||
dependencies = [
|
|
||||||
"encode_unicode",
|
|
||||||
"lazy_static",
|
|
||||||
"libc",
|
|
||||||
"unicode-width",
|
|
||||||
"windows-sys 0.42.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "content_inspector"
|
|
||||||
version = "0.2.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38"
|
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpufeatures"
|
name = "cpufeatures"
|
||||||
version = "0.2.5"
|
version = "0.2.5"
|
||||||
|
@ -572,76 +423,6 @@ 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 = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
|
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encode_unicode"
|
|
||||||
version = "0.3.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding"
|
|
||||||
version = "0.2.33"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
|
|
||||||
dependencies = [
|
|
||||||
"encoding-index-japanese",
|
|
||||||
"encoding-index-korean",
|
|
||||||
"encoding-index-simpchinese",
|
|
||||||
"encoding-index-singlebyte",
|
|
||||||
"encoding-index-tradchinese",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding-index-japanese"
|
|
||||||
version = "1.20141219.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91"
|
|
||||||
dependencies = [
|
|
||||||
"encoding_index_tests",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding-index-korean"
|
|
||||||
version = "1.20141219.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81"
|
|
||||||
dependencies = [
|
|
||||||
"encoding_index_tests",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding-index-simpchinese"
|
|
||||||
version = "1.20141219.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7"
|
|
||||||
dependencies = [
|
|
||||||
"encoding_index_tests",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding-index-singlebyte"
|
|
||||||
version = "1.20141219.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a"
|
|
||||||
dependencies = [
|
|
||||||
"encoding_index_tests",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding-index-tradchinese"
|
|
||||||
version = "1.20141219.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18"
|
|
||||||
dependencies = [
|
|
||||||
"encoding_index_tests",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding_index_tests"
|
|
||||||
version = "0.1.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "enum-ordinalize"
|
name = "enum-ordinalize"
|
||||||
version = "3.1.12"
|
version = "3.1.12"
|
||||||
|
@ -677,6 +458,19 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "env_logger"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
|
||||||
|
dependencies = [
|
||||||
|
"atty",
|
||||||
|
"humantime",
|
||||||
|
"log",
|
||||||
|
"regex",
|
||||||
|
"termcolor",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "errno"
|
name = "errno"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
|
@ -719,16 +513,6 @@ dependencies = [
|
||||||
"threadpool",
|
"threadpool",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fancy-regex"
|
|
||||||
version = "0.7.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf"
|
|
||||||
dependencies = [
|
|
||||||
"bit-set",
|
|
||||||
"regex",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "1.8.0"
|
version = "1.8.0"
|
||||||
|
@ -761,12 +545,6 @@ dependencies = [
|
||||||
"spin",
|
"spin",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fnv"
|
|
||||||
version = "1.0.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures"
|
name = "futures"
|
||||||
version = "0.3.26"
|
version = "0.3.26"
|
||||||
|
@ -904,36 +682,6 @@ dependencies = [
|
||||||
"weezl",
|
"weezl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "globset"
|
|
||||||
version = "0.4.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
|
|
||||||
dependencies = [
|
|
||||||
"aho-corasick",
|
|
||||||
"bstr",
|
|
||||||
"fnv",
|
|
||||||
"log",
|
|
||||||
"regex",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "grep-cli"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d19fc6687bc64b6719a839cd24f2c700bcb05ffeb684d19da6a637c2455a7ba1"
|
|
||||||
dependencies = [
|
|
||||||
"atty",
|
|
||||||
"bstr",
|
|
||||||
"globset",
|
|
||||||
"lazy_static",
|
|
||||||
"log",
|
|
||||||
"regex",
|
|
||||||
"same-file",
|
|
||||||
"termcolor",
|
|
||||||
"winapi-util",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "half"
|
name = "half"
|
||||||
version = "2.2.1"
|
version = "2.2.1"
|
||||||
|
@ -989,12 +737,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "home"
|
name = "humantime"
|
||||||
version = "0.5.4"
|
version = "1.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408"
|
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winapi",
|
"quick-error",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1068,12 +816,6 @@ dependencies = [
|
||||||
"windows-sys 0.42.0",
|
"windows-sys 0.42.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "itoa"
|
|
||||||
version = "1.0.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jpeg-decoder"
|
name = "jpeg-decoder"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
@ -1385,25 +1127,6 @@ dependencies = [
|
||||||
"windows-sys 0.45.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "path_abs"
|
|
||||||
version = "0.5.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "05ef02f6342ac01d8a93b65f96db53fe68a92a15f41144f97fb00a9e669633c3"
|
|
||||||
dependencies = [
|
|
||||||
"std_prelude",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pest"
|
|
||||||
version = "2.5.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "028accff104c4e513bad663bbcd2ad7cfd5304144404c31ed0a77ac103d00660"
|
|
||||||
dependencies = [
|
|
||||||
"thiserror",
|
|
||||||
"ucd-trie",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project"
|
name = "pin-project"
|
||||||
version = "1.0.12"
|
version = "1.0.12"
|
||||||
|
@ -1469,13 +1192,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prettyplease"
|
name = "pretty_env_logger"
|
||||||
version = "0.1.23"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e97e3215779627f01ee256d2fad52f3d95e8e1c11e9fc6fd08f7cd455d5d5c78"
|
checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"env_logger",
|
||||||
"syn",
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1485,7 +1208,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34"
|
checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"toml_edit 0.18.1",
|
"toml_edit",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1521,6 +1244,12 @@ dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quick-error"
|
||||||
|
version = "1.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quick-xml"
|
name = "quick-xml"
|
||||||
version = "0.23.1"
|
version = "0.23.1"
|
||||||
|
@ -1622,12 +1351,6 @@ dependencies = [
|
||||||
"regex-syntax",
|
"regex-syntax",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex-automata"
|
|
||||||
version = "0.1.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.6.28"
|
version = "0.6.28"
|
||||||
|
@ -1643,22 +1366,13 @@ dependencies = [
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rgb"
|
|
||||||
version = "0.8.35"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7495acf66551cdb696b7711408144bcd3194fc78e32f3a09e809bfe7dd4a7ce3"
|
|
||||||
dependencies = [
|
|
||||||
"bytemuck",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc_version"
|
name = "rustc_version"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
|
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"semver 1.0.16",
|
"semver",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1681,15 +1395,6 @@ version = "1.0.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
|
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "same-file"
|
|
||||||
version = "1.0.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
|
||||||
dependencies = [
|
|
||||||
"winapi-util",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scoped_threadpool"
|
name = "scoped_threadpool"
|
||||||
version = "0.1.9"
|
version = "0.1.9"
|
||||||
|
@ -1702,30 +1407,12 @@ 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 = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "0.11.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
|
|
||||||
dependencies = [
|
|
||||||
"semver-parser",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "semver"
|
name = "semver"
|
||||||
version = "1.0.16"
|
version = "1.0.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a"
|
checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver-parser"
|
|
||||||
version = "0.10.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
|
|
||||||
dependencies = [
|
|
||||||
"pest",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.152"
|
version = "1.0.152"
|
||||||
|
@ -1746,17 +1433,6 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_json"
|
|
||||||
version = "1.0.93"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
|
|
||||||
dependencies = [
|
|
||||||
"itoa",
|
|
||||||
"ryu",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_repr"
|
name = "serde_repr"
|
||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
|
@ -1768,15 +1444,6 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_spanned"
|
|
||||||
version = "0.6.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_yaml"
|
name = "serde_yaml"
|
||||||
version = "0.8.26"
|
version = "0.8.26"
|
||||||
|
@ -1800,12 +1467,6 @@ dependencies = [
|
||||||
"digest",
|
"digest",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "shell-words"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.7"
|
version = "0.4.7"
|
||||||
|
@ -1846,12 +1507,6 @@ 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 = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "std_prelude"
|
|
||||||
version = "0.2.12"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8207e78455ffdf55661170876f88daf85356e4edd54e0a3dbc79586ca1e50cbe"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
|
@ -1890,36 +1545,6 @@ dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "syn-select"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5341d05f60821d430a8a7a452b9e267a8c675da4ad1801e7c0a01566c4a4ba48"
|
|
||||||
dependencies = [
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "syntect"
|
|
||||||
version = "5.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8"
|
|
||||||
dependencies = [
|
|
||||||
"bincode",
|
|
||||||
"bitflags",
|
|
||||||
"fancy-regex",
|
|
||||||
"flate2",
|
|
||||||
"fnv",
|
|
||||||
"lazy_static",
|
|
||||||
"once_cell",
|
|
||||||
"regex-syntax",
|
|
||||||
"serde",
|
|
||||||
"serde_derive",
|
|
||||||
"serde_json",
|
|
||||||
"thiserror",
|
|
||||||
"walkdir",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-winrt-notification"
|
name = "tauri-winrt-notification"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -2047,33 +1672,12 @@ 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 = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
|
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml"
|
|
||||||
version = "0.7.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f7afcae9e3f0fe2c370fd4657108972cbb2fa9db1b9f84849cefd80741b01cb6"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
"serde_spanned",
|
|
||||||
"toml_datetime 0.6.1",
|
|
||||||
"toml_edit 0.19.3",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_datetime"
|
name = "toml_datetime"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5"
|
checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_datetime"
|
|
||||||
version = "0.6.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
|
@ -2082,33 +1686,7 @@ checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"nom8",
|
"nom8",
|
||||||
"toml_datetime 0.5.1",
|
"toml_datetime",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_edit"
|
|
||||||
version = "0.19.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5e6a7712b49e1775fb9a7b998de6635b299237f48b404dde71704f2e0e7f37e5"
|
|
||||||
dependencies = [
|
|
||||||
"indexmap",
|
|
||||||
"nom8",
|
|
||||||
"serde",
|
|
||||||
"serde_spanned",
|
|
||||||
"toml_datetime 0.6.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toolchain_find"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5e85654a10e7a07a47c6f19d93818f3f343e22927f2fa280c84f7c8042743413"
|
|
||||||
dependencies = [
|
|
||||||
"home",
|
|
||||||
"lazy_static",
|
|
||||||
"regex",
|
|
||||||
"semver 0.11.0",
|
|
||||||
"walkdir",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2160,12 +1738,6 @@ version = "1.16.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ucd-trie"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uds_windows"
|
name = "uds_windows"
|
||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
|
@ -2197,12 +1769,6 @@ version = "1.10.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
|
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-width"
|
|
||||||
version = "0.1.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.4"
|
version = "0.9.4"
|
||||||
|
@ -2215,17 +1781,6 @@ 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 = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
|
checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "walkdir"
|
|
||||||
version = "2.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
|
|
||||||
dependencies = [
|
|
||||||
"same-file",
|
|
||||||
"winapi",
|
|
||||||
"winapi-util",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
|
|
@ -13,6 +13,8 @@ notify-rust = { version = "4.7.0", features = ["images"] }
|
||||||
regex = "1.7.1"
|
regex = "1.7.1"
|
||||||
temp-file = "0.1.7"
|
temp-file = "0.1.7"
|
||||||
typed-builder = "0.12.0"
|
typed-builder = "0.12.0"
|
||||||
|
log = { version = "0.4.17", optional = true }
|
||||||
|
pretty_env_logger = { version = "0.4.0", optional = true }
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
version = "4.1.4"
|
version = "4.1.4"
|
||||||
|
@ -25,9 +27,9 @@ features = ["yaml_conf"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
lyrics = ["lrc"]
|
lyrics = ["lrc"]
|
||||||
|
debug = ["log", "pretty_env_logger"]
|
||||||
|
|
||||||
default = ["lyrics"]
|
default = ["lyrics", "debug"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
cargo-expand = "1.0.40"
|
|
||||||
test-context = "0.1.4"
|
test-context = "0.1.4"
|
||||||
|
|
|
@ -1,4 +1,14 @@
|
||||||
use cmus_notify::{cmus::{self, query::CmusQueryResponse}, notification, settings::Settings, TrackCover};
|
use cmus_notify::{
|
||||||
|
cmus::{self, query::CmusQueryResponse},
|
||||||
|
notification,
|
||||||
|
settings::Settings,
|
||||||
|
TrackCover,
|
||||||
|
};
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
extern crate pretty_env_logger;
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate log;
|
||||||
|
|
||||||
macro_rules! sleep {
|
macro_rules! sleep {
|
||||||
($time: expr) => {
|
($time: expr) => {
|
||||||
|
@ -7,18 +17,37 @@ macro_rules! sleep {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
{
|
||||||
|
pretty_env_logger::init();
|
||||||
|
info!("Starting cmus-notify...");
|
||||||
|
info!("Debug mode is enabled. (feature \"debug\")");
|
||||||
|
info!("Binary path: {}", file!());
|
||||||
|
info!("Parsing the arguments and loading the configs...")
|
||||||
|
}
|
||||||
// Load the configs and parse the arguments, and combine them together.
|
// Load the configs and parse the arguments, and combine them together.
|
||||||
let settings = Settings::load_config_and_parse_args();
|
let settings = Settings::load_config_and_parse_args();
|
||||||
|
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
{
|
||||||
|
info!("Configs loaded, and arguments parsed.");
|
||||||
|
info!("Settings: {:#?}", settings);
|
||||||
|
}
|
||||||
|
|
||||||
// Build the command, or use the default. (to speed up the main loop, because we don't need to build it every time)
|
// Build the command, or use the default. (to speed up the main loop, because we don't need to build it every time)
|
||||||
let remote_bin_path = settings
|
let remote_bin_path = settings
|
||||||
.cmus_remote_bin_path.clone()
|
.cmus_remote_bin_path
|
||||||
|
.clone()
|
||||||
.unwrap_or("cmus-remote".to_string());
|
.unwrap_or("cmus-remote".to_string());
|
||||||
let mut query_command = cmus::build_query_command(
|
let mut query_command = cmus::build_query_command(
|
||||||
remote_bin_path.as_str(),
|
remote_bin_path.as_str(),
|
||||||
&settings.cmus_socket_address,
|
&settings.cmus_socket_address,
|
||||||
&settings.cmus_socket_password,
|
&settings.cmus_socket_password,
|
||||||
);
|
);
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
{
|
||||||
|
info!("Query command built: {:?}", query_command);
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize the buffer to store the response from cmus, to compare it with the next one.
|
// Initialize the buffer to store the response from cmus, to compare it with the next one.
|
||||||
let mut previous_response = CmusQueryResponse::default();
|
let mut previous_response = CmusQueryResponse::default();
|
||||||
|
@ -34,6 +63,9 @@ fn main() {
|
||||||
std::process::exit(0)
|
std::process::exit(0)
|
||||||
} else {
|
} else {
|
||||||
// If the track info is the same as the previous one, just sleep for a while and try again.
|
// If the track info is the same as the previous one, just sleep for a while and try again.
|
||||||
|
#[cfg(feature = "debug")] {
|
||||||
|
info!("Cmus is not running, sleeping for {} ms...", settings.interval);
|
||||||
|
}
|
||||||
sleep!(settings.interval);
|
sleep!(settings.interval);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +78,8 @@ fn main() {
|
||||||
// Update the previous response.
|
// Update the previous response.
|
||||||
previous_response = response;
|
previous_response = response;
|
||||||
|
|
||||||
notification::show_notification(events, &settings, &mut previous_cover); // TODO: Handle the error.
|
notification::show_notification(events, &settings, &mut previous_cover);
|
||||||
|
// TODO: Handle the error.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sleep!(settings.interval);
|
sleep!(settings.interval);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::cmus::player_settings::{AAAMode, Shuffle};
|
use crate::cmus::player_settings::{AAAMode, Shuffle};
|
||||||
use crate::cmus::{Track, TrackStatus};
|
use crate::cmus::{Track, TrackStatus};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum CmusEvent {
|
pub enum CmusEvent {
|
||||||
StatusChanged(TrackStatus),
|
StatusChanged(TrackStatus),
|
||||||
TrackChanged(Track),
|
TrackChanged(Track),
|
||||||
|
|
|
@ -4,10 +4,12 @@ pub mod query;
|
||||||
|
|
||||||
use crate::cmus::query::CmusQueryResponse;
|
use crate::cmus::query::CmusQueryResponse;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fmt::Display;
|
use std::fmt::{Debug, Display};
|
||||||
use std::num::ParseIntError;
|
use std::num::ParseIntError;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use typed_builder::TypedBuilder;
|
use typed_builder::TypedBuilder;
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
use log::{info, debug};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Default)]
|
#[derive(Debug, PartialEq, Default)]
|
||||||
pub struct TrackMetadata {
|
pub struct TrackMetadata {
|
||||||
|
@ -82,6 +84,9 @@ impl FromStr for Track {
|
||||||
/// The first line is the status, the second is the path, the third is the duration, and the fourth is the position.
|
/// The first line is the status, the second is the path, the third is the duration, and the fourth is the position.
|
||||||
/// The rest of the lines are tags, and the player settings, so we'll send them to `TrackMetadata::parse`, to get the tags.
|
/// The rest of the lines are tags, and the player settings, so we'll send them to `TrackMetadata::parse`, to get the tags.
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("Parsing track from string: {}", s);
|
||||||
|
|
||||||
let mut lines = s.lines();
|
let mut lines = s.lines();
|
||||||
|
|
||||||
Ok(Track::builder()
|
Ok(Track::builder()
|
||||||
|
@ -132,15 +137,22 @@ impl TrackMetadata {
|
||||||
/// This function will assume you processed the first 4 lines, and remove them from the iterator.
|
/// This function will assume you processed the first 4 lines, and remove them from the iterator.
|
||||||
///
|
///
|
||||||
/// and also assume the all tags is contained in the iterator.
|
/// and also assume the all tags is contained in the iterator.
|
||||||
fn parse<'a>(mut lines: impl Iterator<Item = &'a str>) -> Self {
|
fn parse<'a>(mut lines: impl Iterator<Item = &'a str> + Debug) -> Self {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("Parsing track metadata from lines: {:?}", lines);
|
||||||
|
|
||||||
let mut tags = HashMap::new();
|
let mut tags = HashMap::new();
|
||||||
|
|
||||||
while let Some(line) = lines.next() {
|
while let Some(line) = lines.next() {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("Parsing line: {}", line);
|
||||||
match line.trim().split_once(' ') {
|
match line.trim().split_once(' ') {
|
||||||
Some(("tag", rest)) => {
|
Some(("tag", rest)) => {
|
||||||
let Some((key, value)) = rest.split_once(' ') else {
|
let Some((key, value)) = rest.split_once(' ') else {
|
||||||
continue; // Ignore lines that don't have a key and a value.
|
continue; // Ignore lines that don't have a key and a value.
|
||||||
};
|
};
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("Inserting tag: {} = {}", key, value);
|
||||||
tags.insert(key.to_string(), value.to_string());
|
tags.insert(key.to_string(), value.to_string());
|
||||||
}
|
}
|
||||||
_ => break, // We've reached the end of the tags.
|
_ => break, // We've reached the end of the tags.
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use crate::cmus::CmusError;
|
use crate::cmus::CmusError;
|
||||||
use std::num::ParseIntError;
|
use std::num::ParseIntError;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
use log::{info, debug};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct PlayerSettings {
|
pub struct PlayerSettings {
|
||||||
|
@ -63,6 +65,8 @@ impl FromStr for PlayerSettings {
|
||||||
type Err = CmusError;
|
type Err = CmusError;
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("Parsing cmus response from string: {}", s);
|
||||||
let mut repeat = false;
|
let mut repeat = false;
|
||||||
let mut repeat_current = false;
|
let mut repeat_current = false;
|
||||||
let mut shuffle = Shuffle::default();
|
let mut shuffle = Shuffle::default();
|
||||||
|
@ -70,6 +74,8 @@ impl FromStr for PlayerSettings {
|
||||||
let mut volume = Volume::default();
|
let mut volume = Volume::default();
|
||||||
|
|
||||||
for line in s.lines() {
|
for line in s.lines() {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("Parsing line: {}", line);
|
||||||
if line.starts_with("set ") {
|
if line.starts_with("set ") {
|
||||||
let line = &line[4..];
|
let line = &line[4..];
|
||||||
let (key, value) = line.split_once(" ").ok_or(CmusError::UnknownError(
|
let (key, value) = line.split_once(" ").ok_or(CmusError::UnknownError(
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
use crate::cmus::events::CmusEvent;
|
use crate::cmus::events::CmusEvent;
|
||||||
use crate::cmus::player_settings::PlayerSettings;
|
use crate::cmus::player_settings::PlayerSettings;
|
||||||
use crate::cmus::{CmusError, Track};
|
use crate::cmus::{CmusError, Track};
|
||||||
|
use log::debug;
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
use log::info;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
/// This struct is used to store the row status response from cmus.
|
/// This struct is used to store the row status response from cmus.
|
||||||
|
@ -17,6 +20,9 @@ impl FromStr for CmusQueryResponse {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("Parsing cmus response from string: {}", s);
|
||||||
|
|
||||||
let sep_index = s.find("set ").ok_or("Corrupted cmus response")?;
|
let sep_index = s.find("set ").ok_or("Corrupted cmus response")?;
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
|
@ -40,7 +46,12 @@ impl CmusQueryResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn events(&self, other: &Self) -> Result<Vec<CmusEvent>, CmusError> {
|
pub fn events(&self, other: &Self) -> Result<Vec<CmusEvent>, CmusError> {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("Comparing cmus responses: {:?} and {:?}", self, other);
|
||||||
|
|
||||||
if self.track_row.is_empty() || self.player_settings_row.is_empty() {
|
if self.track_row.is_empty() || self.player_settings_row.is_empty() {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("Cmus response is empty, returning empty events");
|
||||||
return Ok(Vec::new());
|
return Ok(Vec::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,12 +61,25 @@ impl CmusQueryResponse {
|
||||||
let other_track = other.track()?;
|
let other_track = other.track()?;
|
||||||
|
|
||||||
if track != other_track {
|
if track != other_track {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("Track changed: {:?} -> {:?}", other_track, track);
|
||||||
|
|
||||||
if track.status != other_track.status {
|
if track.status != other_track.status {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"Status changed: {:?} -> {:?}",
|
||||||
|
other_track.status, track.status
|
||||||
|
);
|
||||||
events.push(CmusEvent::StatusChanged(other_track.status));
|
events.push(CmusEvent::StatusChanged(other_track.status));
|
||||||
} else if track.position != other_track.position {
|
} else if track.position != other_track.position {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"Position changed: {:?} -> {:?}",
|
||||||
|
other_track.position, track.position
|
||||||
|
);
|
||||||
events.push(CmusEvent::PositionChanged(other_track.position));
|
events.push(CmusEvent::PositionChanged(other_track.position));
|
||||||
} else {
|
} else {
|
||||||
events.push(CmusEvent::TrackChanged(other_track));
|
events.push(CmusEvent::TrackChanged(other_track)); // FIXME: if the track changed, and the status or possition changed, we should push the track changed event, not position or status changed.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,19 +87,49 @@ impl CmusQueryResponse {
|
||||||
let other_player_settings = other.player_settings()?;
|
let other_player_settings = other.player_settings()?;
|
||||||
|
|
||||||
if player_settings != other_player_settings {
|
if player_settings != other_player_settings {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"Player settings changed: {:?} -> {:?}",
|
||||||
|
other_player_settings, player_settings
|
||||||
|
);
|
||||||
|
|
||||||
if player_settings.shuffle != other_player_settings.shuffle {
|
if player_settings.shuffle != other_player_settings.shuffle {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"Shuffle changed: {:?} -> {:?}",
|
||||||
|
other_player_settings.shuffle, player_settings.shuffle
|
||||||
|
);
|
||||||
|
|
||||||
events.push(CmusEvent::ShuffleChanged(player_settings.shuffle));
|
events.push(CmusEvent::ShuffleChanged(player_settings.shuffle));
|
||||||
}
|
}
|
||||||
|
|
||||||
if player_settings.repeat != other_player_settings.repeat {
|
if player_settings.repeat != other_player_settings.repeat {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"Repeat changed: {:?} -> {:?}",
|
||||||
|
other_player_settings.repeat, player_settings.repeat
|
||||||
|
);
|
||||||
|
|
||||||
events.push(CmusEvent::RepeatChanged(player_settings.repeat));
|
events.push(CmusEvent::RepeatChanged(player_settings.repeat));
|
||||||
}
|
}
|
||||||
|
|
||||||
if player_settings.aaa_mode != other_player_settings.aaa_mode {
|
if player_settings.aaa_mode != other_player_settings.aaa_mode {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"AAA mode changed: {:?} -> {:?}",
|
||||||
|
other_player_settings.aaa_mode, player_settings.aaa_mode
|
||||||
|
);
|
||||||
|
|
||||||
events.push(CmusEvent::AAAMode(player_settings.aaa_mode));
|
events.push(CmusEvent::AAAMode(player_settings.aaa_mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
if player_settings.volume != other_player_settings.volume {
|
if player_settings.volume != other_player_settings.volume {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"Volume changed: {:?} -> {:?}",
|
||||||
|
other_player_settings.volume, player_settings.volume
|
||||||
|
);
|
||||||
|
|
||||||
events.push(CmusEvent::VolumeChanged {
|
events.push(CmusEvent::VolumeChanged {
|
||||||
left: player_settings.volume.left,
|
left: player_settings.volume.left,
|
||||||
right: player_settings.volume.right,
|
right: player_settings.volume.right,
|
||||||
|
@ -83,6 +137,9 @@ impl CmusQueryResponse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("Returning events: {:?}", events);
|
||||||
|
|
||||||
Ok(events)
|
Ok(events)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
32
src/lib.rs
32
src/lib.rs
|
@ -1,10 +1,12 @@
|
||||||
#![feature(assert_matches)]
|
#![feature(assert_matches)]
|
||||||
|
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
use log::{debug, info};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
pub mod cmus;
|
pub mod cmus;
|
||||||
pub mod settings;
|
|
||||||
pub mod notification;
|
pub mod notification;
|
||||||
|
pub mod settings;
|
||||||
|
|
||||||
/// Extracts the first embedded picture from an ID3 tag of an Audio file.
|
/// Extracts the first embedded picture from an ID3 tag of an Audio file.
|
||||||
///
|
///
|
||||||
|
@ -70,6 +72,11 @@ pub fn search_for(
|
||||||
max_depth: u8,
|
max_depth: u8,
|
||||||
regx: ®ex::Regex,
|
regx: ®ex::Regex,
|
||||||
) -> std::io::Result<Option<String>> {
|
) -> std::io::Result<Option<String>> {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
{
|
||||||
|
info!("Searching for a file that matches the regular {regx:?} expression in \"{search_directory}\" and its subdirectories.");
|
||||||
|
info!("Max depth: {max_depth}");
|
||||||
|
}
|
||||||
let mut max_depth = max_depth;
|
let mut max_depth = max_depth;
|
||||||
let mut search_directory = search_directory;
|
let mut search_directory = search_directory;
|
||||||
|
|
||||||
|
@ -81,6 +88,11 @@ pub fn search_for(
|
||||||
if max_depth == 0 {
|
if max_depth == 0 {
|
||||||
break Ok(None);
|
break Ok(None);
|
||||||
} else {
|
} else {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
{
|
||||||
|
info!("Could not find a file that matches the regular {regx:?} expression in \"{search_directory}\", searching in the parent directory.");
|
||||||
|
info!("Max depth: {max_depth}");
|
||||||
|
}
|
||||||
// If the max depth is not reached, search in the parent directory.
|
// If the max depth is not reached, search in the parent directory.
|
||||||
max_depth -= 1;
|
max_depth -= 1;
|
||||||
search_directory = {
|
search_directory = {
|
||||||
|
@ -116,12 +128,16 @@ pub fn track_cover(
|
||||||
no_use_external_cover: bool,
|
no_use_external_cover: bool,
|
||||||
) -> TrackCover {
|
) -> TrackCover {
|
||||||
if !force_use_external_cover {
|
if !force_use_external_cover {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("Trying to get the embedded cover of \"{track_path}\".");
|
||||||
if let Ok(Some(cover)) = get_embedded_art(track_path) {
|
if let Ok(Some(cover)) = get_embedded_art(track_path) {
|
||||||
return TrackCover::Embedded(cover);
|
return TrackCover::Embedded(cover);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !no_use_external_cover {
|
if !no_use_external_cover {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("Trying to get the external cover of \"{track_path}\".");
|
||||||
if let Ok(Some(cover)) = search_for(
|
if let Ok(Some(cover)) = search_for(
|
||||||
track_path,
|
track_path,
|
||||||
max_depth,
|
max_depth,
|
||||||
|
@ -131,6 +147,9 @@ pub fn track_cover(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("Could not get the cover of \"{track_path}\".");
|
||||||
|
|
||||||
TrackCover::None
|
TrackCover::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +174,12 @@ fn search(search_directory: &str, matcher: ®ex::Regex) -> std::io::Result<Opt
|
||||||
/// Replace all the placeholders in the template with their matching value.
|
/// Replace all the placeholders in the template with their matching value.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn process_template_placeholders(template: &String, track: &cmus::Track) -> String {
|
pub fn process_template_placeholders(template: &String, track: &cmus::Track) -> String {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
{
|
||||||
|
info!("Processing the template placeholders.");
|
||||||
|
debug!("Template: {template}");
|
||||||
|
debug!("Track: {track:?}");
|
||||||
|
}
|
||||||
let mut processed = template.clone();
|
let mut processed = template.clone();
|
||||||
|
|
||||||
let mut key = String::new(); // Just a buffer to store the key.
|
let mut key = String::new(); // Just a buffer to store the key.
|
||||||
|
@ -163,6 +188,8 @@ pub fn process_template_placeholders(template: &String, track: &cmus::Track) ->
|
||||||
if c == '{' {
|
if c == '{' {
|
||||||
key = String::new();
|
key = String::new();
|
||||||
} else if c == '}' {
|
} else if c == '}' {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("Replacing the placeholder {{{key}}} with its matching value.");
|
||||||
// Replace the key with their matching value if exists, if not replace with the empty string.
|
// Replace the key with their matching value if exists, if not replace with the empty string.
|
||||||
processed = processed.replace(
|
processed = processed.replace(
|
||||||
&format!("{{{}}}", key),
|
&format!("{{{}}}", key),
|
||||||
|
@ -176,6 +203,9 @@ pub fn process_template_placeholders(template: &String, track: &cmus::Track) ->
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("Processed template: {processed}");
|
||||||
|
|
||||||
processed
|
processed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,26 @@
|
||||||
use crate::cmus::events::CmusEvent;
|
use crate::cmus::events::CmusEvent;
|
||||||
use crate::settings::Settings;
|
use crate::settings::Settings;
|
||||||
use crate::TrackCover;
|
use crate::TrackCover;
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
use log::info;
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn show_notification(events: Vec<CmusEvent>, settings: &Settings, previous_cover: &mut TrackCover) -> Result<(), notify_rust::error::Error> {
|
pub fn show_notification(
|
||||||
|
events: Vec<CmusEvent>,
|
||||||
|
settings: &Settings,
|
||||||
|
previous_cover: &mut TrackCover,
|
||||||
|
) -> Result<(), notify_rust::error::Error> {
|
||||||
if events.is_empty() {
|
if events.is_empty() {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("no events to process");
|
||||||
return Ok(()); // No events to process.
|
return Ok(()); // No events to process.
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut notification = notify_rust::Notification::new();
|
let mut notification = notify_rust::Notification::new();
|
||||||
|
|
||||||
for event in events {
|
for event in events {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("event: {:?}", event);
|
||||||
match event {
|
match event {
|
||||||
CmusEvent::StatusChanged(status) => {
|
CmusEvent::StatusChanged(status) => {
|
||||||
println!("{:?}", status);
|
println!("{:?}", status);
|
||||||
|
|
100
src/settings.rs
100
src/settings.rs
|
@ -1,4 +1,6 @@
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
use log::{debug, info};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
const NOTIFICATION_TIMEOUT: u8 = 5;
|
const NOTIFICATION_TIMEOUT: u8 = 5;
|
||||||
|
@ -25,7 +27,6 @@ const DEFAULT_LYRICS_NOTIFICATION_BODY: &str = "{lyrics}";
|
||||||
#[cfg(feature = "lyrics")]
|
#[cfg(feature = "lyrics")]
|
||||||
const DEFAULT_LYRICS_NOTIFICATION_SUMMARY: &str = "Lyrics";
|
const DEFAULT_LYRICS_NOTIFICATION_SUMMARY: &str = "Lyrics";
|
||||||
|
|
||||||
|
|
||||||
#[derive(Parser, Debug, Serialize, Deserialize)]
|
#[derive(Parser, Debug, Serialize, Deserialize)]
|
||||||
#[command(author, about, version, long_about = None)]
|
#[command(author, about, version, long_about = None)]
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
|
@ -279,7 +280,14 @@ impl Default for Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Settings {
|
impl Settings {
|
||||||
|
/// Load the config file and parse the args.
|
||||||
|
/// And combine them together.
|
||||||
|
/// The args will override the config.
|
||||||
|
/// If the config file is not found, create a new one, and use the default values.
|
||||||
|
/// If the config file is found, but the config is invalid, use the default values.
|
||||||
pub fn load_config_and_parse_args() -> Self {
|
pub fn load_config_and_parse_args() -> Self {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("Loading config and parsing args...");
|
||||||
// load config file
|
// load config file
|
||||||
let cfg: Self = match confy::load("cmus-notify", "config") {
|
let cfg: Self = match confy::load("cmus-notify", "config") {
|
||||||
Ok(cfg) => cfg,
|
Ok(cfg) => cfg,
|
||||||
|
@ -289,17 +297,38 @@ impl Settings {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
{
|
||||||
|
debug!("Config: {:?}", cfg);
|
||||||
|
info!("Parsing args...")
|
||||||
|
}
|
||||||
|
|
||||||
// parse the args
|
// parse the args
|
||||||
let mut args = Settings::parse();
|
let mut args = Settings::parse();
|
||||||
|
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
{
|
||||||
|
debug!("Args: {:?}", args);
|
||||||
|
info!("Combining config and args...")
|
||||||
|
}
|
||||||
|
|
||||||
// Combine the config and args(the args will override the config)
|
// Combine the config and args(the args will override the config)
|
||||||
if args.timeout == NOTIFICATION_TIMEOUT {
|
if args.timeout == NOTIFICATION_TIMEOUT {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"The user not override the timeout, using the config's timeout. timeout: {}",
|
||||||
|
cfg.timeout
|
||||||
|
);
|
||||||
args.timeout = cfg.timeout;
|
args.timeout = cfg.timeout;
|
||||||
}
|
}
|
||||||
if args.persistent == false {
|
if args.persistent == false {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the persistent, using the config's persistent. persistent: {}", cfg.persistent);
|
||||||
args.persistent = cfg.persistent;
|
args.persistent = cfg.persistent;
|
||||||
}
|
}
|
||||||
if args.show_track_cover == true {
|
if args.show_track_cover == true {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the show_track_cover, using the config's show_track_cover. show_track_cover: {}", cfg.show_track_cover);
|
||||||
args.show_track_cover = cfg.show_track_cover;
|
args.show_track_cover = cfg.show_track_cover;
|
||||||
}
|
}
|
||||||
args.notification_static_icon = args
|
args.notification_static_icon = args
|
||||||
|
@ -308,84 +337,153 @@ impl Settings {
|
||||||
args.cover_path = args.cover_path.or(cfg.cover_path);
|
args.cover_path = args.cover_path.or(cfg.cover_path);
|
||||||
#[cfg(feature = "lyrics")]
|
#[cfg(feature = "lyrics")]
|
||||||
if args.lyrics_path == None {
|
if args.lyrics_path == None {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the lyrics_path, using the config's lyrics_path. lyrics_path: {:?}", cfg.lyrics_path);
|
||||||
args.lyrics_path = cfg.lyrics_path;
|
args.lyrics_path = cfg.lyrics_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.depth == DEFAULT_MAX_DEPTH {
|
if args.depth == DEFAULT_MAX_DEPTH {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"The user not override the depth, using the config's depth. depth: {}",
|
||||||
|
cfg.depth
|
||||||
|
);
|
||||||
args.depth = cfg.depth;
|
args.depth = cfg.depth;
|
||||||
}
|
}
|
||||||
if args.app_name == NOTIFICATION_APP_NAME {
|
if args.app_name == NOTIFICATION_APP_NAME {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"The user not override the app_name, using the config's app_name. app_name: {}",
|
||||||
|
cfg.app_name
|
||||||
|
);
|
||||||
args.app_name = cfg.app_name;
|
args.app_name = cfg.app_name;
|
||||||
}
|
}
|
||||||
if args.summary == NOTIFICATION_SUMMARY {
|
if args.summary == NOTIFICATION_SUMMARY {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"The user not override the summary, using the config's summary. summary: {}",
|
||||||
|
cfg.summary
|
||||||
|
);
|
||||||
args.summary = cfg.summary;
|
args.summary = cfg.summary;
|
||||||
}
|
}
|
||||||
if args.body == NOTIFICATION_BODY {
|
if args.body == NOTIFICATION_BODY {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"The user not override the body, using the config's body. body: {}",
|
||||||
|
cfg.body
|
||||||
|
);
|
||||||
args.body = cfg.body;
|
args.body = cfg.body;
|
||||||
}
|
}
|
||||||
args.cmus_remote_bin_path = args.cmus_remote_bin_path.or(cfg.cmus_remote_bin_path);
|
args.cmus_remote_bin_path = args.cmus_remote_bin_path.or(cfg.cmus_remote_bin_path);
|
||||||
args.cmus_socket_address = args.cmus_socket_address.or(cfg.cmus_socket_address);
|
args.cmus_socket_address = args.cmus_socket_address.or(cfg.cmus_socket_address);
|
||||||
args.cmus_socket_password = args.cmus_socket_password.or(cfg.cmus_socket_password);
|
args.cmus_socket_password = args.cmus_socket_password.or(cfg.cmus_socket_password);
|
||||||
if args.interval == DEFAULT_INTERVAL_TIME {
|
if args.interval == DEFAULT_INTERVAL_TIME {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"The user not override the interval, using the config's interval. interval: {}",
|
||||||
|
cfg.interval
|
||||||
|
);
|
||||||
args.interval = cfg.interval;
|
args.interval = cfg.interval;
|
||||||
}
|
}
|
||||||
if args.link == false {
|
if args.link == false {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!(
|
||||||
|
"The user not override the link, using the config's link. link: {}",
|
||||||
|
cfg.link
|
||||||
|
);
|
||||||
args.link = cfg.link;
|
args.link = cfg.link;
|
||||||
}
|
}
|
||||||
if args.force_use_external_cover == false {
|
if args.force_use_external_cover == false {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the force_use_external_cover, using the config's force_use_external_cover. force_use_external_cover: {}", cfg.force_use_external_cover);
|
||||||
args.force_use_external_cover = cfg.force_use_external_cover;
|
args.force_use_external_cover = cfg.force_use_external_cover;
|
||||||
}
|
}
|
||||||
#[cfg(feature = "lyrics")]
|
#[cfg(feature = "lyrics")]
|
||||||
if args.force_use_external_lyrics == false {
|
if args.force_use_external_lyrics == false {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the force_use_external_lyrics, using the config's force_use_external_lyrics. force_use_external_lyrics: {}", cfg.force_use_external_lyrics);
|
||||||
args.force_use_external_lyrics = cfg.force_use_external_lyrics;
|
args.force_use_external_lyrics = cfg.force_use_external_lyrics;
|
||||||
}
|
}
|
||||||
if args.no_use_external_cover == false {
|
if args.no_use_external_cover == false {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the no_use_external_cover, using the config's no_use_external_cover. no_use_external_cover: {}", cfg.no_use_external_cover);
|
||||||
args.no_use_external_cover = cfg.no_use_external_cover;
|
args.no_use_external_cover = cfg.no_use_external_cover;
|
||||||
}
|
}
|
||||||
#[cfg(feature = "lyrics")]
|
#[cfg(feature = "lyrics")]
|
||||||
if args.no_use_external_lyrics == false {
|
if args.no_use_external_lyrics == false {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the no_use_external_lyrics, using the config's no_use_external_lyrics. no_use_external_lyrics: {}", cfg.no_use_external_lyrics);
|
||||||
args.no_use_external_lyrics = cfg.no_use_external_lyrics;
|
args.no_use_external_lyrics = cfg.no_use_external_lyrics;
|
||||||
}
|
}
|
||||||
if args.show_player_notifications == false {
|
if args.show_player_notifications == false {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the show_player_notifications, using the config's show_player_notifications. show_player_notifications: {}", cfg.show_player_notifications);
|
||||||
args.show_player_notifications = cfg.show_player_notifications;
|
args.show_player_notifications = cfg.show_player_notifications;
|
||||||
}
|
}
|
||||||
if args.volume_notification_body == DEFAULT_VOLUME_CHANGE_NOTIFICATION_BODY {
|
if args.volume_notification_body == DEFAULT_VOLUME_CHANGE_NOTIFICATION_BODY {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the volume_notification_body, using the config's volume_notification_body. volume_notification_body: {}", cfg.volume_notification_body);
|
||||||
args.volume_notification_body = cfg.volume_notification_body;
|
args.volume_notification_body = cfg.volume_notification_body;
|
||||||
}
|
}
|
||||||
if args.volume_notification_summary == DEFAULT_VOLUME_CHANGE_NOTIFICATION_SUMMARY {
|
if args.volume_notification_summary == DEFAULT_VOLUME_CHANGE_NOTIFICATION_SUMMARY {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the volume_notification_summary, using the config's volume_notification_summary. volume_notification_summary: {}", cfg.volume_notification_summary);
|
||||||
args.volume_notification_summary = cfg.volume_notification_summary;
|
args.volume_notification_summary = cfg.volume_notification_summary;
|
||||||
}
|
}
|
||||||
if args.volume_notification_timeout == DEFAULT_VOLUME_CHANGE_NOTIFICATION_TIMEOUT {
|
if args.volume_notification_timeout == DEFAULT_VOLUME_CHANGE_NOTIFICATION_TIMEOUT {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the volume_notification_timeout, using the config's volume_notification_timeout. volume_notification_timeout: {}", cfg.volume_notification_timeout);
|
||||||
args.volume_notification_timeout = cfg.volume_notification_timeout;
|
args.volume_notification_timeout = cfg.volume_notification_timeout;
|
||||||
}
|
}
|
||||||
if args.shuffle_notification_body == DEFAULT_SHUFFLE_NOTIFICATION_BODY {
|
if args.shuffle_notification_body == DEFAULT_SHUFFLE_NOTIFICATION_BODY {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the shuffle_notification_body, using the config's shuffle_notification_body. shuffle_notification_body: {}", cfg.shuffle_notification_body);
|
||||||
args.shuffle_notification_body = cfg.shuffle_notification_body;
|
args.shuffle_notification_body = cfg.shuffle_notification_body;
|
||||||
}
|
}
|
||||||
if args.shuffle_notification_summary == DEFAULT_SHUFFLE_NOTIFICATION_SUMMARY {
|
if args.shuffle_notification_summary == DEFAULT_SHUFFLE_NOTIFICATION_SUMMARY {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the shuffle_notification_summary, using the config's shuffle_notification_summary. shuffle_notification_summary: {}", cfg.shuffle_notification_summary);
|
||||||
args.shuffle_notification_summary = cfg.shuffle_notification_summary;
|
args.shuffle_notification_summary = cfg.shuffle_notification_summary;
|
||||||
}
|
}
|
||||||
if args.shuffle_notification_timeout == DEFAULT_SHUFFLE_NOTIFICATION_TIMEOUT {
|
if args.shuffle_notification_timeout == DEFAULT_SHUFFLE_NOTIFICATION_TIMEOUT {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the shuffle_notification_timeout, using the config's shuffle_notification_timeout. shuffle_notification_timeout: {}", cfg.shuffle_notification_timeout);
|
||||||
args.shuffle_notification_timeout = cfg.shuffle_notification_timeout;
|
args.shuffle_notification_timeout = cfg.shuffle_notification_timeout;
|
||||||
}
|
}
|
||||||
if args.repeat_notification_body == DEFAULT_REPEAT_NOTIFICATION_BODY {
|
if args.repeat_notification_body == DEFAULT_REPEAT_NOTIFICATION_BODY {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the repeat_notification_body, using the config's repeat_notification_body. repeat_notification_body: {}", cfg.repeat_notification_body);
|
||||||
args.repeat_notification_body = cfg.repeat_notification_body;
|
args.repeat_notification_body = cfg.repeat_notification_body;
|
||||||
}
|
}
|
||||||
if args.repeat_notification_summary == DEFAULT_REPEAT_NOTIFICATION_SUMMARY {
|
if args.repeat_notification_summary == DEFAULT_REPEAT_NOTIFICATION_SUMMARY {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the repeat_notification_summary, using the config's repeat_notification_summary. repeat_notification_summary: {}", cfg.repeat_notification_summary);
|
||||||
args.repeat_notification_summary = cfg.repeat_notification_summary;
|
args.repeat_notification_summary = cfg.repeat_notification_summary;
|
||||||
}
|
}
|
||||||
if args.repeat_notification_timeout == DEFAULT_REPEAT_NOTIFICATION_TIMEOUT {
|
if args.repeat_notification_timeout == DEFAULT_REPEAT_NOTIFICATION_TIMEOUT {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the repeat_notification_timeout, using the config's repeat_notification_timeout. repeat_notification_timeout: {}", cfg.repeat_notification_timeout);
|
||||||
args.repeat_notification_timeout = cfg.repeat_notification_timeout;
|
args.repeat_notification_timeout = cfg.repeat_notification_timeout;
|
||||||
}
|
}
|
||||||
if args.aaa_mode_notification_body == DEFAULT_AAAMODE_NOTIFICATION_BODY {
|
if args.aaa_mode_notification_body == DEFAULT_AAAMODE_NOTIFICATION_BODY {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the aaa_mode_notification_body, using the config's aaa_mode_notification_body. aaa_mode_notification_body: {}", cfg.aaa_mode_notification_body);
|
||||||
args.aaa_mode_notification_body = cfg.aaa_mode_notification_body;
|
args.aaa_mode_notification_body = cfg.aaa_mode_notification_body;
|
||||||
}
|
}
|
||||||
if args.aaa_mode_notification_summary == DEFAULT_AAAMODE_NOTIFICATION_SUMMARY {
|
if args.aaa_mode_notification_summary == DEFAULT_AAAMODE_NOTIFICATION_SUMMARY {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the aaa_mode_notification_summary, using the config's aaa_mode_notification_summary. aaa_mode_notification_summary: {}", cfg.aaa_mode_notification_summary);
|
||||||
args.aaa_mode_notification_summary = cfg.aaa_mode_notification_summary;
|
args.aaa_mode_notification_summary = cfg.aaa_mode_notification_summary;
|
||||||
}
|
}
|
||||||
if args.aaa_mode_notification_timeout == DEFAULT_AAAMODE_NOTIFICATION_TIMEOUT {
|
if args.aaa_mode_notification_timeout == DEFAULT_AAAMODE_NOTIFICATION_TIMEOUT {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
debug!("The user not override the aaa_mode_notification_timeout, using the config's aaa_mode_notification_timeout. aaa_mode_notification_timeout: {}", cfg.aaa_mode_notification_timeout);
|
||||||
args.aaa_mode_notification_timeout = cfg.aaa_mode_notification_timeout;
|
args.aaa_mode_notification_timeout = cfg.aaa_mode_notification_timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
info!("The final settings: {:?}", args);
|
||||||
|
|
||||||
args
|
args
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue