From fcf933818a5e754f5ad4217aec8bfb16935d7442 Mon Sep 17 00:00:00 2001 From: Simon Stjernholm Date: Wed, 28 Feb 2024 14:47:29 +0100 Subject: [PATCH] update rspotify crate to v0.12.0 (#249) * updated rpsotify v0.11.6 -> v0.11.7 * updated rpspotify to 0.12.0 * fix clippy lints * fix cargo fmt check --- Cargo.lock | 104 ++++++++++++++++++++++------------------- Cargo.toml | 2 +- src/commands/play.rs | 11 +++-- src/sources/spotify.rs | 4 +- src/sources/youtube.rs | 2 +- 5 files changed, 69 insertions(+), 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f1176ea..28834230 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -60,7 +60,7 @@ checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -71,7 +71,7 @@ checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -122,6 +122,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "bitflags" version = "1.3.2" @@ -182,7 +188,6 @@ dependencies = [ "libc", "num-integer", "num-traits 0.2.15", - "rustc-serialize", "serde", "time 0.1.44", "winapi", @@ -280,7 +285,7 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -333,7 +338,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -463,7 +468,7 @@ checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -559,9 +564,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -769,7 +774,7 @@ checksum = "6007f9dad048e0a224f27ca599d669fca8cfa0dac804725aab542b2eb032bce6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -924,7 +929,7 @@ checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1018,7 +1023,7 @@ checksum = "710faf75e1b33345361201d36d04e98ac1ed8909151a017ed384700836104c74" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1054,7 +1059,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn", + "syn 1.0.109", ] [[package]] @@ -1085,18 +1090,18 @@ checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.20" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1181,7 +1186,7 @@ version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" dependencies = [ - "base64", + "base64 0.13.0", "bytes", "encoding_rs", "futures-core", @@ -1237,13 +1242,13 @@ dependencies = [ [[package]] name = "rspotify" -version = "0.11.6" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a86007448fb9a88a0677fd332addf8e7c1057e67bc385d3477c8d44c1bb0e96f" +checksum = "87c6f1d86b10201655f0cd4002088bafe4abcc75cc610613c995abd719f40fcb" dependencies = [ "async-stream", "async-trait", - "base64", + "base64 0.21.7", "chrono", "futures", "getrandom", @@ -1261,9 +1266,9 @@ dependencies = [ [[package]] name = "rspotify-http" -version = "0.11.6" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa7481b3155d1ee3a0a73f94148d3385487e519b795d418ec0df1588961c1105" +checksum = "dad45cd393a8685ee36ec6d2accbb2c955e21ac036a2e4eb175985783f30ed78" dependencies = [ "async-trait", "log", @@ -1275,15 +1280,15 @@ dependencies = [ [[package]] name = "rspotify-macros" -version = "0.11.6" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c86521fc751c75235937f0014dfb17e67f8abc6461b28ad82c9c2acc33a0c47" +checksum = "cc4892882851a97ee7210e423725ce116e8239157c649af37e208fe93855638a" [[package]] name = "rspotify-model" -version = "0.11.6" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b03296b02fc44c9b792635cf8156d13b9d0edf629d74e80c4f551a97a1b83cd" +checksum = "bae90ab3d6e4cb4ccd7f2887c4363d19b1419800e132d3fb95e2f9b24c05f4d7" dependencies = [ "chrono", "enum_dispatch", @@ -1293,12 +1298,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" - [[package]] name = "rustls" version = "0.20.6" @@ -1317,7 +1316,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7522c9de787ff061458fe9a829dc790a3f5b22dc571694fc5883f448b94d9a9" dependencies = [ - "base64", + "base64 0.13.0", ] [[package]] @@ -1424,7 +1423,7 @@ checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1446,7 +1445,7 @@ checksum = "a2ad84e47328a31223de7fed7a4f5087f2d6ddfe586cf3ca25b7a165bc0a5aed" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1469,7 +1468,7 @@ checksum = "82fd5e7b5858ad96e99d440138f34f5b98e1b959ebcd3a1036203b30e78eb788" dependencies = [ "async-trait", "async-tungstenite", - "base64", + "base64 0.13.0", "bitflags", "bytes", "cfg-if", @@ -1631,24 +1630,24 @@ dependencies = [ [[package]] name = "strum" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.24.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4faebde00e8ff94316c01800f9054fd2ba77d30d9e922541913051d1d978918b" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn", + "syn 2.0.51", ] [[package]] @@ -1681,6 +1680,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tempfile" version = "3.3.0" @@ -1712,7 +1722,7 @@ checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1790,7 +1800,7 @@ checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1867,7 +1877,7 @@ checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1931,7 +1941,7 @@ version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" dependencies = [ - "base64", + "base64 0.13.0", "byteorder", "bytes", "http", @@ -2092,7 +2102,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -2126,7 +2136,7 @@ checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/Cargo.toml b/Cargo.toml index 9f93ea27..7c5f19f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ dotenv = "0.15.0" lazy_static = "1.4.0" rand = "0.8.5" regex = "1.5.5" -rspotify = "0.11.6" +rspotify = "0.12.0" serde_json = "1.0.79" url = "2.3.1" serde = "1.0.152" diff --git a/src/commands/play.rs b/src/commands/play.rs index 45ed9d4c..585da68b 100644 --- a/src/commands/play.rs +++ b/src/commands/play.rs @@ -169,7 +169,9 @@ pub async fn play( .ok_or(ParrotError::Other("failed to fetch playlist"))?; for url in urls.iter() { - let Ok(queue) = enqueue_track(&call, &QueryType::VideoLink(url.to_string())).await else { + let Ok(queue) = + enqueue_track(&call, &QueryType::VideoLink(url.to_string())).await + else { continue; }; update_queue_messages(&ctx.http, &ctx.data, &queue, guild_id).await; @@ -194,7 +196,8 @@ pub async fn play( .ok_or(ParrotError::Other("failed to fetch playlist"))?; for (idx, url) in urls.into_iter().enumerate() { - let Ok(queue) = insert_track(&call, &QueryType::VideoLink(url), idx + 1).await else { + let Ok(queue) = insert_track(&call, &QueryType::VideoLink(url), idx + 1).await + else { continue; }; update_queue_messages(&ctx.http, &ctx.data, &queue, guild_id).await; @@ -227,7 +230,9 @@ pub async fn play( let mut insert_idx = 1; for (i, url) in urls.into_iter().enumerate() { - let Ok(mut queue) = insert_track(&call, &QueryType::VideoLink(url), insert_idx).await else { + let Ok(mut queue) = + insert_track(&call, &QueryType::VideoLink(url), insert_idx).await + else { continue; }; diff --git a/src/sources/spotify.rs b/src/sources/spotify.rs index 1ab80e7f..cea8431d 100644 --- a/src/sources/spotify.rs +++ b/src/sources/spotify.rs @@ -94,7 +94,7 @@ impl Spotify { .map_err(|_| ParrotError::Other("track ID contains invalid characters"))?; let track = spotify - .track(track_id) + .track(track_id, None) .await .map_err(|_| ParrotError::Other("failed to fetch track"))?; @@ -112,7 +112,7 @@ impl Spotify { .map_err(|_| ParrotError::Other("album ID contains invalid characters"))?; let album = spotify - .album(album_id) + .album(album_id, None) .await .map_err(|_| ParrotError::Other("failed to fetch album"))?; diff --git a/src/sources/youtube.rs b/src/sources/youtube.rs index 9c4c7bc1..aa4dd467 100644 --- a/src/sources/youtube.rs +++ b/src/sources/youtube.rs @@ -69,7 +69,7 @@ impl YouTubeRestartable { let reader = BufReader::new(stdout); - let lines = reader.lines().flatten().map(|line| { + let lines = reader.lines().map_while(Result::ok).map(|line| { let entry: Value = serde_json::from_str(&line).unwrap(); entry .get("webpage_url")