diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index c8f7d50..315af8e 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -19,14 +19,8 @@ jobs: fail-fast: false steps: - uses: actions/checkout@v3 - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 - name: install Rust stable uses: dtolnay/rust-toolchain@stable - - name: Setup alsa - run: | - sudo apt-get update - sudo apt-get install -y libasound2-dev gcc alsa - name: Build run: | cargo build --verbose --release diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index bb3c20f..6e96b8e 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -19,8 +19,6 @@ jobs: fail-fast: false steps: - uses: actions/checkout@v3 - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 - name: install Rust stable uses: dtolnay/rust-toolchain@stable - name: Build diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index c2dffab..ee6c4e7 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -19,8 +19,6 @@ jobs: fail-fast: false steps: - uses: actions/checkout@v3 - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 - name: install Rust stable uses: dtolnay/rust-toolchain@stable - name: Build diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c38d994..566c07e 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -19,14 +19,8 @@ jobs: fail-fast: false steps: - uses: actions/checkout@v3 - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 - name: install Rust stable uses: dtolnay/rust-toolchain@stable - - name: Setup alsa - run: | - sudo apt-get update - sudo apt-get install -y libasound2-dev gcc alsa - name: Build run: | cargo build --verbose --release diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b4ce110..afbc1e1 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -19,8 +19,6 @@ jobs: fail-fast: false steps: - uses: actions/checkout@v3 - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 - name: install Rust stable uses: dtolnay/rust-toolchain@stable - name: Build diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 9d66e84..70fca7c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -19,8 +19,6 @@ jobs: fail-fast: false steps: - uses: actions/checkout@v3 - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 - name: install Rust stable uses: dtolnay/rust-toolchain@stable - name: Build diff --git a/Cargo.lock b/Cargo.lock index 8950120..0b1cec4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -69,28 +69,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "alsa" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5915f52fe2cf65e83924d037b6c5290b7cee097c6b5c8700746e6168a343fd6b" -dependencies = [ - "alsa-sys", - "bitflags 1.3.2", - "libc", - "nix", -] - -[[package]] -name = "alsa-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" -dependencies = [ - "libc", - "pkg-config", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -120,7 +98,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.63", ] [[package]] @@ -206,30 +184,10 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.61", + "syn 2.0.63", "which", ] -[[package]] -name = "bindgen" -version = "0.69.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" -dependencies = [ - "bitflags 2.5.0", - "cexpr", - "clang-sys", - "itertools", - "lazy_static", - "lazycell", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.61", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -260,6 +218,12 @@ dependencies = [ "generic-array", ] +[[package]] +name = "built" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41bfbdb21256b87a8b5e80fab81a8eed158178e812fd7ba451907518b2742f16" + [[package]] name = "bumpalo" version = "3.16.0" @@ -283,17 +247,6 @@ name = "cc" version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" -dependencies = [ - "jobserver", - "libc", - "once_cell", -] - -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" [[package]] name = "cexpr" @@ -355,25 +308,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "cmake" -version = "0.1.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" -dependencies = [ - "cc", -] - -[[package]] -name = "combine" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" -dependencies = [ - "bytes", - "memchr", -] - [[package]] name = "console" version = "0.15.8" @@ -393,50 +327,6 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" -[[package]] -name = "coreaudio-rs" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11894b20ebfe1ff903cbdc52259693389eea03b94918a2def2c30c3bf227ad88" -dependencies = [ - "bitflags 1.3.2", - "coreaudio-sys", -] - -[[package]] -name = "coreaudio-sys" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f01585027057ff5f0a5bf276174ae4c1594a2c5bde93d5f46a016d76270f5a9" -dependencies = [ - "bindgen 0.69.4", -] - -[[package]] -name = "cpal" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74117836a5124f3629e4b474eed03e479abaf98988b4bb317e29f08cfe0e4116" -dependencies = [ - "alsa", - "core-foundation-sys", - "coreaudio-rs", - "jni", - "js-sys", - "lazy_static", - "libc", - "mach", - "ndk", - "ndk-glue", - "nix", - "oboe", - "parking_lot 0.11.2", - "stdweb", - "thiserror", - "web-sys", - "winapi", -] - [[package]] name = "cpufeatures" version = "0.2.12" @@ -446,6 +336,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crc" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49fc9a695bca7f35f5f4c15cddc84415f66a74ea78eef08e90c5024f2b540e23" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403" + [[package]] name = "crc32fast" version = "1.4.0" @@ -455,6 +360,21 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" + [[package]] name = "crypto-common" version = "0.1.6" @@ -484,41 +404,6 @@ dependencies = [ "cipher", ] -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 1.0.109", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core", - "quote", - "syn 1.0.109", -] - [[package]] name = "digest" version = "0.9.0" @@ -612,12 +497,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] -name = "flac-bound" -version = "0.3.0" +name = "flacenc" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d438dc79612e982e62d0d86a1fd434b4f536cddf156ce02063cd56fc3d8d426c" +checksum = "fb6da14d3c6605689b5c9ed5187a5218a6d3888e14b747bc18fd4e4bafd452bd" dependencies = [ - "libflac-sys", + "built", + "crc", + "crossbeam-channel", + "heapless", + "log", + "md-5", + "num-traits", + "rustversion", + "seq-macro", + "serde", ] [[package]] @@ -701,7 +595,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.63", ] [[package]] @@ -776,6 +670,15 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -812,6 +715,17 @@ dependencies = [ "http", ] +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32", + "serde", + "stable_deref_trait", +] + [[package]] name = "heck" version = "0.3.3" @@ -984,12 +898,6 @@ dependencies = [ "flate2", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.5.0" @@ -1052,50 +960,12 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" -[[package]] -name = "jni" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" -dependencies = [ - "cesu8", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", -] - -[[package]] -name = "jni-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - -[[package]] -name = "jobserver" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.69" @@ -1134,16 +1004,6 @@ version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" -[[package]] -name = "libflac-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "358a7beee1a8a2b28876814d6dbf06126255b062a59f02779143ec68cb9e54e7" -dependencies = [ - "cmake", - "libc", -] - [[package]] name = "libloading" version = "0.8.3" @@ -1338,7 +1198,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5190a0b9bcc7f70ee4196a6b4a1c731d405ca130d4a6fcd4c561cfdde8b7cfb7" dependencies = [ "byteorder", - "cpal", "futures-executor", "futures-util", "lewton", @@ -1347,10 +1206,9 @@ dependencies = [ "librespot-metadata", "log", "ogg", - "parking_lot 0.12.2", + "parking_lot", "rand", "rand_distr", - "rodio", "shell-words", "thiserror", "tokio", @@ -1390,22 +1248,13 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - [[package]] name = "machine-uid" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "958d2e0ee250103b08a70a5785ca5abcd077a47584b35087248a93758c699f29" dependencies = [ - "bindgen 0.66.1", + "bindgen", "cc", "winreg", ] @@ -1425,6 +1274,16 @@ dependencies = [ "regex-automata 0.1.10", ] +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest 0.10.7", +] + [[package]] name = "memchr" version = "2.7.2" @@ -1508,62 +1367,6 @@ dependencies = [ "serde", ] -[[package]] -name = "ndk" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" -dependencies = [ - "bitflags 1.3.2", - "jni-sys", - "ndk-sys", - "num_enum", - "thiserror", -] - -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - -[[package]] -name = "ndk-glue" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d0c4a7b83860226e6b4183edac21851f05d5a51756e97a1144b7f5a6b63e65f" -dependencies = [ - "lazy_static", - "libc", - "log", - "ndk", - "ndk-context", - "ndk-macro", - "ndk-sys", -] - -[[package]] -name = "ndk-macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" -dependencies = [ - "darling", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ndk-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" -dependencies = [ - "jni-sys", -] - [[package]] name = "nix" version = "0.23.2" @@ -1608,17 +1411,6 @@ dependencies = [ "rand", ] -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "num-integer" version = "0.1.46" @@ -1648,27 +1440,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "number_prefix" version = "0.4.0" @@ -1684,29 +1455,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "oboe" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f63c358b4fa0fbcfefd7c8be5cfc39c08ce2389f5325687e7762a48d30a5c1" -dependencies = [ - "jni", - "ndk", - "ndk-context", - "num-derive", - "num-traits", - "oboe-sys", -] - -[[package]] -name = "oboe-sys" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3370abb7372ed744232c12954d920d1a40f1c4686de9e79e800021ef492294bd" -dependencies = [ - "cc", -] - [[package]] name = "ogg" version = "0.8.0" @@ -1740,17 +1488,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] - [[package]] name = "parking_lot" version = "0.12.2" @@ -1758,21 +1495,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", - "parking_lot_core 0.9.10", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -1785,7 +1508,7 @@ dependencies = [ "cfg-if", "libc", "petgraph", - "redox_syscall 0.5.1", + "redox_syscall", "smallvec", "thread-id", "windows-targets 0.52.5", @@ -1835,12 +1558,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - [[package]] name = "portable-atomic" version = "1.6.0" @@ -1860,7 +1577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.61", + "syn 2.0.63", ] [[package]] @@ -1873,16 +1590,6 @@ dependencies = [ "indexmap 1.9.3", ] -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit", -] - [[package]] name = "proc-macro-error" version = "1.0.4" @@ -1996,15 +1703,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08ad765b21a08b1a8e5cdce052719188a23772bcbefb3c439f0baaf62c56ceac" -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.5.1" @@ -2069,15 +1767,6 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" -[[package]] -name = "rodio" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0939e9f626e6c6f1989adb6226a039c855ca483053f0ee7c98b90e41cf731e" -dependencies = [ - "cpal", -] - [[package]] name = "rpassword" version = "6.0.1" @@ -2145,21 +1834,18 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustversion" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "092474d1a01ea8278f69e6a358998405fae5b8b963ddaeb2b0b04a128bf1dfb0" + [[package]] name = "ryu" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "scopeguard" version = "1.2.0" @@ -2172,6 +1858,12 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +[[package]] +name = "seq-macro" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4" + [[package]] name = "serde" version = "1.0.201" @@ -2189,7 +1881,7 @@ checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.63", ] [[package]] @@ -2309,7 +2001,7 @@ dependencies = [ "async-trait", "audiotags", "dirs", - "flac-bound", + "flacenc", "indicatif", "lazy_static", "librespot", @@ -2323,16 +2015,10 @@ dependencies = [ ] [[package]] -name = "stdweb" -version = "0.1.3" +name = "stable_deref_trait" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "structopt" @@ -2377,9 +2063,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.61" +version = "2.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704" dependencies = [ "proc-macro2", "quote", @@ -2433,7 +2119,7 @@ checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.63", ] [[package]] @@ -2482,7 +2168,7 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot 0.12.2", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2 0.5.7", @@ -2499,7 +2185,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.63", ] [[package]] @@ -2526,23 +2212,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml_datetime" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.2.6", - "toml_datetime", - "winnow", -] - [[package]] name = "tower-service" version = "0.3.2" @@ -2568,7 +2237,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.63", ] [[package]] @@ -2698,16 +2367,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "want" version = "0.3.1" @@ -2744,7 +2403,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.63", "wasm-bindgen-shared", ] @@ -2766,7 +2425,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.63", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2777,16 +2436,6 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" -[[package]] -name = "web-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "which" version = "4.4.2" @@ -2978,15 +2627,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - [[package]] name = "winreg" version = "0.50.0" @@ -3015,5 +2655,5 @@ checksum = "125139de3f6b9d625c39e2efdd73d41bdac468ccd556556440e322be0e1bbd91" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.63", ] diff --git a/Cargo.toml b/Cargo.toml index 28ed49d..0e6aa37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,9 +13,9 @@ description = "A command-line utility to download songs and playlists from Spoti structopt = { version = "0.3", default-features = false } rpassword = "7.0" indicatif = "0.17" -librespot = "0.4.2" +librespot = { version = "0.4.2", default-features = false } tokio = { version = "1", features = ["full", "tracing"] } -flac-bound = { version = "0.3.0", default-features = false, features = ["libflac-noogg"] } +flacenc = { version = "0.4" } audiotags = "0.5" regex = "1.7.1" machine-uid = "0.5.1" @@ -25,6 +25,3 @@ tracing-subscriber = { version = "0.3", features = ["env-filter", "registry"] } lazy_static = "1.4" async-trait = "0.1" dirs = "5.0" - -[package.metadata.deb] -depends="libflac-dev" diff --git a/README.md b/README.md index 8f44eb4..5c6df77 100644 --- a/README.md +++ b/README.md @@ -4,30 +4,9 @@ A command line utility to download songs, podcasts, playlists and albums directl You need a Spotify Premium account. -## Dependencies - -spotify-dl depends on libflac - -### Debian-based distros - -``` -sudo apt install libflac-dev libasound2-dev -``` -### Red Hat-based distros - -``` -sudo dnf install flac-devel alsa-lib-devel -``` - -### MacOSX - -``` -brew install flac -``` - ## Installation -Before installation, make sure all dependencies are installed for your platform. +You can install it using `cargo`, `homebrew` or from source. ### Using `cargo` diff --git a/src/file_sink.rs b/src/file_sink.rs index 04121ce..50e6407 100644 --- a/src/file_sink.rs +++ b/src/file_sink.rs @@ -2,11 +2,12 @@ use std::path::Path; use audiotags::Tag; use audiotags::TagType; +use flacenc::component::BitRepr; +use flacenc::error::Verify; use librespot::playback::audio_backend::Sink; use librespot::playback::audio_backend::SinkError; use librespot::playback::convert::Converter; use librespot::playback::decoder::AudioPacket; -use flac_bound::FlacEncoder; use crate::track::TrackMetadata; @@ -65,23 +66,19 @@ impl Sink for FileSink { fn stop(&mut self) -> Result<(), SinkError> { tracing::info!("Writing to file: {:?}", &self.sink); - let mut encoder = FlacEncoder::new() - .ok_or(SinkError::OnWrite( - "Failed to create flac encoder".to_string(), - ))? - .channels(2) - .bits_per_sample(16) - .compression_level(self.compression) - .init_file(&self.sink) - .map_err(|e| { - SinkError::OnWrite(format!("Failed to init flac encoder: {:?}", e).to_string()) - })?; - encoder - .process_interleaved(self.content.as_slice(), (self.content.len() / 2) as u32) - .map_err(|_| SinkError::OnWrite("Failed to write flac".to_string()))?; - encoder - .finish() - .map_err(|_| SinkError::OnWrite("Failed to finish encondig".to_string()))?; + + let config = flacenc::config::Encoder::default() + .into_verified() + .map_err(|_| SinkError::OnWrite("Failed to create flac encoder".to_string()))?; + let source = flacenc::source::MemSource::from_samples(&self.content, 2, 16, 44100); + let flac_stream = flacenc::encode_with_fixed_block_size(&config, source, config.block_size) + .map_err(|_| SinkError::OnWrite("Failed to encode flac".to_string()))?; + let mut sink = flacenc::bitsink::ByteSink::new(); + flac_stream + .write(&mut sink) + .map_err(|_| SinkError::OnWrite("Failed to write flac to sink".to_string()))?; + std::fs::write(&self.sink, sink.as_slice()) + .map_err(|_| SinkError::OnWrite("Failed to write flac to file".to_string()))?; let mut tag = Tag::new() .with_tag_type(TagType::Flac) diff --git a/src/main.rs b/src/main.rs index 0baea4f..5b96e1b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,7 @@ struct Opt { short = "c", long = "compression", help = "Setting the flac compression level from 0 (fastest, least compression) to -8 (slowest, most compression). A value larger than 8 will be Treated as 8. Default is 4." +8 (slowest, most compression). A value larger than 8 will be Treated as 8. Default is 4. NOT USED." )] compression: Option, #[structopt( @@ -72,6 +72,10 @@ async fn main() -> anyhow::Result<()> { std::process::exit(1); } + if opt.compression.is_some() { + eprintln!("Compression level is not supported yet. It will be ignored."); + } + let session = create_session(opt.username, opt.password).await?; let track = get_tracks(opt.tracks, &session).await?;