From f4f1f1e761a422724c536ade8799a1c7bd2a019f Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Fri, 22 Mar 2024 00:24:35 +0100 Subject: [PATCH 1/2] chore: update dependencies, use workspace deps --- Cargo.toml | 78 +++++++++++++++++++++++++++++++------------ cli/Cargo.toml | 23 +++++++------ codegen/Cargo.toml | 37 ++++++++++---------- codegen/src/main.rs | 2 +- downloader/Cargo.toml | 24 ++++++------- downloader/src/lib.rs | 2 +- 6 files changed, 99 insertions(+), 67 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4fe485e..f7d68a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,20 +14,7 @@ include = ["/src", "README.md", "LICENSE", "!snapshots"] [workspace] members = [".", "codegen", "downloader", "cli"] -[features] -default = ["default-tls"] - -rss = ["quick-xml"] - -# Reqwest TLS options -default-tls = ["reqwest/default-tls"] -native-tls = ["reqwest/native-tls"] -native-tls-alpn = ["reqwest/native-tls-alpn"] -native-tls-vendored = ["reqwest/native-tls-vendored"] -rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"] -rustls-tls-native-roots = ["reqwest/rustls-tls-native-roots"] - -[dependencies] +[workspace.dependencies] quick-js-dtp = { version = "0.4.1", default-features = false, features = [ "patch-dateparser", ] } @@ -36,12 +23,8 @@ regex = "1.6.0" fancy-regex = "0.13.0" thiserror = "1.0.36" url = "2.2.2" -reqwest = { version = "0.11.11", default-features = false, features = [ - "json", - "gzip", - "brotli", -] } -tokio = { version = "1.20.0", features = ["macros", "time"] } +reqwest = { version = "0.12.0", default-features = false } +tokio = "1.20.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.82" serde_with = { version = "3.0.0", default-features = false, features = [ @@ -58,13 +41,64 @@ time = { version = "0.3.15", features = [ futures = "0.3.21" ress = "0.11.4" phf = "0.11.1" +phf_codegen = "0.11.1" base64 = "0.22.0" urlencoding = "2.1.2" -quick-xml = { version = "0.31.0", features = ["serialize"], optional = true } +quick-xml = { version = "0.31.0", features = ["serialize"] } tracing = { version = "0.1.37", features = ["log"] } -[dev-dependencies] +# CLI +indicatif = "0.17.0" +anyhow = "1.0" +clap = { version = "4.0.29", features = ["derive"] } +tracing-subscriber = "0.3.17" +serde_yaml = "0.9.19" +dirs = "5.0.0" +filenamify = "0.1.0" + +# Testing rstest = "0.18.1" tokio-test = "0.4.2" insta = { version = "1.17.1", features = ["ron", "redactions"] } path_macro = "1.0.0" + +[features] +default = ["default-tls"] + +rss = ["quick-xml"] + +# Reqwest TLS options +default-tls = ["reqwest/default-tls"] +native-tls = ["reqwest/native-tls"] +native-tls-alpn = ["reqwest/native-tls-alpn"] +native-tls-vendored = ["reqwest/native-tls-vendored"] +rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"] +rustls-tls-native-roots = ["reqwest/rustls-tls-native-roots"] + +[dependencies] +quick-js-dtp.workspace = true +once_cell.workspace = true +regex.workspace = true +fancy-regex.workspace = true +thiserror.workspace = true +url.workspace = true +reqwest = { workspace = true, features = ["json", "gzip", "brotli"] } +tokio = { workspace = true, features = ["macros", "time"] } +serde.workspace = true +serde_json.workspace = true +serde_with.workspace = true +serde_plain.workspace = true +rand.workspace = true +time.workspace = true +ress.workspace = true +phf.workspace = true +base64.workspace = true +urlencoding.workspace = true +tracing.workspace = true +quick-xml = { workspace = true, optional = true } + +[dev-dependencies] +rstest.workspace = true +tokio-test.workspace = true +insta.workspace = true +path_macro.workspace = true diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 8f2fa8c..f6d6053 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -41,14 +41,15 @@ rustls-tls-native-roots = [ [dependencies] rustypipe = { path = "../", default-features = false } rustypipe-downloader = { path = "../downloader", default-features = false } -reqwest = { version = "0.11.11", default_features = false } -tokio = { version = "1.20.0", features = ["macros", "rt-multi-thread"] } -indicatif = "0.17.0" -futures = "0.3.21" -anyhow = "1.0" -clap = { version = "4.0.29", features = ["derive"] } -tracing-subscriber = "0.3.17" -serde = "1.0" -serde_json = "1.0.82" -serde_yaml = "0.9.19" -dirs = "5.0.0" +reqwest.workspace = true +tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } +futures.workspace = true +serde.workspace = true +serde_json.workspace = true + +indicatif.workspace = true +anyhow.workspace = true +clap.workspace = true +tracing-subscriber.workspace = true +serde_yaml.workspace = true +dirs.workspace = true diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index e3bfff8..4d50480 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -6,24 +6,23 @@ publish = false [dependencies] rustypipe = { path = "../" } -reqwest = "0.11.11" -tokio = { version = "1.20.0", features = ["macros", "rt-multi-thread"] } -futures = "0.3.21" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0.82" -serde_with = { version = "3.0.0", default-features = false, features = [ - "macros", -] } -anyhow = "1.0" -log = "0.4.17" -env_logger = "0.10.0" -clap = { version = "4.0.29", features = ["derive"] } -phf_codegen = "0.11.1" -once_cell = "1.12.0" -regex = "1.7.1" -indicatif = "0.17.0" -num_enum = "0.6.1" -path_macro = "1.0.0" +reqwest.workspace = true +tokio = { workspace = true, features = ["rt-multi-thread"] } +futures.workspace = true +serde.workspace = true +serde_json.workspace = true +serde_with.workspace = true +once_cell.workspace = true +regex.workspace = true +path_macro.workspace = true +anyhow.workspace = true +tracing.workspace = true +tracing-subscriber.workspace = true +clap.workspace = true +phf_codegen.workspace = true +indicatif.workspace = true + +num_enum = "0.7.2" intl_pluralrules = "7.0.2" unic-langid = "0.9.1" -ordered_hash_map = { version = "0.2.0", features = ["serde"] } +ordered_hash_map = { version = "0.4.0", features = ["serde"] } diff --git a/codegen/src/main.rs b/codegen/src/main.rs index bbc8fa8..7c8a5f2 100644 --- a/codegen/src/main.rs +++ b/codegen/src/main.rs @@ -46,7 +46,7 @@ enum Commands { #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let cli = Cli::parse(); match cli.command { diff --git a/downloader/Cargo.toml b/downloader/Cargo.toml index 5e32056..58b9cae 100644 --- a/downloader/Cargo.toml +++ b/downloader/Cargo.toml @@ -29,16 +29,14 @@ rustls-tls-native-roots = [ ] [dependencies] -rustypipe = { path = "..", default-features = false } -once_cell = "1.12.0" -regex = "1.6.0" -thiserror = "1.0.36" -futures = "0.3.21" -indicatif = "0.17.0" -filenamify = "0.1.0" -log = "0.4.17" -reqwest = { version = "0.11.11", default-features = false, features = [ - "stream", -] } -rand = "0.8.5" -tokio = { version = "1.20.0", features = ["macros", "fs", "process"] } +rustypipe = { path = "../", default-features = false } +once_cell.workspace = true +regex.workspace = true +thiserror.workspace = true +futures.workspace = true +reqwest = { workspace = true, features = ["stream"] } +rand.workspace = true +tokio = { workspace = true, features = ["macros", "fs", "process"] } +indicatif.workspace = true +filenamify.workspace = true +tracing.workspace = true diff --git a/downloader/src/lib.rs b/downloader/src/lib.rs index 6377289..a706c3c 100644 --- a/downloader/src/lib.rs +++ b/downloader/src/lib.rs @@ -8,7 +8,6 @@ use std::{borrow::Cow, cmp::Ordering, ffi::OsString, ops::Range, path::PathBuf, use futures::stream::{self, StreamExt}; use indicatif::{ProgressBar, ProgressStyle}; -use log::{debug, info}; use once_cell::sync::Lazy; use rand::Rng; use regex::Regex; @@ -22,6 +21,7 @@ use tokio::{ io::AsyncWriteExt, process::Command, }; +use tracing::{debug, info}; use util::DownloadError; From 0b384cee93565587bea423cd400315bf8a19dccf Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Fri, 22 Mar 2024 00:53:48 +0100 Subject: [PATCH 2/2] tests: fix tests --- tests/youtube.rs | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/tests/youtube.rs b/tests/youtube.rs index 1cb2458..b528385 100644 --- a/tests/youtube.rs +++ b/tests/youtube.rs @@ -1578,20 +1578,12 @@ async fn music_playlist_not_found(rp: RustyPipe) { #[case::no_artist("no_artist", "MPREb_bqWA6mAZFWS")] #[tokio::test] async fn music_album(#[case] name: &str, #[case] id: &str, rp: RustyPipe, unlocalized: bool) { - // TODO: remove visitor data if A/B#13 is stabilized - let album = rp - .query() - .visitor_data_opt( - Some("Cgs1bHFWMlhmM1ZFNCi9jK6vBjIKCgJERRIEEgAgIw%3D%3D") - .filter(|_| name == "one_artist"), - ) - .music_album(id) - .await - .unwrap(); + let album = rp.query().music_album(id).await.unwrap(); assert!(!album.cover.is_empty(), "got no cover"); - if unlocalized { + // TODO: check full snapshot if A/B#13 is stabilized + if unlocalized && name != "one_artist" { insta::assert_ron_snapshot!(format!("music_album_{name}"), album, {".cover" => "[cover]", ".tracks[].view_count" => "[view_count]"} ); @@ -2177,11 +2169,6 @@ async fn music_search_playlists_community(rp: RustyPipe) { assert_eq!(channel.id, "UCs72iRpTEuwV3y6pdWYLgiw"); assert_eq!(channel.name, "Redlist - Just Hits"); assert!(!playlist.from_ytm); - - assert!( - res.items.items.iter().all(|p| !p.from_ytm), - "ytm items found" - ) } /// The YouTube Music search sometimes shows genre radio items. They should be skipped.