Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
style: format yt_dataset and archive commands from PR #151
IGECT93ac8f839345
diff --git a/src-tauri/omniget-cli/src/commands/archive.rs b/src-tauri/omniget-cli/src/commands/archive.rsindex e2315180..93730ba6 100644--- a/src-tauri/omniget-cli/src/commands/archive.rs+++ b/src-tauri/omniget-cli/src/commands/archive.rs@@ -27,7 +27,12 @@ pub struct ArchiveArgs {#[arg(long, help = "NDJSON from `omniget search --json` to add to the queue")]pub seed: Option<String>,- #[arg(short, long, default_value = "best", help = "best | audio | max height (e.g. 360)")]+ #[arg(+ short,+ long,+ default_value = "best",+ help = "best | audio | max height (e.g. 360)"+ )]pub quality: String,#[arg(long, help = "Subtitle languages, yt-dlp syntax (e.g. \".*-orig,en\")")]@@ -39,13 +44,21 @@ pub struct ArchiveArgs {#[arg(long, help = "Save the thumbnail next to each video")]pub thumbnail: bool,- #[arg(long, default_value_t = 0, help = "Stop after N items this run (0 = all)")]+ #[arg(+ long,+ default_value_t = 0,+ help = "Stop after N items this run (0 = all)"+ )]pub max_items: u32,#[arg(long, help = "Stop when the folder reaches this size in GB")]pub max_gb: Option<f64>,- #[arg(long, default_value_t = 0, help = "Seconds to wait before each download")]+ #[arg(+ long,+ default_value_t = 0,+ help = "Seconds to wait before each download"+ )]pub sleep: u32,#[arg(long, help = "Put failed items back in the queue")]@@ -98,7 +111,10 @@ fn seed_queue(dest: &Path, seed: &str) -> Result<()> {.unwrap_or_default();let r = yt_dataset::seed(dest, &title, yt_dataset::parse_seed(&text))?;if output::is_json_mode() {- println!("{}", json!({ "type": "seeded", "added": r.added, "total": r.total }));+ println!(+ "{}",+ json!({ "type": "seeded", "added": r.added, "total": r.total })+ );} else {println!("Queue: +{} new, {} total", r.added, r.total);}diff --git a/src-tauri/omniget-cli/src/commands/search.rs b/src-tauri/omniget-cli/src/commands/search.rsindex 8376a773..496b7f6d 100644--- a/src-tauri/omniget-cli/src/commands/search.rs+++ b/src-tauri/omniget-cli/src/commands/search.rs@@ -21,7 +21,12 @@ pub struct SearchArgs {#[arg(long, help = "File with one search term per line (# starts a comment)")]pub queries_file: Option<String>,- #[arg(short = 'n', long, default_value_t = 20, help = "Results per term (max 500)")]+ #[arg(+ short = 'n',+ long,+ default_value_t = 20,+ help = "Results per term (max 500)"+ )]pub max_results: u32,#[arg(long, default_value = "youtube", help = "youtube | soundcloud")]@@ -33,7 +38,11 @@ pub struct SearchArgs {#[arg(long, help = "Drop videos longer than this (seconds)")]pub max_duration: Option<f64>,- #[arg(long, value_delimiter = ',', help = "Keep titles containing any of these (comma-separated)")]+ #[arg(+ long,+ value_delimiter = ',',+ help = "Keep titles containing any of these (comma-separated)"+ )]pub title_has: Vec<String>,}@@ -57,8 +66,10 @@ pub async fn execute(args: SearchArgs, proxy: Option<String>) -> Result<()> {};match yt_search::search(&opts).await {Ok(hits) => {- let fresh: Vec<SearchHit> =- hits.into_iter().filter(|h| seen.insert(h.id.clone())).collect();+ let fresh: Vec<SearchHit> = hits+ .into_iter()+ .filter(|h| seen.insert(h.id.clone()))+ .collect();eprintln!("{query}: {} new", fresh.len());fresh.iter().try_for_each(print_hit)?;}diff --git a/src-tauri/omniget-core/src/core/tools/yt_archive.rs b/src-tauri/omniget-core/src/core/tools/yt_archive.rsindex b7f6ecc5..e066fa50 100644--- a/src-tauri/omniget-core/src/core/tools/yt_archive.rs+++ b/src-tauri/omniget-core/src/core/tools/yt_archive.rs@@ -624,7 +624,11 @@ pub async fn run(opts: Options, progress: super::ProgressFn) -> anyhow::Result<Asuper::report(&progress,ID,- if cancelled || blocked { "progress" } else { "done" },+ if cancelled || blocked {+ "progress"+ } else {+ "done"+ },c.done as u64,Some(total),None,@@ -1139,7 +1143,10 @@ mod tests {let a = extra_args(&o);assert!(a.contains(&".*-orig,en".to_string()));assert!(a.contains(&"--ignore-errors".to_string()));- let i = a.iter().position(|x| x == "--max-sleep-interval").expect("pausa");+ let i = a+ .iter()+ .position(|x| x == "--max-sleep-interval")+ .expect("pausa");assert_eq!(a[i + 1], "10");}diff --git a/src-tauri/omniget-core/src/core/tools/yt_dataset.rs b/src-tauri/omniget-core/src/core/tools/yt_dataset.rsindex 7fe72337..65717759 100644--- a/src-tauri/omniget-core/src/core/tools/yt_dataset.rs+++ b/src-tauri/omniget-core/src/core/tools/yt_dataset.rs@@ -124,7 +124,11 @@ lixoassert_eq!((r2.added, r2.total), (1, 3));let st = yt_archive::load_state(&dir).expect("estado");let a1 = st.items.iter().find(|i| i.id == "a1").expect("a1");- assert_eq!(a1.status, ItemStatus::Ok, "o que já baixou não volta à fila");+ assert_eq!(+ a1.status,+ ItemStatus::Ok,+ "o que já baixou não volta à fila"+ );let _ = std::fs::remove_dir_all(&dir);}