From 96f2d88696a464a634b9f98fe63bad9594d2dfdf Mon Sep 17 00:00:00 2001 From: Henrik Friedrichsen Date: Sun, 7 Nov 2021 17:19:56 +0100 Subject: [PATCH] Update to rspotify 0.11.2 (#640) * Update to rspotify 0.11.x Many breaking changes * Minor cleanups via Clippy --- Cargo.lock | 1485 +++++++++++++++----------------------- Cargo.toml | 7 +- src/album.rs | 35 +- src/artist.rs | 13 +- src/episode.rs | 22 +- src/library.rs | 31 +- src/mpris.rs | 12 +- src/playable.rs | 40 + src/playlist.rs | 58 +- src/queue.rs | 2 +- src/show.rs | 11 +- src/spotify.rs | 9 - src/spotify_api.rs | 426 +++++++---- src/track.rs | 39 +- src/ui/artist.rs | 4 +- src/ui/contextmenu.rs | 4 +- src/ui/listview.rs | 2 +- src/ui/playlist.rs | 9 +- src/ui/search.rs | 1 - src/ui/search_results.rs | 2 +- 20 files changed, 1025 insertions(+), 1187 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c42035d..a3beb3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ "gimli", ] @@ -108,7 +108,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -143,9 +143,9 @@ dependencies = [ "parking", "polling", "slab", - "socket2 0.4.2", + "socket2", "waker-fn", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -154,9 +154,9 @@ version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -167,15 +167,9 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi 0.3.9", + "winapi", ] -[[package]] -name = "autocfg" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" - [[package]] name = "autocfg" version = "1.0.1" @@ -184,9 +178,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.62" +version = "0.3.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "091bcdf2da9950f96aa522681ce805e6857f6ca8df73833d35736ab2dc78e152" +checksum = "321629d8ba6513061f26707241fa9bc89524ff1cd7a915a97ef0c62c666ce1b6" dependencies = [ "addr2line", "cc", @@ -198,13 +192,10 @@ dependencies = [ ] [[package]] -name = "base64" -version = "0.10.1" +name = "base-x" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -dependencies = [ - "byteorder", -] +checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" [[package]] name = "base64" @@ -224,8 +215,8 @@ dependencies = [ "lazy_static", "lazycell", "peeking_take_while", - "proc-macro2 1.0.30", - "quote 1.0.10", + "proc-macro2", + "quote", "regex", "rustc-hash", "shlex", @@ -275,22 +266,6 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - -[[package]] -name = "bytes" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" - [[package]] name = "bytes" version = "1.1.0" @@ -350,10 +325,16 @@ dependencies = [ "num-traits", "rustc-serialize", "serde", - "time", - "winapi 0.3.9", + "time 0.1.44", + "winapi", ] +[[package]] +name = "chunked_transfer" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" + [[package]] name = "cipher" version = "0.2.5" @@ -365,9 +346,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10612c0ec0e0a1ff0e97980647cb058a6e7aedb913d01d009c406b8b7d0b26ee" +checksum = "fa66045b9cb23c2e9c1520732030608b02ee07e5cfaa5a521ec15ded7fa24c90" dependencies = [ "glob", "libc", @@ -408,25 +389,16 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3a093d6fed558e5fe24c3dfc85a68bb68f1c824f440d3ba5aca189e2998786b" dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", + "winapi", ] [[package]] name = "combine" -version = "4.6.1" +version = "4.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a909e4d93292cd8e9c42e189f61681eff9d67b6541f96b8a1a737f23737bd001" +checksum = "b2b2f5d0ee456f3928812dfc8c6d9a1d592b98678f6d56db9b0cd2b7bc6c8db5" dependencies = [ - "bytes 1.1.0", + "bytes", "memchr", ] @@ -439,12 +411,46 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "const_fn" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" + [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "cookie" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f1c7727e460397e56abc4bddc1d49e07a1ad78fc98eb2e1c8f032a58a2f80d" +dependencies = [ + "percent-encoding", + "time 0.2.27", + "version_check", +] + +[[package]] +name = "cookie_store" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55b4ac5559dd39f7bdc516f769cb412b151585d8886d216871a8435ed7f862cd" +dependencies = [ + "cookie", + "idna", + "indexmap", + "log", + "publicsuffix", + "serde", + "serde_json", + "time 0.2.27", + "url", +] + [[package]] name = "core-foundation" version = "0.9.2" @@ -499,10 +505,10 @@ dependencies = [ "nix 0.20.0", "oboe", "parking_lot", - "stdweb", + "stdweb 0.1.3", "thiserror", "web-sys", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -591,45 +597,21 @@ dependencies = [ "log", "num", "owning_ref", - "syn 1.0.80", + "syn", "unicode-segmentation", "unicode-width", "wasmer_enumset", "xi-unicode", ] -[[package]] -name = "darling" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcfbcb0c5961907597a7d1148e3af036268f2b773886b8bb3eeb1e1281d3d3d6" -dependencies = [ - "darling_core 0.9.0", - "darling_macro 0.9.0", -] - [[package]] name = "darling" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" dependencies = [ - "darling_core 0.10.2", - "darling_macro 0.10.2", -] - -[[package]] -name = "darling_core" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6afc018370c3bff3eb51f89256a6bdb18b4fdcda72d577982a14954a7a0b402c" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2 0.4.30", - "quote 0.6.13", - "strsim 0.7.0", - "syn 0.15.44", + "darling_core", + "darling_macro", ] [[package]] @@ -640,21 +622,10 @@ checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.30", - "quote 1.0.10", + "proc-macro2", + "quote", "strsim 0.9.3", - "syn 1.0.80", -] - -[[package]] -name = "darling_macro" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6d8dac1c6f1d29a41c4712b4400f878cb4fcc4c7628f298dd75038e024998d1" -dependencies = [ - "darling_core 0.9.0", - "quote 0.6.13", - "syn 0.15.44", + "syn", ] [[package]] @@ -663,9 +634,9 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" dependencies = [ - "darling_core 0.10.2", - "quote 1.0.10", - "syn 1.0.80", + "darling_core", + "quote", + "syn", ] [[package]] @@ -676,7 +647,7 @@ checksum = "de0a745c25b32caa56b82a3950f5fec7893a960f4c10ca3b02060b0c38d8c2ce" dependencies = [ "libc", "libdbus-sys", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -694,34 +665,9 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", -] - -[[package]] -name = "derive_builder" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ac53fa6a3cda160df823a9346442525dcaf1e171999a1cf23e67067e4fd64d4" -dependencies = [ - "darling 0.9.0", - "derive_builder_core", - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", -] - -[[package]] -name = "derive_builder_core" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0288a23da9333c246bb18c143426074a6ae96747995c5819d2947b64cd942b37" -dependencies = [ - "darling 0.9.0", - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -741,7 +687,7 @@ checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" dependencies = [ "libc", "redox_users 0.3.5", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -762,25 +708,14 @@ checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", "redox_users 0.4.0", - "winapi 0.3.9", + "winapi", ] [[package]] -name = "dotenv" -version = "0.13.0" +name = "discard" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0d0a1279c96732bc6800ce6337b6a614697b0e74ae058dc03c62ebeb78b4d86" -dependencies = [ - "failure", - "lazy_static", - "regex", -] - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" [[package]] name = "encoding_rs" @@ -807,9 +742,9 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5c450cf304c9e18d45db562025a14fb1ca0f5c769b6f609309f81d4c31de455" dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -828,22 +763,9 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce" dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", -] - -[[package]] -name = "env_logger" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -862,9 +784,9 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", "synstructure", ] @@ -914,31 +836,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "futures" version = "0.1.31" @@ -1004,7 +904,7 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.7", + "pin-project-lite", "waker-fn", ] @@ -1014,11 +914,11 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" dependencies = [ - "autocfg 1.0.1", + "autocfg", "proc-macro-hack", - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1039,7 +939,7 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" dependencies = [ - "autocfg 1.0.1", + "autocfg", "futures 0.1.31", "futures-channel", "futures-core", @@ -1048,7 +948,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.7", + "pin-project-lite", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -1084,14 +984,14 @@ checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.10.0+wasi-snapshot-preview1", ] [[package]] name = "gimli" -version = "0.25.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" +checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" [[package]] name = "glob" @@ -1099,33 +999,13 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -[[package]] -name = "h2" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" -dependencies = [ - "bytes 0.5.6", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio 0.2.25", - "tokio-util 0.3.1", - "tracing", - "tracing-futures", -] - [[package]] name = "h2" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fd819562fcebdac5afc5c113c3ec36f902840b70fd4fc458799c8ce4607ae55" dependencies = [ - "bytes 1.1.0", + "bytes", "fnv", "futures-core", "futures-sink", @@ -1133,8 +1013,8 @@ dependencies = [ "http", "indexmap", "slab", - "tokio 1.13.0", - "tokio-util 0.6.8", + "tokio", + "tokio-util", "tracing", ] @@ -1156,12 +1036,12 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c4eb0471fcb85846d8b0690695ef354f9afb11cb03cac2e1d7c9253351afb0" dependencies = [ - "base64 0.13.0", + "base64", "bitflags", - "bytes 1.1.0", + "bytes", "headers-core", "http", - "httpdate 1.0.1", + "httpdate", "mime", "sha-1", ] @@ -1209,30 +1089,20 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" dependencies = [ - "bytes 1.1.0", + "bytes", "fnv", "itoa", ] -[[package]] -name = "http-body" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" -dependencies = [ - "bytes 0.5.6", - "http", -] - [[package]] name = "http-body" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ - "bytes 1.1.0", + "bytes", "http", - "pin-project-lite 0.2.7", + "pin-project-lite", ] [[package]] @@ -1241,70 +1111,31 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" -[[package]] -name = "httpdate" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" - [[package]] name = "httpdate" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" -[[package]] -name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error", -] - -[[package]] -name = "hyper" -version = "0.13.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" -dependencies = [ - "bytes 0.5.6", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.2.7", - "http", - "http-body 0.3.1", - "httparse", - "httpdate 0.3.2", - "itoa", - "pin-project", - "socket2 0.3.19", - "tokio 0.2.25", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "0.14.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b91bb1f221b6ea1f1e4371216b70f40748774c2fb5971b450c07773fb92d26b" dependencies = [ - "bytes 1.1.0", + "bytes", "futures-channel", "futures-core", "futures-util", - "h2 0.3.7", + "h2", "http", - "http-body 0.4.4", + "http-body", "httparse", - "httpdate 1.0.1", + "httpdate", "itoa", - "pin-project-lite 0.2.7", - "socket2 0.4.2", - "tokio 1.13.0", + "pin-project-lite", + "socket2", + "tokio", "tower-service", "tracing", "want", @@ -1316,38 +1147,25 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca815a891b24fdfb243fa3239c86154392b0953ee584aa1a2a1f66d20cbe75cc" dependencies = [ - "bytes 1.1.0", + "bytes", "futures 0.3.17", "headers", "http", - "hyper 0.14.14", - "tokio 1.13.0", + "hyper", + "tokio", "tower-service", ] -[[package]] -name = "hyper-tls" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" -dependencies = [ - "bytes 0.5.6", - "hyper 0.13.10", - "native-tls", - "tokio 0.2.25", - "tokio-tls", -] - [[package]] name = "hyper-tls" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.1.0", - "hyper 0.14.14", + "bytes", + "hyper", "native-tls", - "tokio 1.13.0", + "tokio", "tokio-native-tls", ] @@ -1357,17 +1175,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.2.3" @@ -1385,7 +1192,7 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ - "autocfg 1.0.1", + "autocfg", "hashbrown", ] @@ -1407,30 +1214,12 @@ dependencies = [ "libc", ] -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - [[package]] name = "ipnet" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" -[[package]] -name = "itertools" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "0.4.8" @@ -1475,16 +1264,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -1510,9 +1289,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "869d572136620d55835903746bcb5cdc54cb2851fd0aeec53220b4bb65ef3013" +checksum = "a60553f9a9e039a333b4e9b20573b9e9b9c0bb3a11e201ccc48ef4283456d673" [[package]] name = "libdbus-sys" @@ -1530,7 +1309,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0cf036d15402bea3c5d4de17b3fce76b3e4a56ebc1f577be0e7a72f7c607cf0" dependencies = [ "cfg-if 1.0.0", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1550,7 +1329,7 @@ dependencies = [ "libpulse-sys", "num-derive", "num-traits", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1584,7 +1363,7 @@ dependencies = [ "num-derive", "num-traits", "pkg-config", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1595,12 +1374,12 @@ checksum = "e5f7cc7e4d1c2596191be523668c933e07ec8a318d099fd66658258a4fe4a2dc" dependencies = [ "aes-ctr", "byteorder", - "bytes 1.1.0", + "bytes", "futures-util", "librespot-core", "log", "tempfile", - "tokio 1.13.0", + "tokio", ] [[package]] @@ -1610,16 +1389,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "255e8d8d719c020895079d140baf0b0edec8447d39a7e4760708f33b7cafaafb" dependencies = [ "aes", - "base64 0.13.0", + "base64", "byteorder", - "bytes 1.1.0", + "bytes", "form_urlencoded", "futures-core", "futures-util", "hmac", "http", "httparse", - "hyper 0.14.14", + "hyper", "hyper-proxy", "librespot-protocol", "log", @@ -1630,16 +1409,16 @@ dependencies = [ "pbkdf2", "priority-queue", "protobuf", - "rand 0.8.4", + "rand", "serde", "serde_json", "sha-1", "shannon", "thiserror", - "tokio 1.13.0", + "tokio", "tokio-stream", - "tokio-util 0.6.8", - "url 2.2.2", + "tokio-util", + "url", "uuid", "vergen", ] @@ -1678,12 +1457,12 @@ dependencies = [ "log", "ogg", "portaudio-rs", - "rand 0.8.4", + "rand", "rand_distr", "rodio", "shell-words", "thiserror", - "tokio 1.13.0", + "tokio", "zerocopy", ] @@ -1758,6 +1537,17 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "maybe-async" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6007f9dad048e0a224f27ca599d669fca8cfa0dac804725aab542b2eb032bce6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "memchr" version = "2.4.1" @@ -1770,16 +1560,6 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "mime_guess" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "miniz_oxide" version = "0.4.4" @@ -1787,26 +1567,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" dependencies = [ "adler", - "autocfg 1.0.1", -] - -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow 0.2.2", - "net2", - "slab", - "winapi 0.2.8", + "autocfg", ] [[package]] @@ -1817,21 +1578,9 @@ checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" dependencies = [ "libc", "log", - "miow 0.3.7", + "miow", "ntapi", - "winapi 0.3.9", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "winapi", ] [[package]] @@ -1840,7 +1589,7 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1868,7 +1617,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1bb540dc6ef51cfe1916ec038ce7a620daf3a111e2502d745197cd53d6bca15" dependencies = [ "libc", - "socket2 0.4.2", + "socket2", ] [[package]] @@ -1884,7 +1633,6 @@ dependencies = [ "dbus-tree", "failure", "fern", - "futures 0.1.31", "futures 0.3.17", "ioctl-rs", "lazy_static", @@ -1895,20 +1643,20 @@ dependencies = [ "notify-rust", "pancurses 0.17.0", "platform-dirs", - "rand 0.8.4", + "rand", "regex", - "reqwest 0.11.6", + "reqwest", "rspotify", "serde", "serde_cbor", "serde_json", "strum", "strum_macros", - "tokio 1.13.0", + "tokio", "tokio-stream", "toml", "unicode-width", - "url 2.2.2", + "url", "webbrowser", ] @@ -1982,11 +1730,11 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" dependencies = [ - "darling 0.10.2", + "darling", "proc-macro-crate 0.1.5", - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1995,17 +1743,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c44922cb3dbb1c70b5e5f443d63b64363a898564d739ba5198e3a9138442868d" -[[package]] -name = "net2" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - [[package]] name = "nix" version = "0.17.0" @@ -2061,7 +1798,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2079,14 +1816,14 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74e768dff5fb39a41b3bcd30bb25cf989706c90d028d1ad71971987aa309d535" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ - "autocfg 1.0.1", + "autocfg", "num-integer", "num-traits", - "rand 0.8.4", + "rand", ] [[package]] @@ -2104,9 +1841,9 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -2115,7 +1852,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.1", + "autocfg", "num-traits", ] @@ -2125,7 +1862,7 @@ version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" dependencies = [ - "autocfg 1.0.1", + "autocfg", "num-integer", "num-traits", ] @@ -2136,7 +1873,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" dependencies = [ - "autocfg 1.0.1", + "autocfg", "num-integer", "num-traits", ] @@ -2147,7 +1884,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1", + "autocfg", "libm", ] @@ -2178,9 +1915,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "486ea01961c4a818096de679a8b740b26d9033146ac5291b1c98557658f8cdd9" dependencies = [ "proc-macro-crate 1.1.0", - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -2273,9 +2010,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.36" +version = "0.10.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" +checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -2293,11 +2030,11 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-sys" -version = "0.9.67" +version = "0.9.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058" +checksum = "c6517987b3f8226b5da3661dad65ff7f300cc59fb5ea8333ca191fc65fde3edf" dependencies = [ - "autocfg 1.0.1", + "autocfg", "cc", "libc", "pkg-config", @@ -2367,7 +2104,7 @@ dependencies = [ "libc", "redox_syscall 0.2.10", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2396,44 +2133,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pin-project" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" -dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", -] - -[[package]] -name = "pin-project-lite" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" - [[package]] name = "pin-project-lite" version = "0.2.7" @@ -2471,7 +2176,7 @@ dependencies = [ "libc", "log", "wepoll-ffi", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2507,7 +2212,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf40e51ccefb72d42720609e1d3c518de8b5800d723a09358d4a6d6245e1f8ca" dependencies = [ - "autocfg 1.0.1", + "autocfg", "indexmap", ] @@ -2544,20 +2249,11 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "0.4.30" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" dependencies = [ - "unicode-xid 0.1.0", -] - -[[package]] -name = "proc-macro2" -version = "1.0.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc3358ebc67bc8b7fa0c007f945b0b18226f78437d61bec735a9eb96b61ee70" -dependencies = [ - "unicode-xid 0.2.2", + "unicode-xid", ] [[package]] @@ -2586,18 +2282,21 @@ dependencies = [ ] [[package]] -name = "quick-error" -version = "1.2.3" +name = "psl-types" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +checksum = "66b398073e7cdd6f05934389a8f5961e3aabfa66675b6f440df4e2c793d51a4f" [[package]] -name = "quote" -version = "0.6.13" +name = "publicsuffix" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +checksum = "292972edad6bbecc137ab84c5e36421a4a6c979ea31d3cc73540dd04315b33e1" dependencies = [ - "proc-macro2 0.4.30", + "byteorder", + "hashbrown", + "idna", + "psl-types", ] [[package]] @@ -2606,26 +2305,7 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" dependencies = [ - "proc-macro2 1.0.30", -] - -[[package]] -name = "rand" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -dependencies = [ - "autocfg 0.1.7", - "libc", - "rand_chacha 0.1.1", - "rand_core 0.4.2", - "rand_hc 0.1.0", - "rand_isaac", - "rand_jitter", - "rand_os", - "rand_pcg", - "rand_xorshift", - "winapi 0.3.9", + "proc-macro2", ] [[package]] @@ -2635,19 +2315,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.3", - "rand_hc 0.3.1", -] - -[[package]] -name = "rand_chacha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -dependencies = [ - "autocfg 0.1.7", - "rand_core 0.3.1", + "rand_chacha", + "rand_core", + "rand_hc", ] [[package]] @@ -2657,24 +2327,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", + "rand_core", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.6.3" @@ -2691,16 +2346,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "964d548f8e7d12e102ef183a0de7e98180c9f8729f555897a857b96e48122d2f" dependencies = [ "num-traits", - "rand 0.8.4", -] - -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -dependencies = [ - "rand_core 0.3.1", + "rand", ] [[package]] @@ -2709,75 +2355,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" dependencies = [ - "rand_core 0.6.3", -] - -[[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -dependencies = [ - "libc", - "rand_core 0.4.2", - "winapi 0.3.9", -] - -[[package]] -name = "rand_os" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.4.2", - "rdrand", - "winapi 0.3.9", -] - -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -dependencies = [ - "autocfg 0.1.7", - "rand_core 0.4.2", -] - -[[package]] -name = "rand_xorshift" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "random" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d13a3485349981c90c79112a11222c3e6e75de1d52b87a7525b3bf5361420f" - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", + "rand_core", ] [[package]] @@ -2848,44 +2426,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "reqwest" -version = "0.10.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c" -dependencies = [ - "base64 0.13.0", - "bytes 0.5.6", - "encoding_rs", - "futures-core", - "futures-util", - "http", - "http-body 0.3.1", - "hyper 0.13.10", - "hyper-tls 0.4.3", - "ipnet", - "js-sys", - "lazy_static", - "log", - "mime", - "mime_guess", - "native-tls", - "percent-encoding 2.1.0", - "pin-project-lite 0.2.7", - "serde", - "serde_json", - "serde_urlencoded", - "tokio 0.2.25", - "tokio-socks", - "tokio-tls", - "url 2.2.2", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg 0.7.0", + "winapi", ] [[package]] @@ -2894,35 +2435,50 @@ version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66d2927ca2f685faf0fc620ac4834690d29e7abb153add10f5812eef20b5e280" dependencies = [ - "base64 0.13.0", - "bytes 1.1.0", + "base64", + "bytes", "encoding_rs", "futures-core", "futures-util", "http", - "http-body 0.4.4", - "hyper 0.14.14", - "hyper-tls 0.5.0", + "http-body", + "hyper", + "hyper-tls", "ipnet", "js-sys", "lazy_static", "log", "mime", "native-tls", - "percent-encoding 2.1.0", - "pin-project-lite 0.2.7", + "percent-encoding", + "pin-project-lite", "serde", "serde_json", "serde_urlencoded", - "tokio 1.13.0", + "tokio", "tokio-native-tls", - "url 2.2.2", + "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "winreg 0.7.0", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + [[package]] name = "rodio" version = "0.14.0" @@ -2934,28 +2490,55 @@ dependencies = [ [[package]] name = "rspotify" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eefd7bb58b714606b30a490f751d7926942e2874eef5e82934d60d7a4a68dca4" +checksum = "0b25341ebdad57994f7dbf1c0d84ef0aec165adbb2a06977ad4aa0a1433413cd" dependencies = [ - "base64 0.10.1", + "base64", "chrono", - "derive_builder", - "dotenv", - "env_logger", - "failure", - "itertools", - "lazy_static", + "getrandom 0.2.3", "log", - "percent-encoding 1.0.1", - "rand 0.6.5", - "random", - "reqwest 0.10.10", + "maybe-async", + "rspotify-http", + "rspotify-macros", + "rspotify-model", "serde", - "serde_derive", "serde_json", - "url 1.7.2", - "webbrowser", + "sha2", + "thiserror", + "url", +] + +[[package]] +name = "rspotify-http" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a463b12a9b73da057d88be95cdf8f70871f233a2a6f8ef3569a67645c9af5c15" +dependencies = [ + "log", + "maybe-async", + "serde_json", + "thiserror", + "ureq", +] + +[[package]] +name = "rspotify-macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1087d00b5e342189fb541dc1ef2fead32462be9004913dce3edf61bf4d38e817" + +[[package]] +name = "rspotify-model" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dadf60b6d8136859dad4d37e1ca0a416f2576265143fd797dd87858067864975" +dependencies = [ + "chrono", + "serde", + "serde_json", + "strum", + "thiserror", ] [[package]] @@ -2964,7 +2547,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" dependencies = [ - "base64 0.13.0", + "base64", "blake2b_simd", "constant_time_eq", "crossbeam-utils", @@ -2988,13 +2571,34 @@ version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver", + "semver 1.0.4", +] + +[[package]] +name = "rustls" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b5ac6078ca424dc1d3ae2328526a76787fecc7f8011f520e3276730e711fc95" +dependencies = [ + "log", + "ring", + "sct", + "webpki", ] [[package]] @@ -3019,7 +2623,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3034,6 +2638,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "security-framework" version = "2.4.2" @@ -3057,12 +2671,27 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + [[package]] name = "semver" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.130" @@ -3088,16 +2717,16 @@ version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "serde_json" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8" +checksum = "e466864e431129c7e0d3476b92f20458e5879919a0596c6472738d9fa2d342f8" dependencies = [ "itoa", "ryu", @@ -3110,9 +2739,9 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98d0516900518c29efa217c298fa1f4e6c6ffc85ae29fd7f4ee48f176e1a9ed5" dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -3140,6 +2769,25 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" + +[[package]] +name = "sha2" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" +dependencies = [ + "block-buffer", + "cfg-if 1.0.0", + "cpufeatures", + "digest", + "opaque-debug", +] + [[package]] name = "shannon" version = "0.2.0" @@ -3192,17 +2840,6 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" -[[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 0.3.9", -] - [[package]] name = "socket2" version = "0.4.2" @@ -3210,15 +2847,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "stable_deref_trait" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -3232,10 +2884,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" [[package]] -name = "strsim" -version = "0.7.0" +name = "stdweb" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version 0.2.3", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" [[package]] name = "strsim" @@ -3265,9 +2960,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "339f799d8b549e3744c7ac7feb216383e4005d94bdb22561b3ab8f3b808ae9fb" dependencies = [ "heck", - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -3278,24 +2973,13 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "0.15.44" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "unicode-xid 0.1.0", -] - -[[package]] -name = "syn" -version = "1.0.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d010a1623fbd906d51d650a9916aaefc05ffa0e4053ff7fe601167f3e715d194" -dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "unicode-xid 0.2.2", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] @@ -3304,10 +2988,10 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", - "unicode-xid 0.2.2", + "proc-macro2", + "quote", + "syn", + "unicode-xid", ] [[package]] @@ -3318,10 +3002,10 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if 1.0.0", "libc", - "rand 0.8.4", + "rand", "redox_syscall 0.2.10", "remove_dir_all", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3331,16 +3015,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ "libc", - "winapi 0.3.9", -] - -[[package]] -name = "termcolor" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" -dependencies = [ - "winapi-util", + "winapi", ] [[package]] @@ -3379,19 +3054,58 @@ version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "time" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", - "winapi 0.3.9", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + +[[package]] +name = "time" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb 0.4.20", + "time-macros", + "version_check", + "winapi", +] + +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn", ] [[package]] @@ -3409,50 +3123,32 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" -[[package]] -name = "tokio" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" -dependencies = [ - "bytes 0.5.6", - "fnv", - "futures-core", - "iovec", - "lazy_static", - "memchr", - "mio 0.6.23", - "num_cpus", - "pin-project-lite 0.1.12", - "slab", -] - [[package]] name = "tokio" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "588b2d10a336da58d877567cd8fb8a14b463e2104910f8132cd054b4b96e29ee" dependencies = [ - "autocfg 1.0.1", - "bytes 1.1.0", + "autocfg", + "bytes", "libc", "memchr", - "mio 0.7.14", + "mio", "num_cpus", - "pin-project-lite 0.2.7", + "pin-project-lite", "tokio-macros", - "winapi 0.3.9", + "winapi", ] [[package]] name = "tokio-macros" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2dd85aeaba7b68df939bd357c6afb36c87951be9e80bf9c859f2fc3e9fca0fd" +checksum = "114383b041aa6212c579467afa0075fbbdd0718de036100bc0ba7961d8cb9095" dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -3462,20 +3158,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" dependencies = [ "native-tls", - "tokio 1.13.0", -] - -[[package]] -name = "tokio-socks" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d611fd5d241872372d52a0a3d309c52d0b95a6a67671a6c8f7ab2c4a37fb2539" -dependencies = [ - "bytes 0.4.12", - "either", - "futures 0.3.17", - "thiserror", - "tokio 0.2.25", + "tokio", ] [[package]] @@ -3485,46 +3168,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" dependencies = [ "futures-core", - "pin-project-lite 0.2.7", - "tokio 1.13.0", -] - -[[package]] -name = "tokio-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" -dependencies = [ - "native-tls", - "tokio 0.2.25", + "pin-project-lite", + "tokio", ] [[package]] name = "tokio-util" -version = "0.3.1" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" dependencies = [ - "bytes 0.5.6", + "bytes", "futures-core", "futures-sink", "log", - "pin-project-lite 0.1.12", - "tokio 0.2.25", -] - -[[package]] -name = "tokio-util" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd" -dependencies = [ - "bytes 1.1.0", - "futures-core", - "futures-sink", - "log", - "pin-project-lite 0.2.7", - "tokio 1.13.0", + "pin-project-lite", + "tokio", ] [[package]] @@ -3549,8 +3208,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" dependencies = [ "cfg-if 1.0.0", - "log", - "pin-project-lite 0.2.7", + "pin-project-lite", "tracing-core", ] @@ -3563,16 +3221,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "try-lock" version = "0.2.3" @@ -3585,15 +3233,6 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" -[[package]] -name = "unicase" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.7" @@ -3621,12 +3260,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" - [[package]] name = "unicode-xid" version = "0.2.2" @@ -3634,14 +3267,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] -name = "url" -version = "1.7.2" +name = "untrusted" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "ureq" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd912a3d096959150c4d71ac752e13f1683085922658c205b89b40fe8ebe07f" dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", + "base64", + "chunked_transfer", + "cookie", + "cookie_store", + "log", + "once_cell", + "rustls", + "serde", + "serde_json", + "url", + "webpki", + "webpki-roots", ] [[package]] @@ -3651,9 +3299,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ "form_urlencoded", - "idna 0.2.3", + "idna", "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -3685,7 +3333,7 @@ checksum = "e7141e445af09c8919f1d5f8a20dae0b20c3b57a45dee0d5823c6ed5d237f15a" dependencies = [ "bitflags", "chrono", - "rustc_version", + "rustc_version 0.4.0", ] [[package]] @@ -3713,7 +3361,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ "same-file", - "winapi 0.3.9", + "winapi", "winapi-util", ] @@ -3735,9 +3383,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" @@ -3746,8 +3394,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" dependencies = [ "cfg-if 1.0.0", - "serde", - "serde_json", "wasm-bindgen-macro", ] @@ -3760,9 +3406,9 @@ dependencies = [ "bumpalo", "lazy_static", "log", - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", "wasm-bindgen-shared", ] @@ -3784,7 +3430,7 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" dependencies = [ - "quote 1.0.10", + "quote", "wasm-bindgen-macro-support", ] @@ -3794,9 +3440,9 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3823,10 +3469,10 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1b32d98e11194200baf6d3f85eb2d6cfe56f6d9af0dd617f90ca48f958a88" dependencies = [ - "darling 0.10.2", - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "darling", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -3847,7 +3493,26 @@ checksum = "ecad156490d6b620308ed411cfee90d280b3cbd13e189ea0d3fada8acc89158a" dependencies = [ "web-sys", "widestring", - "winapi 0.3.9", + "winapi", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c475786c6f47219345717a043a37ec04cb4bc185e28853adcc4fa0a947eba630" +dependencies = [ + "webpki", ] [[package]] @@ -3865,12 +3530,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -3881,12 +3540,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -3899,7 +3552,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3950,7 +3603,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3959,7 +3612,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3973,16 +3626,6 @@ dependencies = [ "xml-rs", ] -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "x11-clipboard" version = "0.3.3" @@ -4044,9 +3687,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a482c56029e48681b89b92b5db3c446db0915e8dd1052c0328a574eda38d5f93" dependencies = [ "proc-macro-crate 0.1.5", - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -4065,8 +3708,8 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d498dbd1fd7beb83c86709ae1c33ca50942889473473d287d56ce4770a18edfb" dependencies = [ - "proc-macro2 1.0.30", - "syn 1.0.80", + "proc-macro2", + "syn", "synstructure", ] @@ -4091,7 +3734,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46ee71e0e88747ec582d290dbe98ff7907ff28770c7a35f16da41e5e6f1f4fa3" dependencies = [ "proc-macro-crate 1.1.0", - "proc-macro2 1.0.30", - "quote 1.0.10", - "syn 1.0.80", + "proc-macro2", + "quote", + "syn", ] diff --git a/Cargo.toml b/Cargo.toml index 77ef86a..7e61c49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,14 +22,12 @@ platform-dirs = "0.3.0" failure = "0.1" fern = "0.6" futures = { version = "0.3", features = ["compat"] } -futures_01 = { version = "0.1", package = "futures" } lazy_static = "1.3.0" librespot-core = "0.3.1" librespot-playback = "0.3.1" librespot-protocol = "0.3.1" log = "0.4.13" notify-rust = { version = "4", optional = true } -rspotify = { version = "0.10.0", features = ["blocking"] } serde = "1.0" serde_json = "1.0" tokio = { version = "1", features = ["rt-multi-thread", "sync", "time"] } @@ -49,6 +47,11 @@ ioctl-rs = { version = "0.2", optional = true } serde_cbor = "0.11.2" pancurses = { version = "0.17.0", features = ["win32"] } +[dependencies.rspotify] +version = "0.11.2" +default-features = false +features = ["client-ureq", "ureq-rustls-tls"] + [dependencies.cursive] version = "0.16.3" default-features = false diff --git a/src/album.rs b/src/album.rs index 1e23145..9810cbb 100644 --- a/src/album.rs +++ b/src/album.rs @@ -1,4 +1,5 @@ use rand::{seq::IteratorRandom, thread_rng}; +use rspotify::model::Id; use std::fmt; use std::sync::{Arc, RwLock}; @@ -68,10 +69,14 @@ impl Album { impl From<&SimplifiedAlbum> for Album { fn from(sa: &SimplifiedAlbum) -> Self { Self { - id: sa.id.clone(), + id: sa.id.as_ref().map(|id| id.id().to_string()), title: sa.name.clone(), artists: sa.artists.iter().map(|sa| sa.name.clone()).collect(), - artist_ids: sa.artists.iter().filter_map(|a| a.id.clone()).collect(), + artist_ids: sa + .artists + .iter() + .filter_map(|a| a.id.as_ref().map(|id| id.id().to_string())) + .collect(), year: sa .release_date .clone() @@ -81,7 +86,7 @@ impl From<&SimplifiedAlbum> for Album { .unwrap() .into(), cover_url: sa.images.get(0).map(|i| i.url.clone()), - url: sa.uri.clone(), + url: sa.id.as_ref().map(|id| id.url()), tracks: None, added_at: None, } @@ -99,13 +104,17 @@ impl From<&FullAlbum> for Album { ); Self { - id: Some(fa.id.clone()), + id: Some(fa.id.id().to_string()), title: fa.name.clone(), artists: fa.artists.iter().map(|sa| sa.name.clone()).collect(), - artist_ids: fa.artists.iter().filter_map(|a| a.id.clone()).collect(), + artist_ids: fa + .artists + .iter() + .filter_map(|a| a.id.as_ref().map(|id| id.id().to_string())) + .collect(), year: fa.release_date.split('-').next().unwrap().into(), cover_url: fa.images.get(0).map(|i| i.url.clone()), - url: Some(fa.uri.clone()), + url: Some(fa.id.uri()), tracks, added_at: None, } @@ -185,7 +194,7 @@ impl ListItem for Album { .iter() .map(|track| Playable::Track(track.clone())) .collect(); - let index = queue.append_next(tracks); + let index = queue.append_next(&tracks); queue.play(index, true, true); } } @@ -237,11 +246,11 @@ impl ListItem for Album { ) -> Option> { self.load_all_tracks(queue.get_spotify()); const MAX_SEEDS: usize = 5; - let track_ids: Vec = self + let track_ids: Vec<&str> = self .tracks .as_ref()? .iter() - .map(|t| t.id.clone()) + .map(|t| t.id.as_deref()) .flatten() // spotify allows at max 5 seed items, so choose 4 random tracks... .choose_multiple(&mut thread_rng(), MAX_SEEDS - 1); @@ -249,7 +258,7 @@ impl ListItem for Album { let artist_id: Option = self .artist_ids .iter() - .map(|aid| aid.clone()) + .cloned() // ...and one artist .choose(&mut thread_rng()); @@ -260,7 +269,11 @@ impl ListItem for Album { let spotify = queue.get_spotify(); let recommendations: Option> = spotify .api - .recommendations(artist_id.map(|aid| vec![aid]), None, Some(track_ids)) + .recommendations( + artist_id.as_ref().map(|aid| vec![aid.as_str()]), + None, + Some(track_ids), + ) .map(|r| r.tracks) .map(|tracks| tracks.iter().map(Track::from).collect()); recommendations.map(|tracks| { diff --git a/src/artist.rs b/src/artist.rs index 7091e04..e3a70ef 100644 --- a/src/artist.rs +++ b/src/artist.rs @@ -2,6 +2,7 @@ use std::fmt; use std::sync::{Arc, RwLock}; use rspotify::model::artist::{FullArtist, SimplifiedArtist}; +use rspotify::model::Id; use crate::library::Library; use crate::playable::Playable; @@ -43,9 +44,9 @@ impl Artist { impl From<&SimplifiedArtist> for Artist { fn from(sa: &SimplifiedArtist) -> Self { Self { - id: sa.id.clone(), + id: sa.id.as_ref().map(|id| id.id().to_string()), name: sa.name.clone(), - url: sa.uri.clone(), + url: sa.id.as_ref().map(|id| id.url()), tracks: None, is_followed: false, } @@ -55,9 +56,9 @@ impl From<&SimplifiedArtist> for Artist { impl From<&FullArtist> for Artist { fn from(fa: &FullArtist) -> Self { Self { - id: Some(fa.id.clone()), + id: Some(fa.id.id().to_string()), name: fa.name.clone(), - url: Some(fa.uri.clone()), + url: Some(fa.id.url()), tracks: None, is_followed: false, } @@ -129,7 +130,7 @@ impl ListItem for Artist { .iter() .map(|track| Playable::Track(track.clone())) .collect(); - let index = queue.append_next(tracks); + let index = queue.append_next(&tracks); queue.play(index, true, true); } } @@ -184,7 +185,7 @@ impl ListItem for Artist { let spotify = queue.get_spotify(); let recommendations: Option> = spotify .api - .recommendations(Some(vec![id]), None, None) + .recommendations(Some(vec![&id]), None, None) .map(|r| r.tracks) .map(|tracks| tracks.iter().map(Track::from).collect()); diff --git a/src/episode.rs b/src/episode.rs index b26ed55..18cc1a9 100644 --- a/src/episode.rs +++ b/src/episode.rs @@ -2,7 +2,9 @@ use crate::library::Library; use crate::playable::Playable; use crate::queue::Queue; use crate::traits::{ListItem, ViewExt}; +use chrono::{DateTime, Utc}; use rspotify::model::show::{FullEpisode, SimplifiedEpisode}; +use rspotify::model::Id; use std::fmt; use std::sync::Arc; @@ -15,6 +17,8 @@ pub struct Episode { pub description: String, pub release_date: String, pub cover_url: Option, + pub added_at: Option>, + pub list_index: usize, } impl Episode { @@ -28,13 +32,15 @@ impl Episode { impl From<&SimplifiedEpisode> for Episode { fn from(episode: &SimplifiedEpisode) -> Self { Self { - id: episode.id.clone(), - uri: episode.uri.clone(), - duration: episode.duration_ms, + id: episode.id.id().to_string(), + uri: episode.id.uri(), + duration: episode.duration.as_millis() as u32, name: episode.name.clone(), description: episode.description.clone(), release_date: episode.release_date.clone(), cover_url: episode.images.get(0).map(|img| img.url.clone()), + added_at: None, + list_index: 0, } } } @@ -42,13 +48,15 @@ impl From<&SimplifiedEpisode> for Episode { impl From<&FullEpisode> for Episode { fn from(episode: &FullEpisode) -> Self { Self { - id: episode.id.clone(), - uri: episode.uri.clone(), - duration: episode.duration_ms, + id: episode.id.id().to_string(), + uri: episode.id.uri(), + duration: episode.duration.as_millis() as u32, name: episode.name.clone(), description: episode.description.clone(), release_date: episode.release_date.clone(), cover_url: episode.images.get(0).map(|img| img.url.clone()), + added_at: None, + list_index: 0, } } } @@ -76,7 +84,7 @@ impl ListItem for Episode { } fn play(&mut self, queue: Arc) { - let index = queue.append_next(vec![Playable::Episode(self.clone())]); + let index = queue.append_next(&vec![Playable::Episode(self.clone())]); queue.play(index, true, false); } diff --git a/src/library.rs b/src/library.rs index 503debe..5f75228 100644 --- a/src/library.rs +++ b/src/library.rs @@ -6,6 +6,7 @@ use std::sync::{Arc, RwLock, RwLockReadGuard}; use std::thread; use log::{debug, error, info}; +use rspotify::model::Id; use serde::de::DeserializeOwned; use serde::Serialize; @@ -43,7 +44,7 @@ pub struct Library { impl Library { pub fn new(ev: &EventManager, spotify: Spotify, cfg: Arc) -> Self { let current_user = spotify.api.current_user(); - let user_id = current_user.as_ref().map(|u| u.id.clone()); + let user_id = current_user.as_ref().map(|u| u.id.id().to_string()); let display_name = current_user.as_ref().and_then(|u| u.display_name.clone()); let library = Self { @@ -307,7 +308,7 @@ impl Library { fn fetch_artists(&self) { let mut artists: Vec = Vec::new(); - let mut last: Option = None; + let mut last: Option<&str> = None; let mut i: u32 = 0; @@ -324,7 +325,7 @@ impl Library { artists.extend(page.items.iter().map(|fa| fa.into())); if page.next.is_some() { - last = artists.last().unwrap().id.clone(); + last = artists.last().unwrap().id.as_deref(); } else { break; } @@ -387,7 +388,7 @@ impl Library { .items .iter() .enumerate() - .any(|(i, a)| a.album.id != store[i].id.clone().unwrap_or_default()) + .any(|(i, a)| a.album.id.id() != store[i].id.clone().unwrap_or_default()) { return; } @@ -438,7 +439,7 @@ impl Library { .items .iter() .enumerate() - .any(|(i, t)| t.track.id != store[i].id) + .any(|(i, t)| Some(t.track.id.id().to_string()) != store[i].id) { return; } @@ -547,7 +548,9 @@ impl Library { && self .spotify .api - .current_user_saved_tracks_add(tracks.iter().filter_map(|t| t.id.clone()).collect()) + .current_user_saved_tracks_add( + tracks.iter().filter_map(|t| t.id.as_deref()).collect(), + ) .is_none() { return; @@ -582,7 +585,7 @@ impl Library { .spotify .api .current_user_saved_tracks_delete( - tracks.iter().filter_map(|t| t.id.clone()).collect(), + tracks.iter().filter_map(|t| t.id.as_deref()).collect(), ) .is_none() { @@ -622,7 +625,7 @@ impl Library { if self .spotify .api - .current_user_saved_albums_add(vec![album_id.clone()]) + .current_user_saved_albums_add(vec![album_id.as_str()]) .is_none() { return; @@ -651,7 +654,7 @@ impl Library { if self .spotify .api - .current_user_saved_albums_delete(vec![album_id.clone()]) + .current_user_saved_albums_delete(vec![album_id.as_str()]) .is_none() { return; @@ -684,7 +687,7 @@ impl Library { if self .spotify .api - .user_follow_artists(vec![artist_id.clone()]) + .user_follow_artists(vec![artist_id.as_str()]) .is_none() { return; @@ -716,7 +719,7 @@ impl Library { if self .spotify .api - .user_unfollow_artists(vec![artist_id.clone()]) + .user_unfollow_artists(vec![artist_id.as_str()]) .is_none() { return; @@ -759,7 +762,7 @@ impl Library { if self .spotify .api - .user_playlist_follow_playlist(playlist.owner_id.clone(), playlist.id.clone()) + .user_playlist_follow_playlist(playlist.id.as_str()) .is_none() { return; @@ -792,7 +795,7 @@ impl Library { return; } - if self.spotify.api.save_shows(vec![show.id.clone()]) { + if self.spotify.api.save_shows(vec![show.id.as_str()]) { { let mut store = self.shows.write().unwrap(); if !store.iter().any(|s| s.id == show.id) { @@ -807,7 +810,7 @@ impl Library { return; } - if self.spotify.api.unsave_shows(vec![show.id.clone()]) { + if self.spotify.api.unsave_shows(vec![show.id.as_str()]) { { let mut store = self.shows.write().unwrap(); *store = store.iter().filter(|s| s.id != show.id).cloned().collect(); diff --git a/src/mpris.rs b/src/mpris.rs index bcfcdb9..692830a 100644 --- a/src/mpris.rs +++ b/src/mpris.rs @@ -584,7 +584,7 @@ fn run_dbus_server( if let Some(t) = &Album::from(&a).tracks { queue.clear(); let index = queue.append_next( - t.iter() + &t.iter() .map(|track| Playable::Track(track.clone())) .collect(), ); @@ -606,11 +606,7 @@ fn run_dbus_server( playlist.load_tracks(spotify); if let Some(t) = &playlist.tracks { queue.clear(); - let index = queue.append_next( - t.iter() - .map(|track| Playable::Track(track.clone())) - .collect(), - ); + let index = queue.append_next(&t.iter().cloned().collect()); queue.play(index, false, false) } } @@ -625,7 +621,7 @@ fn run_dbus_server( let mut ep = e.clone(); ep.reverse(); let index = queue.append_next( - ep.iter() + &ep.iter() .map(|episode| Playable::Episode(episode.clone())) .collect(), ); @@ -643,7 +639,7 @@ fn run_dbus_server( Some(UriType::Artist) => { if let Some(a) = spotify.api.artist_top_tracks(id) { queue.clear(); - queue.append_next(a.iter().map(|track| Playable::Track(track.clone())).collect()); + queue.append_next(&a.iter().map(|track| Playable::Track(track.clone())).collect()); queue.play(0, false, false) } } diff --git a/src/playable.rs b/src/playable.rs index 4dae559..6c1caa2 100644 --- a/src/playable.rs +++ b/src/playable.rs @@ -1,3 +1,6 @@ +use chrono::{DateTime, Utc}; +use rspotify::model::PlayableItem; + use crate::album::Album; use crate::artist::Artist; use crate::episode::Episode; @@ -44,6 +47,34 @@ impl Playable { } } + pub fn list_index(&self) -> usize { + match self { + Playable::Track(track) => track.list_index, + Playable::Episode(episode) => episode.list_index, + } + } + + pub fn set_list_index(&mut self, index: usize) { + match self { + Playable::Track(track) => track.list_index = index, + Playable::Episode(episode) => episode.list_index = index, + } + } + + pub fn added_at(&self) -> Option> { + match self { + Playable::Track(track) => track.added_at, + Playable::Episode(episode) => episode.added_at, + } + } + + pub fn set_added_at(&mut self, added_at: Option>) { + match self { + Playable::Track(track) => track.added_at = added_at, + Playable::Episode(episode) => episode.added_at = added_at, + } + } + pub fn duration_str(&self) -> String { let duration = self.duration(); let minutes = duration / 60_000; @@ -59,6 +90,15 @@ impl Playable { } } +impl From<&PlayableItem> for Playable { + fn from(item: &PlayableItem) -> Self { + match item { + PlayableItem::Episode(episode) => Playable::Episode(episode.into()), + PlayableItem::Track(track) => Playable::Track(track.into()), + } + } +} + impl fmt::Display for Playable { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { diff --git a/src/playlist.rs b/src/playlist.rs index 6c5691d..c3863e1 100644 --- a/src/playlist.rs +++ b/src/playlist.rs @@ -6,6 +6,7 @@ use rand::{seq::IteratorRandom, thread_rng}; use log::debug; use rspotify::model::playlist::{FullPlaylist, SimplifiedPlaylist}; +use rspotify::model::Id; use crate::playable::Playable; use crate::queue::Queue; @@ -22,7 +23,7 @@ pub struct Playlist { pub owner_id: String, pub snapshot_id: String, pub num_tracks: usize, - pub tracks: Option>, + pub tracks: Option>, pub collaborative: bool, } @@ -35,7 +36,7 @@ impl Playlist { self.tracks = Some(self.get_all_tracks(spotify)); } - fn get_all_tracks(&self, spotify: Spotify) -> Vec { + fn get_all_tracks(&self, spotify: Spotify) -> Vec { let tracks_result = spotify.api.user_playlist_tracks(&self.id); while !tracks_result.at_end() { tracks_result.next(); @@ -49,7 +50,7 @@ impl Playlist { self.tracks.as_ref().map_or(false, |tracks| { tracks .iter() - .any(|track| track.id == Some(track_id.to_string())) + .any(|track| track.id() == Some(track_id.to_string())) }) } @@ -58,7 +59,7 @@ impl Playlist { debug!("deleting track: {} {:?}", index, track); match spotify .api - .delete_tracks(&self.id, &self.snapshot_id, &[(&track, track.list_index)]) + .delete_tracks(&self.id, &self.snapshot_id, &[track]) { false => false, true => { @@ -72,16 +73,15 @@ impl Playlist { } } - pub fn append_tracks(&mut self, new_tracks: &[Track], spotify: Spotify, library: Arc) { - let track_ids: Vec = new_tracks - .to_vec() - .iter() - .filter_map(|t| t.id.clone()) - .collect(); - + pub fn append_tracks( + &mut self, + new_tracks: &[Playable], + spotify: Spotify, + library: Arc, + ) { let mut has_modified = false; - if spotify.api.append_tracks(&self.id, &track_ids, None) { + if spotify.api.append_tracks(&self.id, new_tracks, None) { if let Some(tracks) = &mut self.tracks { tracks.append(&mut new_tracks.to_vec()); has_modified = true; @@ -148,18 +148,12 @@ impl Playlist { impl From<&SimplifiedPlaylist> for Playlist { fn from(list: &SimplifiedPlaylist) -> Self { - let num_tracks = if let Some(number) = list.tracks.get("total") { - number.as_u64().unwrap() as usize - } else { - 0 - }; - Playlist { - id: list.id.clone(), + id: list.id.id().to_string(), name: list.name.clone(), - owner_id: list.owner.id.clone(), + owner_id: list.owner.id.id().to_string(), snapshot_id: list.snapshot_id.clone(), - num_tracks, + num_tracks: list.tracks.total as usize, tracks: None, collaborative: list.collaborative, } @@ -169,9 +163,9 @@ impl From<&SimplifiedPlaylist> for Playlist { impl From<&FullPlaylist> for Playlist { fn from(list: &FullPlaylist) -> Self { Playlist { - id: list.id.clone(), + id: list.id.id().to_string(), name: list.name.clone(), - owner_id: list.owner.id.clone(), + owner_id: list.owner.id.id().to_string(), snapshot_id: list.snapshot_id.clone(), num_tracks: list.tracks.total as usize, tracks: None, @@ -190,7 +184,7 @@ impl ListItem for Playlist { .iter() .filter_map(|t| t.id()) .collect(); - let ids: Vec = tracks.iter().filter_map(|t| t.id.clone()).collect(); + let ids: Vec = tracks.iter().filter_map(|t| t.id()).collect(); !ids.is_empty() && playing == ids } else { false @@ -229,10 +223,6 @@ impl ListItem for Playlist { self.load_tracks(queue.get_spotify()); if let Some(tracks) = &self.tracks { - let tracks: Vec = tracks - .iter() - .map(|track| Playable::Track(track.clone())) - .collect(); let index = queue.append_next(tracks); queue.play(index, true, true); } @@ -243,7 +233,7 @@ impl ListItem for Playlist { if let Some(tracks) = self.tracks.as_ref() { for track in tracks.iter().rev() { - queue.insert_after_current(Playable::Track(track.clone())); + queue.insert_after_current(track.clone()); } } } @@ -253,7 +243,7 @@ impl ListItem for Playlist { if let Some(tracks) = self.tracks.as_ref() { for track in tracks.iter() { - queue.append(Playable::Track(track.clone())); + queue.append(track.clone()); } } } @@ -294,7 +284,7 @@ impl ListItem for Playlist { .tracks .as_ref()? .iter() - .map(|t| t.id.clone()) + .map(|t| t.id()) .flatten() // only select unique tracks .collect::>() @@ -309,7 +299,11 @@ impl ListItem for Playlist { let spotify = queue.get_spotify(); let recommendations: Option> = spotify .api - .recommendations(None, None, Some(track_ids)) + .recommendations( + None, + None, + Some(track_ids.iter().map(|t| t.as_ref()).collect()), + ) .map(|r| r.tracks) .map(|tracks| tracks.iter().map(Track::from).collect()); diff --git a/src/queue.rs b/src/queue.rs index e2d5ca6..d0abdd8 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -146,7 +146,7 @@ impl Queue { q.push(track); } - pub fn append_next(&self, tracks: Vec) -> usize { + pub fn append_next(&self, tracks: &Vec) -> usize { let mut q = self.queue.write().unwrap(); { diff --git a/src/show.rs b/src/show.rs index a9cf843..7f15afb 100644 --- a/src/show.rs +++ b/src/show.rs @@ -6,6 +6,7 @@ use crate::spotify::Spotify; use crate::traits::{IntoBoxedViewExt, ListItem, ViewExt}; use crate::ui::show::ShowView; use rspotify::model::show::{FullShow, SimplifiedShow}; +use rspotify::model::Id; use std::fmt; use std::sync::Arc; @@ -39,8 +40,8 @@ impl Show { impl From<&SimplifiedShow> for Show { fn from(show: &SimplifiedShow) -> Self { Self { - id: show.id.clone(), - uri: show.uri.clone(), + id: show.id.id().to_string(), + uri: show.id.uri(), name: show.name.clone(), publisher: show.publisher.clone(), description: show.description.clone(), @@ -53,8 +54,8 @@ impl From<&SimplifiedShow> for Show { impl From<&FullShow> for Show { fn from(show: &FullShow) -> Self { Self { - id: show.id.clone(), - uri: show.uri.clone(), + id: show.id.id().to_string(), + uri: show.id.uri(), name: show.name.clone(), publisher: show.publisher.clone(), description: show.description.clone(), @@ -103,7 +104,7 @@ impl ListItem for Show { .map(|ep| Playable::Episode(ep.clone())) .collect(); - let index = queue.append_next(playables); + let index = queue.append_next(&playables); queue.play(index, true, true); } diff --git a/src/spotify.rs b/src/spotify.rs index c3544d7..bd11dd3 100644 --- a/src/spotify.rs +++ b/src/spotify.rs @@ -12,8 +12,6 @@ use librespot_playback::audio_backend; use librespot_playback::config::Bitrate; use librespot_playback::player::Player; -use rspotify::senum::Country; - use futures::channel::oneshot; use tokio::sync::mpsc; @@ -82,14 +80,7 @@ impl Spotify { spotify.api.set_worker_channel(spotify.channel.clone()); spotify.api.update_token(); - let country: Option = spotify - .api - .current_user() - .and_then(|u| u.country) - .and_then(|c| c.parse().ok()); - spotify.api.set_user(spotify.user.clone()); - spotify.api.set_country(country); spotify } diff --git a/src/spotify_api.rs b/src/spotify_api.rs index 7207223..75b9317 100644 --- a/src/spotify_api.rs +++ b/src/spotify_api.rs @@ -7,22 +7,19 @@ use crate::spotify_worker::WorkerCommand; use crate::track::Track; use crate::ui::pagination::{ApiPage, ApiResult}; use chrono::{DateTime, Duration as ChronoDuration, Utc}; -use failure::Error; use futures::channel::oneshot; use log::{debug, error, info}; -use rspotify::blocking::client::ApiError; -use rspotify::blocking::client::Spotify as SpotifyAPI; -use rspotify::model::album::{FullAlbum, SavedAlbum}; -use rspotify::model::artist::FullArtist; -use rspotify::model::page::{CursorBasedPage, Page}; -use rspotify::model::playlist::FullPlaylist; -use rspotify::model::recommend::Recommendations; -use rspotify::model::search::SearchResult; -use rspotify::model::show::{FullEpisode, FullShow, Show}; -use rspotify::model::track::{FullTrack, SavedTrack, SimplifiedTrack}; -use rspotify::model::user::PrivateUser; -use rspotify::senum::{AlbumType, Country, SearchType}; -use serde_json::{json, Map}; + +use rspotify::http::HttpError; +use rspotify::model::{ + AlbumId, AlbumType, ArtistId, CursorBasedPage, EpisodeId, FullAlbum, FullArtist, FullEpisode, + FullPlaylist, FullShow, FullTrack, ItemPositions, Market, Page, PlayableId, PlaylistId, + PrivateUser, Recommendations, SavedAlbum, SavedTrack, SearchResult, SearchType, Show, ShowId, + SimplifiedTrack, TrackId, UserId, +}; +use rspotify::{prelude::*, AuthCodeSpotify, ClientError, ClientResult, Token}; +use std::collections::HashSet; +use std::iter::FromIterator; use std::sync::{Arc, RwLock}; use std::thread; use std::time::Duration; @@ -30,9 +27,8 @@ use tokio::sync::mpsc; #[derive(Clone)] pub struct WebApi { - api: Arc>, + api: AuthCodeSpotify, user: Option, - country: Option, worker_channel: Arc>>>, token_expiration: Arc>>, } @@ -40,9 +36,8 @@ pub struct WebApi { impl WebApi { pub fn new() -> WebApi { WebApi { - api: Arc::new(RwLock::new(SpotifyAPI::default())), + api: AuthCodeSpotify::default(), user: None, - country: None, worker_channel: Arc::new(RwLock::new(None)), token_expiration: Arc::new(RwLock::new(Utc::now())), } @@ -52,10 +47,6 @@ impl WebApi { self.user = user; } - pub fn set_country(&mut self, country: Option) { - self.country = country; - } - pub(crate) fn set_worker_channel( &mut self, channel: Arc>>>, @@ -87,8 +78,13 @@ impl WebApi { { channel.send(cmd).expect("can't send message to worker"); let token = futures::executor::block_on(token_rx).unwrap(); - self.api.write().expect("can't writelock api").access_token = - Some(token.access_token.to_string()); + *self.api.token.lock().expect("can't writelock api token") = Some(Token { + access_token: token.access_token, + expires_in: chrono::Duration::seconds(token.expires_in.into()), + scopes: HashSet::from_iter(token.scope), + expires_at: None, + refresh_token: None, + }); *self .token_expiration .write() @@ -102,32 +98,32 @@ impl WebApi { /// retries once when rate limits are hit fn api_with_retry(&self, cb: F) -> Option where - F: Fn(&SpotifyAPI) -> Result, + F: Fn(&AuthCodeSpotify) -> ClientResult, { - let result = { - let api = self.api.read().expect("can't read api"); - cb(&api) - }; + let result = { cb(&self.api) }; match result { Ok(v) => Some(v), - Err(e) => { - debug!("api error: {:?}", e); - if let Ok(apierror) = e.downcast::() { - match apierror { - ApiError::RateLimited(d) => { - debug!("rate limit hit. waiting {:?} seconds", d); - thread::sleep(Duration::from_secs(d.unwrap_or(0) as u64)); - let api = self.api.read().expect("can't read api"); - cb(&api).ok() + Err(ClientError::Http(error)) => { + debug!("http error: {:?}", error); + if let HttpError::StatusCode(response) = error.as_ref() { + match response.status() { + 429 => { + let waiting_duration = response + .header("Retry-After") + .and_then(|v| v.parse::().ok()); + debug!("rate limit hit. waiting {:?} seconds", waiting_duration); + thread::sleep( + Duration::from_secs(waiting_duration.unwrap_or(0) as u64), + ); + cb(&self.api).ok() } - ApiError::Unauthorized => { + 401 => { debug!("token unauthorized. trying refresh.."); self.update_token(); - let api = self.api.read().expect("can't read api"); - cb(&api).ok() + cb(&self.api).ok() } - e => { - error!("unhandled api error: {}", e); + _ => { + error!("unhandled api error: {:?}", response); None } } @@ -135,17 +131,34 @@ impl WebApi { None } } + Err(e) => { + error!("unhandled api error: {}", e); + None + } } } pub fn append_tracks( &self, playlist_id: &str, - tracks: &[String], + tracks: &[Playable], position: Option, ) -> bool { self.api_with_retry(|api| { - api.user_playlist_add_tracks(self.user.as_ref().unwrap(), playlist_id, tracks, position) + let trackids: Vec> = tracks + .iter() + .map(|playable| { + Box::new( + TrackId::from_id(playable.id().as_ref().unwrap_or(&"".to_string())) + .unwrap(), + ) as Box + }) + .collect(); + api.playlist_add_items( + &PlaylistId::from_id(playlist_id).unwrap(), + trackids.iter().map(|id| id.as_ref()), + position, + ) }) .is_some() } @@ -154,31 +167,45 @@ impl WebApi { &self, playlist_id: &str, snapshot_id: &str, - track_pos_pairs: &[(&Track, usize)], + playables: &[Playable], ) -> bool { - let mut tracks = Vec::new(); - for (track, pos) in track_pos_pairs { - let track_occurrence = json!({ - "uri": format!("spotify:track:{}", track.id.clone().unwrap()), - "positions": [pos] - }); - let track_occurrence_object = track_occurrence.as_object(); - tracks.push(track_occurrence_object.unwrap().clone()); - } - self.api_with_retry(|api| { - api.user_playlist_remove_specific_occurrenes_of_tracks( - self.user.as_ref().unwrap(), - playlist_id, - tracks.clone(), - Some(snapshot_id.to_string()), + self.api_with_retry(move |api| { + let playable_ids: Vec> = playables + .iter() + .map(|playable| match playable { + Playable::Track(track) => { + Box::new(TrackId::from_id(&track.id.clone().unwrap_or_default()).unwrap()) + as Box + } + Playable::Episode(episode) => { + Box::new(EpisodeId::from_id(&episode.id).unwrap()) as Box + } + }) + .collect(); + let positions = playables + .iter() + .map(|playable| [playable.list_index() as u32]) + .collect::>(); + let item_pos: Vec = playable_ids + .iter() + .zip(positions.iter()) + .map(|(id, positions)| ItemPositions { + id: id.as_ref(), + positions, + }) + .collect(); + api.playlist_remove_specific_occurrences_of_items( + &PlaylistId::from_id(playlist_id).unwrap(), + item_pos, + Some(snapshot_id), ) }) .is_some() } pub fn overwrite_playlist(&self, id: &str, tracks: &[Playable]) { - // extract only track IDs - let mut tracks: Vec = tracks.iter().filter_map(|track| track.id()).collect(); + // create mutable copy for chunking + let mut tracks: Vec = tracks.to_vec(); // we can only send 100 tracks per request let mut remainder = if tracks.len() > 100 { @@ -188,7 +215,22 @@ impl WebApi { }; if let Some(()) = self.api_with_retry(|api| { - api.user_playlist_replace_tracks(self.user.as_ref().unwrap(), id, &tracks) + let playable_ids: Vec> = tracks + .iter() + .map(|playable| match playable { + Playable::Track(track) => { + Box::new(TrackId::from_id(&track.id.clone().unwrap_or_default()).unwrap()) + as Box + } + Playable::Episode(episode) => { + Box::new(EpisodeId::from_id(&episode.id).unwrap()) as Box + } + }) + .collect(); + api.playlist_replace_items( + &PlaylistId::from_id(id).unwrap(), + playable_ids.iter().map(|p| p.as_ref()), + ) }) { debug!("saved {} tracks to playlist {}", tracks.len(), id); while let Some(ref mut tracks) = remainder.clone() { @@ -213,7 +255,7 @@ impl WebApi { } pub fn delete_playlist(&self, id: &str) -> bool { - self.api_with_retry(|api| api.user_playlist_unfollow(self.user.as_ref().unwrap(), id)) + self.api_with_retry(|api| api.playlist_unfollow(&PlaylistId::from_id(id).unwrap())) .is_some() } @@ -221,57 +263,83 @@ impl WebApi { &self, name: &str, public: Option, - description: Option, + description: Option<&str>, ) -> Option { let result = self.api_with_retry(|api| { api.user_playlist_create( - self.user.as_ref().unwrap(), + &UserId::from_id(self.user.as_ref().unwrap()).unwrap(), name, public, - description.clone(), + None, + description, ) }); - result.map(|r| r.id) + result.map(|r| r.id.id().to_string()) } pub fn album(&self, album_id: &str) -> Option { - self.api_with_retry(|api| api.album(album_id)) + self.api_with_retry(|api| api.album(&AlbumId::from_id(album_id).unwrap())) } pub fn artist(&self, artist_id: &str) -> Option { - self.api_with_retry(|api| api.artist(artist_id)) + self.api_with_retry(|api| api.artist(&ArtistId::from_id(artist_id).unwrap())) } pub fn playlist(&self, playlist_id: &str) -> Option { - self.api_with_retry(|api| api.playlist(playlist_id, None, self.country)) + self.api_with_retry(|api| { + api.playlist( + &PlaylistId::from_id(playlist_id).unwrap(), + None, + Some(&Market::FromToken), + ) + }) } pub fn track(&self, track_id: &str) -> Option { - self.api_with_retry(|api| api.track(track_id)) + self.api_with_retry(|api| api.track(&TrackId::from_id(track_id).unwrap())) } pub fn get_show(&self, show_id: &str) -> Option { - self.api_with_retry(|api| api.get_a_show(show_id.to_string(), self.country)) + self.api_with_retry(|api| { + api.get_a_show(&ShowId::from_id(show_id).unwrap(), Some(&Market::FromToken)) + }) } pub fn episode(&self, episode_id: &str) -> Option { - self.api_with_retry(|api| api.get_an_episode(episode_id.to_string(), self.country)) + self.api_with_retry(|api| { + api.get_an_episode( + &EpisodeId::from_id(episode_id).unwrap(), + Some(&Market::FromToken), + ) + }) } pub fn recommendations( &self, - seed_artists: Option>, - seed_genres: Option>, - seed_tracks: Option>, + seed_artists: Option>, + seed_genres: Option>, + seed_tracks: Option>, ) -> Option { self.api_with_retry(|api| { + let seed_artistids = seed_artists.as_ref().map(|artistids| { + artistids + .iter() + .map(|id| ArtistId::from_id(id).unwrap()) + .collect::>() + }); + let seed_trackids = seed_tracks.as_ref().map(|trackids| { + trackids + .iter() + .map(|id| TrackId::from_id(id).unwrap()) + .collect::>() + }); api.recommendations( - seed_artists.clone(), + std::iter::empty(), + seed_artistids.as_ref(), seed_genres.clone(), - seed_tracks.clone(), - 100, - self.country, - &Map::new(), + seed_trackids.as_ref(), + Some(&Market::FromToken), + Some(100), ) }) } @@ -283,8 +351,17 @@ impl WebApi { limit: u32, offset: u32, ) -> Option { - self.api_with_retry(|api| api.search(query, searchtype, limit, offset, self.country, None)) - .take() + self.api_with_retry(|api| { + api.search( + query, + &searchtype, + Some(&Market::FromToken), + None, + Some(limit), + Some(offset), + ) + }) + .take() } pub fn current_user_playlist(&self) -> ApiResult { @@ -292,19 +369,21 @@ impl WebApi { let spotify = self.clone(); let fetch_page = move |offset: u32| { debug!("fetching user playlists, offset: {}", offset); - spotify.api_with_retry(|api| match api.current_user_playlists(MAX_LIMIT, offset) { - Ok(page) => Ok(ApiPage { - offset: page.offset, - total: page.total, - items: page.items.iter().map(|sp| sp.into()).collect(), - }), - Err(e) => Err(e), + spotify.api_with_retry(|api| { + match api.current_user_playlists_manual(Some(MAX_LIMIT), Some(offset)) { + Ok(page) => Ok(ApiPage { + offset: page.offset, + total: page.total, + items: page.items.iter().map(|sp| sp.into()).collect(), + }), + Err(e) => Err(e), + } }) }; ApiResult::new(MAX_LIMIT, Arc::new(fetch_page)) } - pub fn user_playlist_tracks(&self, playlist_id: &str) -> ApiResult { + pub fn user_playlist_tracks(&self, playlist_id: &str) -> ApiResult { const MAX_LIMIT: u32 = 100; let spotify = self.clone(); let playlist_id = playlist_id.to_string(); @@ -314,13 +393,12 @@ impl WebApi { playlist_id, offset ); spotify.api_with_retry(|api| { - match api.user_playlist_tracks( - spotify.user.as_ref().unwrap(), - &playlist_id, + match api.playlist_items_manual( + &PlaylistId::from_id(&playlist_id).unwrap(), None, - MAX_LIMIT, - offset, - spotify.country, + Some(&Market::FromToken), + Some(MAX_LIMIT), + Some(offset), ) { Ok(page) => Ok(ApiPage { offset: page.offset, @@ -331,10 +409,11 @@ impl WebApi { .enumerate() .flat_map(|(index, pt)| { pt.track.as_ref().map(|t| { - let mut track: Track = t.into(); - track.added_at = Some(pt.added_at); - track.list_index = page.offset as usize + index; - track + let mut playable: Playable = t.into(); + // TODO: set these + playable.set_added_at(pt.added_at); + playable.set_list_index(page.offset as usize + index); + playable }) }) .collect(), @@ -347,7 +426,7 @@ impl WebApi { } pub fn full_album(&self, album_id: &str) -> Option { - self.api_with_retry(|api| api.album(album_id)) + self.api_with_retry(|api| api.album(&AlbumId::from_id(album_id).unwrap())) } pub fn album_tracks( @@ -356,7 +435,13 @@ impl WebApi { limit: u32, offset: u32, ) -> Option> { - self.api_with_retry(|api| api.album_track(album_id, limit, offset)) + self.api_with_retry(|api| { + api.album_track_manual( + &AlbumId::from_id(album_id).unwrap(), + Some(limit), + Some(offset), + ) + }) } pub fn artist_albums( @@ -370,10 +455,10 @@ impl WebApi { let fetch_page = move |offset: u32| { debug!("fetching artist {} albums, offset: {}", artist_id, offset); spotify.api_with_retry(|api| { - match api.artist_albums( - &artist_id, - album_type, - spotify.country, + match api.artist_albums_manual( + &ArtistId::from_id(&artist_id).unwrap(), + album_type.as_ref(), + Some(&Market::FromToken), Some(MAX_SIZE), Some(offset), ) { @@ -402,7 +487,12 @@ impl WebApi { let fetch_page = move |offset: u32| { debug!("fetching show {} episodes, offset: {}", &show_id, offset); spotify.api_with_retry(|api| { - match api.get_shows_episodes(show_id.clone(), MAX_SIZE, offset, spotify.country) { + match api.get_shows_episodes_manual( + &ShowId::from_id(&show_id).unwrap(), + Some(&Market::FromToken), + Some(50), + Some(offset), + ) { Ok(page) => Ok(ApiPage { offset: page.offset, total: page.total, @@ -417,71 +507,125 @@ impl WebApi { } pub fn get_saved_shows(&self, offset: u32) -> Option> { - self.api_with_retry(|api| api.get_saved_show(50, offset)) + self.api_with_retry(|api| api.get_saved_show_manual(Some(50), Some(offset))) } - pub fn save_shows(&self, ids: Vec) -> bool { - self.api_with_retry(|api| api.save_shows(ids.clone())) - .is_some() + pub fn save_shows(&self, ids: Vec<&str>) -> bool { + self.api_with_retry(|api| { + api.save_shows( + &ids.iter() + .map(|id| ShowId::from_id(id).unwrap()) + .collect::>(), + ) + }) + .is_some() } - pub fn unsave_shows(&self, ids: Vec) -> bool { - self.api_with_retry(|api| api.remove_users_saved_shows(ids.clone(), self.country)) - .is_some() + pub fn unsave_shows(&self, ids: Vec<&str>) -> bool { + self.api_with_retry(|api| { + api.remove_users_saved_shows( + &ids.iter() + .map(|id| ShowId::from_id(id).unwrap()) + .collect::>(), + Some(&Market::FromToken), + ) + }) + .is_some() } pub fn current_user_followed_artists( &self, - last: Option, + last: Option<&str>, ) -> Option> { - self.api_with_retry(|api| api.current_user_followed_artists(50, last.clone())) - .map(|cp| cp.artists) + self.api_with_retry(|api| api.current_user_followed_artists(last, Some(50))) } - pub fn user_follow_artists(&self, ids: Vec) -> Option<()> { - self.api_with_retry(|api| api.user_follow_artists(&ids)) + pub fn user_follow_artists(&self, ids: Vec<&str>) -> Option<()> { + self.api_with_retry(|api| { + api.user_follow_artists( + &ids.iter() + .map(|id| ArtistId::from_id(id).unwrap()) + .collect::>(), + ) + }) } - pub fn user_unfollow_artists(&self, ids: Vec) -> Option<()> { - self.api_with_retry(|api| api.user_unfollow_artists(&ids)) + pub fn user_unfollow_artists(&self, ids: Vec<&str>) -> Option<()> { + self.api_with_retry(|api| { + api.user_unfollow_artists( + &ids.iter() + .map(|id| ArtistId::from_id(id).unwrap()) + .collect::>(), + ) + }) } pub fn current_user_saved_albums(&self, offset: u32) -> Option> { - self.api_with_retry(|api| api.current_user_saved_albums(50, offset)) + self.api_with_retry(|api| { + api.current_user_saved_albums_manual(Some(&Market::FromToken), Some(50), Some(offset)) + }) } - pub fn current_user_saved_albums_add(&self, ids: Vec) -> Option<()> { - self.api_with_retry(|api| api.current_user_saved_albums_add(&ids)) + pub fn current_user_saved_albums_add(&self, ids: Vec<&str>) -> Option<()> { + self.api_with_retry(|api| { + api.current_user_saved_albums_add( + &ids.iter() + .map(|id| AlbumId::from_id(id).unwrap()) + .collect::>(), + ) + }) } - pub fn current_user_saved_albums_delete(&self, ids: Vec) -> Option<()> { - self.api_with_retry(|api| api.current_user_saved_albums_delete(&ids)) + pub fn current_user_saved_albums_delete(&self, ids: Vec<&str>) -> Option<()> { + self.api_with_retry(|api| { + api.current_user_saved_albums_delete( + &ids.iter() + .map(|id| AlbumId::from_id(id).unwrap()) + .collect::>(), + ) + }) } pub fn current_user_saved_tracks(&self, offset: u32) -> Option> { - self.api_with_retry(|api| api.current_user_saved_tracks(50, offset)) + self.api_with_retry(|api| { + api.current_user_saved_tracks_manual(Some(&Market::FromToken), Some(50), Some(offset)) + }) } - pub fn current_user_saved_tracks_add(&self, ids: Vec) -> Option<()> { - self.api_with_retry(|api| api.current_user_saved_tracks_add(&ids)) + pub fn current_user_saved_tracks_add(&self, ids: Vec<&str>) -> Option<()> { + self.api_with_retry(|api| { + api.current_user_saved_tracks_add( + &ids.iter() + .map(|id| TrackId::from_id(id).unwrap()) + .collect::>(), + ) + }) } - pub fn current_user_saved_tracks_delete(&self, ids: Vec) -> Option<()> { - self.api_with_retry(|api| api.current_user_saved_tracks_delete(&ids)) + pub fn current_user_saved_tracks_delete(&self, ids: Vec<&str>) -> Option<()> { + self.api_with_retry(|api| { + api.current_user_saved_tracks_delete( + &ids.iter() + .map(|id| TrackId::from_id(id).unwrap()) + .collect::>(), + ) + }) } - pub fn user_playlist_follow_playlist(&self, owner_id: String, id: String) -> Option<()> { - self.api_with_retry(|api| api.user_playlist_follow_playlist(&owner_id, &id, true)) + pub fn user_playlist_follow_playlist(&self, id: &str) -> Option<()> { + self.api_with_retry(|api| api.playlist_follow(&PlaylistId::from_id(id).unwrap(), None)) } pub fn artist_top_tracks(&self, id: &str) -> Option> { - self.api_with_retry(|api| api.artist_top_tracks(id, self.country)) - .map(|ft| ft.tracks.iter().map(|t| t.into()).collect()) + self.api_with_retry(|api| { + api.artist_top_tracks(&ArtistId::from_id(id).unwrap(), &Market::FromToken) + }) + .map(|ft| ft.iter().map(|t| t.into()).collect()) } - pub fn artist_related_artists(&self, id: String) -> Option> { - self.api_with_retry(|api| api.artist_related_artists(&id)) - .map(|fa| fa.artists.iter().map(|a| a.into()).collect()) + pub fn artist_related_artists(&self, id: &str) -> Option> { + self.api_with_retry(|api| api.artist_related_artists(&ArtistId::from_id(id).unwrap())) + .map(|fa| fa.iter().map(|a| a.into()).collect()) } pub fn current_user(&self) -> Option { diff --git a/src/track.rs b/src/track.rs index 6d5257a..ae0729b 100644 --- a/src/track.rs +++ b/src/track.rs @@ -4,6 +4,7 @@ use std::sync::{Arc, RwLock}; use chrono::{DateTime, Utc}; use rspotify::model::album::FullAlbum; use rspotify::model::track::{FullTrack, SavedTrack, SimplifiedTrack}; +use rspotify::model::Id; use crate::album::Album; use crate::artist::Artist; @@ -42,7 +43,7 @@ impl Track { let artist_ids = track .artists .iter() - .filter_map(|a| a.id.clone()) + .filter_map(|a| a.id.as_ref().map(|id| id.id().to_string())) .collect::>(); let album_artists = album .artists @@ -51,19 +52,19 @@ impl Track { .collect::>(); Self { - id: track.id.clone(), - uri: track.uri.clone(), + id: track.id.as_ref().map(|id| id.id().to_string()), + uri: track.id.as_ref().map(|id| id.uri()).unwrap_or_default(), title: track.name.clone(), track_number: track.track_number, disc_number: track.disc_number, - duration: track.duration_ms, + duration: track.duration.as_millis() as u32, artists, artist_ids, album: Some(album.name.clone()), - album_id: Some(album.id.clone()), + album_id: Some(album.id.id().to_string()), album_artists, cover_url: album.images.get(0).map(|img| img.url.clone()), - url: track.uri.clone(), + url: track.id.as_ref().map(|id| id.url()).unwrap_or_default(), added_at: None, list_index: 0, } @@ -86,23 +87,23 @@ impl From<&SimplifiedTrack> for Track { let artist_ids = track .artists .iter() - .filter_map(|a| a.id.clone()) + .filter_map(|a| a.id.as_ref().map(|a| a.id().to_string())) .collect::>(); Self { - id: track.id.clone(), - uri: track.uri.clone(), + id: track.id.as_ref().map(|id| id.id().to_string()), + uri: track.id.as_ref().map(|id| id.uri()).unwrap_or_default(), title: track.name.clone(), track_number: track.track_number, disc_number: track.disc_number, - duration: track.duration_ms, + duration: track.duration.as_millis() as u32, artists, artist_ids, album: None, album_id: None, album_artists: Vec::new(), cover_url: None, - url: track.uri.clone(), + url: track.id.as_ref().map(|id| id.url()).unwrap_or_default(), added_at: None, list_index: 0, } @@ -119,7 +120,7 @@ impl From<&FullTrack> for Track { let artist_ids = track .artists .iter() - .filter_map(|a| a.id.clone()) + .filter_map(|a| a.id.as_ref().map(|a| a.id().to_string())) .collect::>(); let album_artists = track .album @@ -129,19 +130,19 @@ impl From<&FullTrack> for Track { .collect::>(); Self { - id: track.id.clone(), - uri: track.uri.clone(), + id: Some(track.id.id().to_string()), + uri: track.id.uri(), title: track.name.clone(), track_number: track.track_number, disc_number: track.disc_number, - duration: track.duration_ms, + duration: track.duration.as_millis() as u32, artists, artist_ids, album: Some(track.album.name.clone()), - album_id: track.album.id.clone(), + album_id: track.album.id.as_ref().map(|a| a.id().to_string()), album_artists, cover_url: track.album.images.get(0).map(|img| img.url.clone()), - url: track.uri.clone(), + url: track.id.url(), added_at: None, list_index: 0, } @@ -210,7 +211,7 @@ impl ListItem for Track { } fn play(&mut self, queue: Arc) { - let index = queue.append_next(vec![Playable::Track(self.clone())]); + let index = queue.append_next(&vec![Playable::Track(self.clone())]); queue.play(index, true, false); } @@ -252,7 +253,7 @@ impl ListItem for Track { let recommendations: Option> = if let Some(id) = &self.id { spotify .api - .recommendations(None, None, Some(vec![id.clone()])) + .recommendations(None, None, Some(vec![id])) .map(|r| r.tracks) .map(|tracks| tracks.iter().map(Track::from).collect()) } else { diff --git a/src/ui/artist.rs b/src/ui/artist.rs index 1ca260a..018c0cf 100644 --- a/src/ui/artist.rs +++ b/src/ui/artist.rs @@ -3,6 +3,7 @@ use std::thread; use cursive::view::ViewWrapper; use cursive::Cursive; +use rspotify::model::AlbumType; use crate::album::Album; use crate::artist::Artist; @@ -14,7 +15,6 @@ use crate::track::Track; use crate::traits::ViewExt; use crate::ui::listview::ListView; use crate::ui::tabview::TabView; -use rspotify::senum::AlbumType; pub struct ArtistView { artist: Artist, @@ -53,7 +53,7 @@ impl ArtistView { let library = library.clone(); thread::spawn(move || { if let Some(id) = id { - if let Some(artists) = spotify.api.artist_related_artists(id) { + if let Some(artists) = spotify.api.artist_related_artists(&id) { related.write().unwrap().extend(artists); library.trigger_redraw(); } diff --git a/src/ui/contextmenu.rs b/src/ui/contextmenu.rs index a9c8c59..1e33b42 100644 --- a/src/ui/contextmenu.rs +++ b/src/ui/contextmenu.rs @@ -71,7 +71,7 @@ impl ContextMenu { let spotify = spotify.clone(); let library = library.clone(); - playlist.append_tracks(&[track.clone()], spotify, library); + playlist.append_tracks(&[Playable::Track(track.clone())], spotify, library); c.pop_layer(); // Close add_track_dialog too @@ -81,7 +81,7 @@ impl ContextMenu { let modal = Modal::new(already_added_dialog); s.add_layer(modal); } else { - playlist.append_tracks(&[track], spotify, library); + playlist.append_tracks(&[Playable::Track(track)], spotify, library); s.pop_layer(); } }); diff --git a/src/ui/listview.rs b/src/ui/listview.rs index a3a0422..5ee15f5 100644 --- a/src/ui/listview.rs +++ b/src/ui/listview.rs @@ -117,7 +117,7 @@ impl ListView { .iter() .map(|track| Playable::Track(track.clone())) .collect(); - let index = self.queue.append_next(tracks); + let index = self.queue.append_next(&tracks); self.queue.play(index + self.selected, true, false); true } else { diff --git a/src/ui/playlist.rs b/src/ui/playlist.rs index 30c39cb..7281aee 100644 --- a/src/ui/playlist.rs +++ b/src/ui/playlist.rs @@ -6,16 +6,17 @@ use cursive::Cursive; use crate::command::Command; use crate::commands::CommandResult; use crate::library::Library; +use crate::playable::Playable; use crate::playlist::Playlist; use crate::queue::Queue; use crate::spotify::Spotify; -use crate::track::Track; + use crate::traits::ViewExt; use crate::ui::listview::ListView; pub struct PlaylistView { playlist: Playlist, - list: ListView, + list: ListView, spotify: Spotify, library: Arc, queue: Arc, @@ -54,7 +55,7 @@ impl PlaylistView { } impl ViewWrapper for PlaylistView { - wrap_impl!(self.list: ListView); + wrap_impl!(self.list: ListView); } impl ViewExt for PlaylistView { @@ -64,7 +65,7 @@ impl ViewExt for PlaylistView { fn title_sub(&self) -> String { if let Some(tracks) = self.playlist.tracks.as_ref() { - let duration_secs = tracks.iter().map(|p| p.duration as u64 / 1000).sum(); + let duration_secs = tracks.iter().map(|p| p.duration() as u64 / 1000).sum(); let duration = std::time::Duration::from_secs(duration_secs); format!( "{} tracks, {}", diff --git a/src/ui/search.rs b/src/ui/search.rs index 2879748..6a690de 100644 --- a/src/ui/search.rs +++ b/src/ui/search.rs @@ -28,7 +28,6 @@ use crate::ui::pagination::Pagination; use crate::ui::search_results::SearchResultsView; use crate::ui::tabview::TabView; use rspotify::model::search::SearchResult; -use rspotify::senum::SearchType; pub struct SearchView { edit: NamedView, diff --git a/src/ui/search_results.rs b/src/ui/search_results.rs index 9382011..2d85300 100644 --- a/src/ui/search_results.rs +++ b/src/ui/search_results.rs @@ -18,7 +18,7 @@ use crate::ui::tabview::TabView; use cursive::view::ViewWrapper; use cursive::Cursive; use rspotify::model::search::SearchResult; -use rspotify::senum::SearchType; +use rspotify::model::SearchType; use std::sync::{Arc, RwLock}; pub struct SearchResultsView {