Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 65b4f398d9 | |||
| 7f40cb0581 | |||
| bc15a4449d | |||
| 1cf7cec8bd | |||
| 5cf98b3c17 | |||
| 54e174eb0a | |||
| 803860cce5 | |||
| f2bfddd76e | |||
| d073ef10b5 | |||
| 399c4b8a2c | |||
| 3188d074b7 | |||
| 5242aac566 | |||
| 49003c9983 | |||
| 530446bcd6 | |||
| aa65b30873 | |||
| f1a71189c8 | |||
| cc2ac9cb37 | |||
| 511f5d1237 | |||
| ff06358268 | |||
| 183e34c217 | |||
| 755f5dbd1d | |||
| 762064efd6 | |||
| 9959a26e48 |
11
CHANGELOG.md
Normal file
11
CHANGELOG.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## v1.2.0
|
||||||
|
|
||||||
|
* "copy" encoding format added
|
||||||
|
* "jobs" cli argument added, that lets you set the number of concurrent transcodes
|
||||||
|
|
||||||
|
## v1.1.0
|
||||||
|
|
||||||
|
* "flac" encoding format added
|
||||||
|
* resampling quality set to highest/"10"
|
||||||
261
Cargo.lock
generated
261
Cargo.lock
generated
@@ -20,9 +20,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.36"
|
version = "1.0.40"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "68803225a7b13e47191bab76f2687382b60d259e8cf37f6e1893658b84bb9479"
|
checksum = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "array-init"
|
name = "array-init"
|
||||||
@@ -43,7 +43,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "audio-conv"
|
name = "audio-conv"
|
||||||
version = "1.0.0"
|
version = "1.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -78,18 +78,18 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bstr"
|
name = "bstr"
|
||||||
version = "0.2.14"
|
version = "0.2.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf"
|
checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ad1f8e949d755f9d79112b5bb46938e0ef9d3804a0b16dfab13aafcaa5f0fa72"
|
checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cassowary"
|
name = "cassowary"
|
||||||
@@ -97,12 +97,6 @@ version = "0.3.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
|
checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfg-if"
|
|
||||||
version = "0.1.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@@ -124,6 +118,12 @@ dependencies = [
|
|||||||
"vec_map",
|
"vec_map",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "convert_case"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossterm"
|
name = "crossterm"
|
||||||
version = "0.18.2"
|
version = "0.18.2"
|
||||||
@@ -151,10 +151,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derive_more"
|
name = "derive_more"
|
||||||
version = "0.99.11"
|
version = "0.99.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c"
|
checksum = "f82b1b72f1263f214c0f823371768776c4f5841b942c9883aa8e5ec584fd0ba6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"convert_case",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
@@ -162,9 +163,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dtoa"
|
name = "dtoa"
|
||||||
version = "0.4.7"
|
version = "0.4.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e"
|
checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
@@ -180,9 +181,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures"
|
name = "futures"
|
||||||
version = "0.3.8"
|
version = "0.3.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9b3b0c040a1fe6529d30b3c5944b280c7f0dcb2930d2c3062bca967b602583d0"
|
checksum = "a9d5813545e459ad3ca1bff9915e9ad7f1a47dc6a91b627ce321d5863b7dd253"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@@ -195,9 +196,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-channel"
|
name = "futures-channel"
|
||||||
version = "0.3.8"
|
version = "0.3.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4b7109687aa4e177ef6fe84553af6280ef2778bdb7783ba44c9dc3399110fe64"
|
checksum = "ce79c6a52a299137a6013061e0cf0e688fce5d7f1bc60125f520912fdb29ec25"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
@@ -205,15 +206,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-core"
|
name = "futures-core"
|
||||||
version = "0.3.8"
|
version = "0.3.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748"
|
checksum = "098cd1c6dda6ca01650f1a37a794245eb73181d0d4d4e955e2f3c37db7af1815"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-executor"
|
name = "futures-executor"
|
||||||
version = "0.3.8"
|
version = "0.3.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4caa2b2b68b880003057c1dd49f1ed937e38f22fcf6c212188a121f08cf40a65"
|
checksum = "10f6cb7042eda00f0049b1d2080aa4b93442997ee507eb3828e8bd7577f94c9d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-task",
|
"futures-task",
|
||||||
@@ -222,15 +223,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-io"
|
name = "futures-io"
|
||||||
version = "0.3.8"
|
version = "0.3.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb"
|
checksum = "365a1a1fb30ea1c03a830fdb2158f5236833ac81fa0ad12fe35b29cddc35cb04"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-macro"
|
name = "futures-macro"
|
||||||
version = "0.3.8"
|
version = "0.3.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556"
|
checksum = "668c6733a182cd7deb4f1de7ba3bf2120823835b3bcfbeacf7d2c4a773c1bb8b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-hack",
|
"proc-macro-hack",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -240,24 +241,21 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-sink"
|
name = "futures-sink"
|
||||||
version = "0.3.8"
|
version = "0.3.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f878195a49cee50e006b02b93cf7e0a95a38ac7b776b4c4d9cc1207cd20fcb3d"
|
checksum = "5c5629433c555de3d82861a7a4e3794a4c40040390907cfbfd7143a92a426c23"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-task"
|
name = "futures-task"
|
||||||
version = "0.3.8"
|
version = "0.3.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7c554eb5bf48b2426c4771ab68c6b14468b6e76cc90996f528c3338d761a4d0d"
|
checksum = "ba7aa51095076f3ba6d9a1f702f74bd05ec65f555d70d2033d55ba8d69f581bc"
|
||||||
dependencies = [
|
|
||||||
"once_cell",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-util"
|
name = "futures-util"
|
||||||
version = "0.3.8"
|
version = "0.3.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d304cff4a7b99cfb7986f7d43fbe93d175e72e704a8860787cc95e9ffd85cbd2"
|
checksum = "3c144ad54d60f23927f0a6b6d816e4271278b64f005ad65e4e35291d2de9c025"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@@ -266,7 +264,7 @@ dependencies = [
|
|||||||
"futures-sink",
|
"futures-sink",
|
||||||
"futures-task",
|
"futures-task",
|
||||||
"memchr",
|
"memchr",
|
||||||
"pin-project",
|
"pin-project-lite",
|
||||||
"pin-utils",
|
"pin-utils",
|
||||||
"proc-macro-hack",
|
"proc-macro-hack",
|
||||||
"proc-macro-nested",
|
"proc-macro-nested",
|
||||||
@@ -344,12 +342,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gstreamer"
|
name = "gstreamer"
|
||||||
version = "0.16.5"
|
version = "0.16.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5d50f822055923f1cbede233aa5dfd4ee957cf328fb3076e330886094e11d6cf"
|
checksum = "9ff5d0f7ff308ae37e6eb47b6ded17785bdea06e438a708cd09e0288c1862f33"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cfg-if 1.0.0",
|
"cfg-if",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
@@ -368,9 +366,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gstreamer-audio"
|
name = "gstreamer-audio"
|
||||||
version = "0.16.5"
|
version = "0.16.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b926a2fa1b6756cf4087fe54ac20bb9951131efe8529dfb5c151b490d9dfe242"
|
checksum = "a2e5de1fdcb26caebd09c99573e4929d76e5e20b7d44aab52587af61c89e6fd2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"array-init",
|
"array-init",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@@ -452,9 +450,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.1.17"
|
version = "0.1.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
|
checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
@@ -465,7 +463,7 @@ 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 = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec"
|
checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -485,32 +483,32 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.81"
|
version = "0.2.93"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
|
checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked-hash-map"
|
name = "linked-hash-map"
|
||||||
version = "0.5.3"
|
version = "0.5.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a"
|
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lock_api"
|
name = "lock_api"
|
||||||
version = "0.4.2"
|
version = "0.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312"
|
checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"scopeguard",
|
"scopeguard",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.11"
|
version = "0.4.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
|
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.10",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -521,9 +519,9 @@ checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mio"
|
name = "mio"
|
||||||
version = "0.7.6"
|
version = "0.7.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f33bc887064ef1fd66020c9adfc45bb9f33d75a42096c81e7c56c65b75dd1a8b"
|
checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
@@ -534,11 +532,10 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miow"
|
name = "miow"
|
||||||
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 = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"
|
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"socket2",
|
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -599,9 +596,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.5.2"
|
version = "1.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"
|
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot"
|
name = "parking_lot"
|
||||||
@@ -616,11 +613,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot_core"
|
name = "parking_lot_core"
|
||||||
version = "0.8.2"
|
version = "0.8.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272"
|
checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if",
|
||||||
"instant",
|
"instant",
|
||||||
"libc",
|
"libc",
|
||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
@@ -630,35 +627,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "paste"
|
name = "paste"
|
||||||
version = "1.0.4"
|
version = "1.0.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c5d65c4d95931acda4498f675e332fcbdc9a06705cd07086c510e9b6009cd1c1"
|
checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pin-project"
|
|
||||||
version = "1.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9ccc2237c2c489783abd8c4c80e5450fc0e98644555b1364da68cc29aa151ca7"
|
|
||||||
dependencies = [
|
|
||||||
"pin-project-internal",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pin-project-internal"
|
|
||||||
version = "1.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project-lite"
|
name = "pin-project-lite"
|
||||||
version = "0.2.0"
|
version = "0.2.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c"
|
checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-utils"
|
name = "pin-utils"
|
||||||
@@ -719,51 +696,53 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-nested"
|
name = "proc-macro-nested"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a"
|
checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.24"
|
version = "1.0.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.8"
|
version = "1.0.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df"
|
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.1.57"
|
version = "0.2.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
|
checksum = "8270314b5ccceb518e7e578952f0b72b88222d02e8f77f5ecf7abbb673539041"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.4.2"
|
version = "1.4.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
|
checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
"regex-syntax",
|
"regex-syntax",
|
||||||
"thread_local",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.6.21"
|
version = "0.6.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
|
checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "same-file"
|
name = "same-file"
|
||||||
@@ -782,18 +761,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.118"
|
version = "1.0.125"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800"
|
checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.118"
|
version = "1.0.125"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df"
|
checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -802,9 +781,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_yaml"
|
name = "serde_yaml"
|
||||||
version = "0.8.14"
|
version = "0.8.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f7baae0a99f1a324984bcdc5f0718384c1f69775f1c7eec8b859b71b443e3fd7"
|
checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dtoa",
|
"dtoa",
|
||||||
"linked-hash-map",
|
"linked-hash-map",
|
||||||
@@ -834,26 +813,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.2"
|
version = "0.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.5.1"
|
version = "1.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ae524f056d7d770e174287294f562e95044c68e88dec909a00d2094805db9d75"
|
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "socket2"
|
|
||||||
version = "0.3.19"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if 1.0.0",
|
|
||||||
"libc",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
@@ -881,9 +849,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.56"
|
version = "1.0.70"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a9802ddde94170d186eeee5005b798d9c159fa970403f1be19976d0cfb939b72"
|
checksum = "b9505f307c872bab8eb46f77ae357c8eba1fdacead58ee5a850116b1d7f82883"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -916,38 +884,29 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.23"
|
version = "1.0.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146"
|
checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.23"
|
version = "1.0.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1"
|
checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thread_local"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
|
|
||||||
dependencies = [
|
|
||||||
"lazy_static",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.0.1"
|
version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d258221f566b6c803c7b4714abadc080172b272090cdc5e244a6d4dd13c3a6bd"
|
checksum = "83f0c8e7c0addab50b663055baf787d0af7f413a46e6e7fb9559a4e4db7137a5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"bytes",
|
"bytes",
|
||||||
@@ -958,9 +917,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-macros"
|
name = "tokio-macros"
|
||||||
version = "1.0.0"
|
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 = "42517d2975ca3114b22a16192634e8241dc5cc1f130be194645970cc1c371494"
|
checksum = "caf7b11a536f46a809a8a9f0bb4237020f70ecbf115b842360afb127ea2fda57"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -978,9 +937,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tui"
|
name = "tui"
|
||||||
version = "0.13.0"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5d4e6c82bb967df89f20b875fa8835fab5d5622c6a5efa574a1f0b6d0aa6e8f6"
|
checksum = "9ced152a8e9295a5b168adc254074525c17ac4a83c90b2716274cc38118bddc9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cassowary",
|
"cassowary",
|
||||||
@@ -1021,15 +980,15 @@ checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.2"
|
version = "0.9.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
|
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "walkdir"
|
name = "walkdir"
|
||||||
version = "2.3.1"
|
version = "2.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
|
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"same-file",
|
"same-file",
|
||||||
"winapi",
|
"winapi",
|
||||||
@@ -1069,9 +1028,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yaml-rust"
|
name = "yaml-rust"
|
||||||
version = "0.4.4"
|
version = "0.4.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d"
|
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"linked-hash-map",
|
"linked-hash-map",
|
||||||
]
|
]
|
||||||
|
|||||||
10
Cargo.toml
10
Cargo.toml
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "audio-conv"
|
name = "audio-conv"
|
||||||
version = "1.0.0"
|
version = "1.2.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>"]
|
||||||
@@ -13,6 +13,12 @@ categories = [
|
|||||||
"multimedia::encoding",
|
"multimedia::encoding",
|
||||||
]
|
]
|
||||||
keywords = ["audio", "conversion", "opus", "flac"]
|
keywords = ["audio", "conversion", "opus", "flac"]
|
||||||
|
include = [
|
||||||
|
"/src/**/*",
|
||||||
|
"/example.audio-conv.yaml",
|
||||||
|
"/README.md",
|
||||||
|
"/CHANGELOG.md",
|
||||||
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
gstreamer-audio = { version = "0.16", features = ["v1_10"] }
|
gstreamer-audio = { version = "0.16", features = ["v1_10"] }
|
||||||
@@ -30,7 +36,7 @@ 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.13", default-features = false, features = ["crossterm"] }
|
tui = { version = "0.14", default-features = false, features = ["crossterm"] }
|
||||||
|
|
||||||
[dependencies.tokio]
|
[dependencies.tokio]
|
||||||
version = "1"
|
version = "1"
|
||||||
|
|||||||
34
README.md
Normal file
34
README.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# audio-conv
|
||||||
|
|
||||||
|
Takes two paths, all audio files encountered in the first path are transcoded and stored in the
|
||||||
|
second path. The directory structure from the first path gets also copied to the second path.
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
Requires *gstreamer* version 1.10 or higher with the *base* plugin.
|
||||||
|
|
||||||
|
The supported source audio formats (or even other media that is able to contain audio) depend on
|
||||||
|
the installed *gstreamer* plugins.
|
||||||
|
|
||||||
|
## Installation via nix flakes
|
||||||
|
|
||||||
|
*audio-conv* can be easily installed via *nix flakes*:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ nix profile install gitlab:chpio/audio-conv/release
|
||||||
|
```
|
||||||
|
|
||||||
|
## Generate example config
|
||||||
|
|
||||||
|
*audio-conv* is able to write an example config to your current directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ audio-conv init
|
||||||
|
```
|
||||||
|
|
||||||
|
Now you need to edit the generated *audio-conv.yaml* file. And let it convert your audio files
|
||||||
|
by running it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ audio-conv
|
||||||
|
```
|
||||||
@@ -13,9 +13,19 @@ matches:
|
|||||||
bitrate: 160
|
bitrate: 160
|
||||||
bitrate_type: vbr # or cbr
|
bitrate_type: vbr # or cbr
|
||||||
|
|
||||||
|
# for copy (copies file without transcoding it):
|
||||||
|
# to:
|
||||||
|
# codec: copy
|
||||||
|
|
||||||
# for mp3:
|
# for mp3:
|
||||||
# to:
|
# to:
|
||||||
# codec: mp3
|
# codec: mp3
|
||||||
# # one of: 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 or 320
|
# # one of: 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 or 320
|
||||||
# bitrate: 256
|
# bitrate: 256
|
||||||
# bitrate_type: vbr # or cbr
|
# bitrate_type: vbr # or cbr
|
||||||
|
|
||||||
|
# for flac:
|
||||||
|
# to:
|
||||||
|
# codec: flac
|
||||||
|
# # effort spend for the compression. 0 (fastes compression) to 9 (highest compression)
|
||||||
|
# compression: 8
|
||||||
|
|||||||
12
flake.lock
generated
12
flake.lock
generated
@@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1605370193,
|
"lastModified": 1618868421,
|
||||||
"narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=",
|
"narHash": "sha256-vyoJhLV6cJ8/tWz+l9HZLIkb9Rd9esE7p+0RL6zDR6Y=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "5021eac20303a61fafe17224c087f5519baed54d",
|
"rev": "eed214942bcfb3a8cc09eb3b28ca7d7221e44a94",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -32,11 +32,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1608633860,
|
"lastModified": 1619118726,
|
||||||
"narHash": "sha256-AGJfdJCR5jfIt8PqGiENXRqhthrS3Gxy8Wzb3Z2GsS4=",
|
"narHash": "sha256-eEB4bIcl/REE5c9rMl4k3FmI9clTfjoFky5dm73gthY=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "da1b28ab8f361fbe14dc539cd69ce1bfd015fd68",
|
"rev": "14c8ae6efbf38dd4fd5fedaeeea2641c9c0e1e97",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ 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>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -32,6 +33,12 @@ pub enum Transcode {
|
|||||||
bitrate_type: BitrateType,
|
bitrate_type: BitrateType,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#[serde(rename = "flac")]
|
||||||
|
Flac {
|
||||||
|
#[serde(default = "default_flac_compression")]
|
||||||
|
compression: u8,
|
||||||
|
},
|
||||||
|
|
||||||
#[serde(rename = "mp3")]
|
#[serde(rename = "mp3")]
|
||||||
Mp3 {
|
Mp3 {
|
||||||
#[serde(default = "default_mp3_bitrate")]
|
#[serde(default = "default_mp3_bitrate")]
|
||||||
@@ -40,13 +47,18 @@ pub enum Transcode {
|
|||||||
#[serde(default = "bitrate_type_vbr")]
|
#[serde(default = "bitrate_type_vbr")]
|
||||||
bitrate_type: BitrateType,
|
bitrate_type: BitrateType,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#[serde(rename = "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::Mp3 { .. } => "mp3",
|
Transcode::Mp3 { .. } => "mp3",
|
||||||
|
Transcode::Copy => "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,6 +67,10 @@ fn default_opus_bitrate() -> u16 {
|
|||||||
160
|
160
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_flac_compression() -> u8 {
|
||||||
|
5
|
||||||
|
}
|
||||||
|
|
||||||
fn bitrate_type_vbr() -> BitrateType {
|
fn bitrate_type_vbr() -> BitrateType {
|
||||||
BitrateType::Vbr
|
BitrateType::Vbr
|
||||||
}
|
}
|
||||||
@@ -112,7 +128,7 @@ pub fn config() -> Result<Config> {
|
|||||||
.long("config")
|
.long("config")
|
||||||
.required(false)
|
.required(false)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("path to an audio-conv config file, defaults to \"audio-conv.yaml\""),
|
.help("Path to an audio-conv config file, defaults to \"audio-conv.yaml\""),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("from")
|
Arg::with_name("from")
|
||||||
@@ -120,7 +136,7 @@ pub fn config() -> Result<Config> {
|
|||||||
.long("from")
|
.long("from")
|
||||||
.required(false)
|
.required(false)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("from directory path"),
|
.help("\"from\" directory path"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("to")
|
Arg::with_name("to")
|
||||||
@@ -128,12 +144,20 @@ pub fn config() -> Result<Config> {
|
|||||||
.long("to")
|
.long("to")
|
||||||
.required(false)
|
.required(false)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("to directory path"),
|
.help("\"to\" directory path"),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("jobs")
|
||||||
|
.short("j")
|
||||||
|
.long("jobs")
|
||||||
|
.required(false)
|
||||||
|
.takes_value(true)
|
||||||
|
.help("Allow N jobs/transcodes at once. Defaults to number of logical cores"),
|
||||||
)
|
)
|
||||||
.subcommand(SubCommand::with_name("init").about("writes an example config"))
|
.subcommand(SubCommand::with_name("init").about("writes an example config"))
|
||||||
.get_matches();
|
.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();
|
||||||
@@ -148,17 +172,17 @@ pub fn config() -> Result<Config> {
|
|||||||
.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!(
|
||||||
@@ -170,7 +194,7 @@ pub fn config() -> Result<Config> {
|
|||||||
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()
|
||||||
@@ -183,8 +207,8 @@ pub fn config() -> Result<Config> {
|
|||||||
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)
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -192,7 +216,7 @@ pub fn config() -> Result<Config> {
|
|||||||
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)
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -204,7 +228,7 @@ pub fn config() -> Result<Config> {
|
|||||||
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)
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -247,7 +271,7 @@ pub fn config() -> Result<Config> {
|
|||||||
})
|
})
|
||||||
.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")
|
||||||
@@ -261,8 +285,26 @@ pub fn config() -> Result<Config> {
|
|||||||
})
|
})
|
||||||
.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
|
||||||
|
.value_of_os("jobs")
|
||||||
|
.map(|jobs_os_str| {
|
||||||
|
let jobs_str = jobs_os_str.to_str().with_context(|| {
|
||||||
|
// TODO: use `OsStr.display` when it lands
|
||||||
|
// https://github.com/rust-lang/rust/pull/80841
|
||||||
|
format!(
|
||||||
|
"Could not convert \"jobs\" argument to string due to invalid characters",
|
||||||
|
)
|
||||||
|
})?;
|
||||||
|
jobs_str.parse().with_context(|| {
|
||||||
|
format!(
|
||||||
|
"Could not parse \"jobs\" argument \"{}\" to a number",
|
||||||
|
&jobs_str
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.transpose()?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,6 +315,6 @@ fn load_config_file(path: &Path) -> Result<Option<ConfigFile>> {
|
|||||||
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))
|
||||||
}
|
}
|
||||||
|
|||||||
338
src/main.rs
338
src/main.rs
@@ -1,9 +1,9 @@
|
|||||||
mod config;
|
mod config;
|
||||||
mod ui;
|
mod ui;
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::{Config, Transcode};
|
||||||
use anyhow::{Context, Error, Result};
|
use anyhow::{Context, Error, Result};
|
||||||
use futures::{future, pin_mut, prelude::*};
|
use futures::{pin_mut, prelude::*};
|
||||||
use glib::{subclass::prelude::*, GBoxed, GString};
|
use glib::{subclass::prelude::*, GBoxed, GString};
|
||||||
use gstreamer::{gst_element_error, prelude::*, Element};
|
use gstreamer::{gst_element_error, prelude::*, Element};
|
||||||
use gstreamer_base::prelude::*;
|
use gstreamer_base::prelude::*;
|
||||||
@@ -52,12 +52,12 @@ struct GErrorMessage {
|
|||||||
|
|
||||||
fn gmake<T: IsA<Element>>(factory_name: &str) -> Result<T> {
|
fn gmake<T: IsA<Element>>(factory_name: &str) -> Result<T> {
|
||||||
let res = gstreamer::ElementFactory::make(factory_name, None)
|
let res = gstreamer::ElementFactory::make(factory_name, None)
|
||||||
.with_context(|| format!("could not make gstreamer Element \"{}\"", factory_name))?
|
.with_context(|| format!("Could not make gstreamer Element \"{}\"", factory_name))?
|
||||||
.downcast()
|
.downcast()
|
||||||
.ok()
|
.ok()
|
||||||
.with_context(|| {
|
.with_context(|| {
|
||||||
format!(
|
format!(
|
||||||
"could not cast gstreamer Element \"{}\" into `{}`",
|
"Could not cast gstreamer Element \"{}\" into `{}`",
|
||||||
factory_name,
|
factory_name,
|
||||||
std::any::type_name::<T>()
|
std::any::type_name::<T>()
|
||||||
)
|
)
|
||||||
@@ -68,7 +68,7 @@ fn gmake<T: IsA<Element>>(factory_name: &str) -> Result<T> {
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct ConversionArgs {
|
pub struct ConversionArgs {
|
||||||
rel_from_path: PathBuf,
|
rel_from_path: PathBuf,
|
||||||
transcode: config::Transcode,
|
transcode: Transcode,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_conversion_args(config: &Config) -> impl Iterator<Item = Result<ConversionArgs>> + '_ {
|
fn get_conversion_args(config: &Config) -> impl Iterator<Item = Result<ConversionArgs>> + '_ {
|
||||||
@@ -97,7 +97,7 @@ fn get_conversion_args(config: &Config) -> impl Iterator<Item = Result<Conversio
|
|||||||
|
|
||||||
let rel_path = e.path().strip_prefix(&config.from).with_context(|| {
|
let rel_path = e.path().strip_prefix(&config.from).with_context(|| {
|
||||||
format!(
|
format!(
|
||||||
"unable to get relative path for {} from {}",
|
"Unable to get relative path for {} from {}",
|
||||||
e.path().display(),
|
e.path().display(),
|
||||||
config.from.display()
|
config.from.display()
|
||||||
)
|
)
|
||||||
@@ -112,7 +112,10 @@ fn get_conversion_args(config: &Config) -> impl Iterator<Item = Result<Conversio
|
|||||||
.map_err(Error::new)
|
.map_err(Error::new)
|
||||||
.and_then(|md| md.modified().map_err(Error::new))
|
.and_then(|md| md.modified().map_err(Error::new))
|
||||||
.with_context(|| {
|
.with_context(|| {
|
||||||
format!("unable to get mtime for from file {}", e.path().display())
|
format!(
|
||||||
|
"Unable to get mtime for \"from\" file {}",
|
||||||
|
e.path().display()
|
||||||
|
)
|
||||||
})?;
|
})?;
|
||||||
let to_mtime = to.metadata().and_then(|md| md.modified());
|
let to_mtime = to.metadata().and_then(|md| md.modified());
|
||||||
match to_mtime {
|
match to_mtime {
|
||||||
@@ -120,7 +123,7 @@ fn get_conversion_args(config: &Config) -> impl Iterator<Item = Result<Conversio
|
|||||||
Err(err) if err.kind() == std::io::ErrorKind::NotFound => true,
|
Err(err) if err.kind() == std::io::ErrorKind::NotFound => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
return Err(err).with_context(|| {
|
return Err(err).with_context(|| {
|
||||||
format!("unable to get mtime for to file {}", to.display())
|
format!("Unable to get mtime for \"to\" file {}", to.display())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,15 +150,15 @@ async fn main() -> Result<()> {
|
|||||||
let main_handle = async move {
|
let main_handle = async move {
|
||||||
let ok = task::spawn_local(main_loop(ui_queue))
|
let ok = task::spawn_local(main_loop(ui_queue))
|
||||||
.await
|
.await
|
||||||
.context("main task failed")??;
|
.context("Main task failed")??;
|
||||||
Result::<_>::Ok(ok)
|
Result::<_>::Ok(ok)
|
||||||
};
|
};
|
||||||
|
|
||||||
let ui_handle = async move {
|
let ui_handle = async move {
|
||||||
let ok = task::spawn_local(ui_fut)
|
let ok = task::spawn_local(ui_fut)
|
||||||
.await
|
.await
|
||||||
.context("ui task failed")?
|
.context("Ui task failed")?
|
||||||
.context("ui failed")?;
|
.context("Ui failed")?;
|
||||||
Result::<_>::Ok(ok)
|
Result::<_>::Ok(ok)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -168,20 +171,20 @@ async fn main() -> Result<()> {
|
|||||||
async fn main_loop(ui_queue: ui::MsgQueue) -> Result<()> {
|
async fn main_loop(ui_queue: ui::MsgQueue) -> Result<()> {
|
||||||
let (config, conv_args) = task::spawn_blocking(|| -> Result<_> {
|
let (config, conv_args) = task::spawn_blocking(|| -> Result<_> {
|
||||||
gstreamer::init()?;
|
gstreamer::init()?;
|
||||||
let config = config::config().context("could not get the config")?;
|
let config = config::config().context("Could not get the config")?;
|
||||||
|
|
||||||
let conv_args = get_conversion_args(&config)
|
let conv_args = get_conversion_args(&config)
|
||||||
.collect::<Result<Vec<_>>>()
|
.collect::<Result<Vec<_>>>()
|
||||||
.context("failed loading dir structure")?;
|
.context("Failed loading dir structure")?;
|
||||||
|
|
||||||
Ok((config, conv_args))
|
Ok((config, conv_args))
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.context("init task failed")??;
|
.context("Init task failed")??;
|
||||||
|
|
||||||
let log_path = Path::new(".")
|
let log_path = Path::new(".")
|
||||||
.canonicalize()
|
.canonicalize()
|
||||||
.context("unable to canonicalize path to log file")?
|
.context("Unable to canonicalize path to log file")?
|
||||||
.join("audio-conv.log");
|
.join("audio-conv.log");
|
||||||
|
|
||||||
ui_queue.push(ui::Msg::Init {
|
ui_queue.push(ui::Msg::Init {
|
||||||
@@ -189,9 +192,11 @@ async fn main_loop(ui_queue: ui::MsgQueue) -> Result<()> {
|
|||||||
log_path: log_path.clone(),
|
log_path: log_path.clone(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let concurrent_jobs = config.jobs.unwrap_or_else(|| num_cpus::get());
|
||||||
|
|
||||||
stream::iter(conv_args.into_iter().enumerate())
|
stream::iter(conv_args.into_iter().enumerate())
|
||||||
.map(Ok)
|
.map(Ok)
|
||||||
.try_for_each_concurrent(num_cpus::get(), |(i, args)| {
|
.try_for_each_concurrent(concurrent_jobs, |(i, args)| {
|
||||||
let config = &config;
|
let config = &config;
|
||||||
let ui_queue = &ui_queue;
|
let ui_queue = &ui_queue;
|
||||||
let log_path = &log_path;
|
let log_path = &log_path;
|
||||||
@@ -206,7 +211,7 @@ async fn main_loop(ui_queue: ui::MsgQueue) -> Result<()> {
|
|||||||
Ok(()) => ui_queue.push(ui::Msg::TaskEnd { id: i }),
|
Ok(()) => ui_queue.push(ui::Msg::TaskEnd { id: i }),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let err = err.context(format!(
|
let err = err.context(format!(
|
||||||
"failed transcoding \"{}\"",
|
"Transcoding failed for {}",
|
||||||
args.rel_from_path.display()
|
args.rel_from_path.display()
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -264,15 +269,64 @@ async fn transcode(
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let from_path = config.from.join(&args.rel_from_path);
|
let from_path = config.from.join(&args.rel_from_path);
|
||||||
let mut to_path = config.to.join(&args.rel_from_path);
|
let mut to_path = config.to.join(&args.rel_from_path);
|
||||||
to_path.set_extension(args.transcode.extension());
|
|
||||||
|
|
||||||
let file_src: Element = gmake("filesrc")?;
|
fs::create_dir_all(
|
||||||
file_src.set_property("location", &path_to_gstring(&from_path))?;
|
to_path
|
||||||
|
.parent()
|
||||||
|
.with_context(|| format!("Could not get parent dir for {}", to_path.display()))?,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
// encode into a tmp file first, then rename to actuall file name, that way we're writing
|
// encode into a tmp file first, then rename to actuall file name, that way we're writing
|
||||||
// "whole" files to the intended file path, ignoring partial files in the mtime check
|
// "whole" files to the intended file path, ignoring partial files in the mtime check
|
||||||
let to_path_tmp = to_path.with_extension("tmp");
|
let to_path_tmp = to_path.with_extension("tmp");
|
||||||
|
|
||||||
|
rm_file_on_err(&to_path_tmp, async {
|
||||||
|
match args.transcode {
|
||||||
|
Transcode::Copy => {
|
||||||
|
fs::copy(&from_path, &to_path_tmp).await.with_context(|| {
|
||||||
|
format!(
|
||||||
|
"Could not copy file from {} to {}",
|
||||||
|
from_path.display(),
|
||||||
|
to_path_tmp.display()
|
||||||
|
)
|
||||||
|
})?;
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
to_path.set_extension(args.transcode.extension());
|
||||||
|
|
||||||
|
transcode_gstreamer(
|
||||||
|
&from_path,
|
||||||
|
&to_path_tmp,
|
||||||
|
args.transcode.clone(),
|
||||||
|
task_id,
|
||||||
|
queue,
|
||||||
|
)
|
||||||
|
.await?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fs::rename(&to_path_tmp, &to_path).await.with_context(|| {
|
||||||
|
format!(
|
||||||
|
"Could not rename temporary file {} to {}",
|
||||||
|
to_path_tmp.display(),
|
||||||
|
to_path.display()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn transcode_gstreamer(
|
||||||
|
from_path: &Path,
|
||||||
|
to_path: &Path,
|
||||||
|
transcode: Transcode,
|
||||||
|
task_id: usize,
|
||||||
|
queue: &ui::MsgQueue,
|
||||||
|
) -> Result<()> {
|
||||||
|
let file_src: Element = gmake("filesrc")?;
|
||||||
|
file_src.set_property("location", &path_to_gstring(&from_path))?;
|
||||||
|
|
||||||
let decodebin: Element = gmake("decodebin")?;
|
let decodebin: Element = gmake("decodebin")?;
|
||||||
|
|
||||||
let src_elems: &[&Element] = &[&file_src, &decodebin];
|
let src_elems: &[&Element] = &[&file_src, &decodebin];
|
||||||
@@ -285,10 +339,7 @@ async fn transcode(
|
|||||||
// downgrade pipeline RC to a weak RC to break the reference cycle
|
// downgrade pipeline RC to a weak RC to break the reference cycle
|
||||||
let pipeline_weak = pipeline.downgrade();
|
let pipeline_weak = pipeline.downgrade();
|
||||||
|
|
||||||
let transcode_args = args.transcode.clone();
|
let to_path_clone = to_path.to_owned();
|
||||||
|
|
||||||
let to_path_tmp_clone = to_path_tmp.clone();
|
|
||||||
|
|
||||||
decodebin.connect_pad_added(move |decodebin, src_pad| {
|
decodebin.connect_pad_added(move |decodebin, src_pad| {
|
||||||
let insert_sink = || -> Result<()> {
|
let insert_sink = || -> Result<()> {
|
||||||
let pipeline = match pipeline_weak.upgrade() {
|
let pipeline = match pipeline_weak.upgrade() {
|
||||||
@@ -321,7 +372,7 @@ async fn transcode(
|
|||||||
|
|
||||||
let resample: Element = gmake("audioresample")?;
|
let resample: Element = gmake("audioresample")?;
|
||||||
// quality from 0 to 10
|
// quality from 0 to 10
|
||||||
resample.set_property("quality", &7)?;
|
resample.set_property("quality", &10)?;
|
||||||
|
|
||||||
let mut dest_elems = vec![
|
let mut dest_elems = vec![
|
||||||
resample,
|
resample,
|
||||||
@@ -329,8 +380,8 @@ async fn transcode(
|
|||||||
gmake("audioconvert")?,
|
gmake("audioconvert")?,
|
||||||
];
|
];
|
||||||
|
|
||||||
match &transcode_args {
|
match &transcode {
|
||||||
config::Transcode::Opus {
|
Transcode::Opus {
|
||||||
bitrate,
|
bitrate,
|
||||||
bitrate_type,
|
bitrate_type,
|
||||||
} => {
|
} => {
|
||||||
@@ -339,7 +390,7 @@ async fn transcode(
|
|||||||
"bitrate",
|
"bitrate",
|
||||||
&i32::from(*bitrate)
|
&i32::from(*bitrate)
|
||||||
.checked_mul(1_000)
|
.checked_mul(1_000)
|
||||||
.context("bitrate overflowed")?,
|
.context("Bitrate overflowed")?,
|
||||||
)?;
|
)?;
|
||||||
encoder.set_property_from_str(
|
encoder.set_property_from_str(
|
||||||
"bitrate-type",
|
"bitrate-type",
|
||||||
@@ -352,7 +403,14 @@ async fn transcode(
|
|||||||
dest_elems.push(encoder);
|
dest_elems.push(encoder);
|
||||||
dest_elems.push(gmake("oggmux")?);
|
dest_elems.push(gmake("oggmux")?);
|
||||||
}
|
}
|
||||||
config::Transcode::Mp3 {
|
|
||||||
|
Transcode::Flac { compression } => {
|
||||||
|
let encoder: Element = gmake("flacenc")?;
|
||||||
|
encoder.set_property_from_str("quality", &compression.to_string());
|
||||||
|
dest_elems.push(encoder);
|
||||||
|
}
|
||||||
|
|
||||||
|
Transcode::Mp3 {
|
||||||
bitrate,
|
bitrate,
|
||||||
bitrate_type,
|
bitrate_type,
|
||||||
} => {
|
} => {
|
||||||
@@ -371,10 +429,15 @@ async fn transcode(
|
|||||||
dest_elems.push(encoder);
|
dest_elems.push(encoder);
|
||||||
dest_elems.push(gmake("id3v2mux")?);
|
dest_elems.push(gmake("id3v2mux")?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Transcode::Copy => {
|
||||||
|
// already handled outside this fn
|
||||||
|
unreachable!();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let file_dest: gstreamer_base::BaseSink = gmake("filesink")?;
|
let file_dest: gstreamer_base::BaseSink = gmake("filesink")?;
|
||||||
file_dest.set_property("location", &path_to_gstring(&to_path_tmp_clone))?;
|
file_dest.set_property("location", &path_to_gstring(&to_path_clone))?;
|
||||||
file_dest.set_sync(false);
|
file_dest.set_sync(false);
|
||||||
dest_elems.push(file_dest.upcast());
|
dest_elems.push(file_dest.upcast());
|
||||||
|
|
||||||
@@ -410,148 +473,143 @@ async fn transcode(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let bus = pipeline.get_bus().context("pipe get bus")?;
|
let bus = pipeline
|
||||||
|
.get_bus()
|
||||||
|
.context("Could not get bus for pipeline")?;
|
||||||
|
|
||||||
fs::create_dir_all(
|
pipeline
|
||||||
to_path
|
.set_state(gstreamer::State::Playing)
|
||||||
.parent()
|
.context("Unable to set the pipeline to the `Playing` state")?;
|
||||||
.with_context(|| format!("could not get parent dir for {}", to_path.display()))?,
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
rm_file_on_err(&to_path_tmp, async {
|
let stream_processor = async {
|
||||||
pipeline
|
bus.stream()
|
||||||
.set_state(gstreamer::State::Playing)
|
.map::<Result<bool>, _>(|msg| {
|
||||||
.context("Unable to set the pipeline to the `Playing` state")?;
|
use gstreamer::MessageView;
|
||||||
|
|
||||||
let stream_processor = async {
|
match msg.view() {
|
||||||
bus.stream()
|
// MessageView::Progress() => {
|
||||||
.map::<Result<bool>, _>(|msg| {
|
|
||||||
use gstreamer::MessageView;
|
|
||||||
|
|
||||||
match msg.view() {
|
// }
|
||||||
// MessageView::Progress() => {
|
MessageView::Eos(..) => {
|
||||||
|
// we need to actively stop pulling the stream, that's because stream will
|
||||||
|
// never end despite yielding an `Eos` message
|
||||||
|
Ok(false)
|
||||||
|
}
|
||||||
|
MessageView::Error(err) => {
|
||||||
|
let pipe_stop_res = pipeline.set_state(gstreamer::State::Null);
|
||||||
|
|
||||||
// }
|
let err: Error = err
|
||||||
MessageView::Eos(..) => {
|
.get_details()
|
||||||
// we need to actively stop pulling the stream, that's because stream will
|
.and_then(|details| {
|
||||||
// never end despite yielding an `Eos` message
|
if details.get_name() != "error-details" {
|
||||||
Ok(false)
|
return None;
|
||||||
}
|
}
|
||||||
MessageView::Error(err) => {
|
|
||||||
pipeline.set_state(gstreamer::State::Null).context(
|
let err = details
|
||||||
|
.get::<&GBoxErrorWrapper>("error")
|
||||||
|
.unwrap()
|
||||||
|
.map(|err| err.clone().into())
|
||||||
|
.expect("error-details message without actual error");
|
||||||
|
Some(err)
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| {
|
||||||
|
GErrorMessage {
|
||||||
|
src: msg
|
||||||
|
.get_src()
|
||||||
|
.map(|s| String::from(s.get_path_string()))
|
||||||
|
.unwrap_or_else(|| String::from("None")),
|
||||||
|
error: err.get_error().to_string(),
|
||||||
|
debug: err.get_debug(),
|
||||||
|
source: err.get_error(),
|
||||||
|
}
|
||||||
|
.into()
|
||||||
|
});
|
||||||
|
|
||||||
|
if let Err(pipe_err) = pipe_stop_res {
|
||||||
|
let err = err.context(pipe_err).context(
|
||||||
"Unable to set the pipeline to the `Null` state, after error",
|
"Unable to set the pipeline to the `Null` state, after error",
|
||||||
)?;
|
);
|
||||||
|
Err(err)
|
||||||
let err = err
|
} else {
|
||||||
.get_details()
|
|
||||||
.and_then(|details| {
|
|
||||||
if details.get_name() != "error-details" {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let err = details
|
|
||||||
.get::<&GBoxErrorWrapper>("error")
|
|
||||||
.unwrap()
|
|
||||||
.map(|err| err.clone().into())
|
|
||||||
.expect("error-details message without actual error");
|
|
||||||
Some(err)
|
|
||||||
})
|
|
||||||
.unwrap_or_else(|| {
|
|
||||||
GErrorMessage {
|
|
||||||
src: msg
|
|
||||||
.get_src()
|
|
||||||
.map(|s| String::from(s.get_path_string()))
|
|
||||||
.unwrap_or_else(|| String::from("None")),
|
|
||||||
error: err.get_error().to_string(),
|
|
||||||
debug: err.get_debug(),
|
|
||||||
source: err.get_error(),
|
|
||||||
}
|
|
||||||
.into()
|
|
||||||
});
|
|
||||||
Err(err)
|
Err(err)
|
||||||
}
|
}
|
||||||
_ => Ok(true),
|
|
||||||
}
|
}
|
||||||
})
|
_ => Ok(true),
|
||||||
.take_while(|e| {
|
}
|
||||||
if let Ok(false) = e {
|
})
|
||||||
futures::future::ready(false)
|
.take_while(|e| {
|
||||||
} else {
|
if let Ok(false) = e {
|
||||||
futures::future::ready(true)
|
futures::future::ready(false)
|
||||||
}
|
} else {
|
||||||
})
|
futures::future::ready(true)
|
||||||
.try_for_each(|_| futures::future::ready(Ok(())))
|
}
|
||||||
.await
|
})
|
||||||
.context("failed converting")?;
|
.try_for_each(|_| futures::future::ready(Ok(())))
|
||||||
|
.await?;
|
||||||
|
|
||||||
Result::<_>::Ok(())
|
Result::<_>::Ok(())
|
||||||
};
|
};
|
||||||
pin_mut!(stream_processor);
|
pin_mut!(stream_processor);
|
||||||
|
|
||||||
let mut progress_interval = interval(Duration::from_millis(ui::UPDATE_INTERVAL_MILLIS / 2));
|
let mut progress_interval = interval(Duration::from_millis(ui::UPDATE_INTERVAL_MILLIS / 2));
|
||||||
let progress_processor = async {
|
let progress_processor = async {
|
||||||
use gstreamer::ClockTime;
|
use gstreamer::ClockTime;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
progress_interval.tick().await;
|
progress_interval.tick().await;
|
||||||
|
|
||||||
let dur = decodebin
|
let dur = decodebin
|
||||||
.query_duration::<ClockTime>()
|
.query_duration::<ClockTime>()
|
||||||
|
.and_then(|time| time.nanoseconds());
|
||||||
|
|
||||||
|
let ratio = dur.and_then(|dur| {
|
||||||
|
if dur == 0 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let pos = decodebin
|
||||||
|
.query_position::<ClockTime>()
|
||||||
.and_then(|time| time.nanoseconds());
|
.and_then(|time| time.nanoseconds());
|
||||||
|
|
||||||
let ratio = dur.and_then(|dur| {
|
pos.map(|pos| {
|
||||||
if dur == 0 {
|
let ratio = pos as f64 / dur as f64;
|
||||||
return None;
|
ratio.max(0.0).min(1.0)
|
||||||
}
|
})
|
||||||
|
});
|
||||||
|
|
||||||
let pos = decodebin
|
if let Some(ratio) = ratio {
|
||||||
.query_position::<ClockTime>()
|
queue.push(ui::Msg::TaskProgress { id: task_id, ratio });
|
||||||
.and_then(|time| time.nanoseconds());
|
|
||||||
|
|
||||||
pos.map(|pos| {
|
|
||||||
let ratio = pos as f64 / dur as f64;
|
|
||||||
ratio.max(0.0).min(1.0)
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
if let Some(ratio) = ratio {
|
|
||||||
queue.push(ui::Msg::TaskProgress { id: task_id, ratio });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(unreachable_code)]
|
#[allow(unreachable_code)]
|
||||||
Result::<_>::Ok(())
|
Result::<_>::Ok(())
|
||||||
};
|
};
|
||||||
pin_mut!(progress_processor);
|
pin_mut!(progress_processor);
|
||||||
|
|
||||||
future::try_select(stream_processor, progress_processor)
|
future::try_select(stream_processor, progress_processor)
|
||||||
.await
|
.await
|
||||||
.map_err(|err| err.factor_first().0)?;
|
.map_err(|err| err.factor_first().0)?;
|
||||||
|
|
||||||
pipeline
|
pipeline
|
||||||
.set_state(gstreamer::State::Null)
|
.set_state(gstreamer::State::Null)
|
||||||
.context("Unable to set the pipeline to the `Null` state")?;
|
.context("Unable to set the pipeline to the `Null` state")?;
|
||||||
|
|
||||||
fs::rename(&to_path_tmp, &to_path).await?;
|
Ok(())
|
||||||
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
.await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn rm_file_on_err<F, T>(path: &Path, f: F) -> F::Output
|
async fn rm_file_on_err<F, T>(path: &Path, f: F) -> Result<T>
|
||||||
where
|
where
|
||||||
F: Future<Output = Result<T>>,
|
F: Future<Output = Result<T>>,
|
||||||
{
|
{
|
||||||
match f.await {
|
match f.await {
|
||||||
Err(err) => match fs::remove_file(path).await {
|
Err(err) => match fs::remove_file(path).await {
|
||||||
Ok(..) => Err(err),
|
Ok(()) => Err(err),
|
||||||
Err(fs_err) if fs_err.kind() == std::io::ErrorKind::NotFound => Err(err),
|
Err(fs_err) if fs_err.kind() == std::io::ErrorKind::NotFound => Err(err),
|
||||||
Err(fs_err) => {
|
Err(fs_err) => {
|
||||||
let err = err
|
let err = err
|
||||||
.context(fs_err)
|
.context(fs_err)
|
||||||
.context(format!("removing {} failed", path.display()));
|
.context(format!("Removing file {} failed", path.display()));
|
||||||
Err(err)
|
Err(err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
12
src/ui.rs
12
src/ui.rs
@@ -88,7 +88,7 @@ impl State {
|
|||||||
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 } => {
|
||||||
@@ -102,7 +102,7 @@ impl State {
|
|||||||
// 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;
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ impl State {
|
|||||||
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("cleaning ui failed")?;
|
self.terminal.clear().context("Clearing ui failed")?;
|
||||||
self.has_rendered = true;
|
self.has_rendered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ impl State {
|
|||||||
chunks[1],
|
chunks[1],
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.context("rendering ui failed")?;
|
.context("Rendering ui failed")?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -267,8 +267,8 @@ pub fn init() -> (MsgQueue, impl Future<Output = Result<()>>) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.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),
|
||||||
|
|||||||
Reference in New Issue
Block a user