CLI utility to ingest embedded json metadata from yt-dlp downloads to a SQLite database file
yt-dlp
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: Do main CLI error mangement with anyhow properly

0xBA5E64 f89e9781 0e6ffd08

+16 -11
+16 -11
src/main.rs
··· 1 + use anyhow::Context; 1 2 use clap::{Parser, Subcommand}; 2 3 use sqlx::migrate; 3 4 use sqlx::sqlite::*; ··· 65 66 .expect("Failed to apply database migrations"); 66 67 67 68 match args.cmd { 68 - CmdOption::IndexDirectory { path } => { 69 - index_videos_recursively( 70 - path, 71 - &db_pool, 72 - args.remove_missing, 73 - args.headless, 74 - multi_progress, 69 + CmdOption::IndexDirectory { path } => index_videos_recursively( 70 + path.clone(), 71 + &db_pool, 72 + args.remove_missing, 73 + args.headless, 74 + multi_progress, 75 + ) 76 + .await 77 + .with_context(|| { 78 + format!( 79 + "Failed at indexing directory: \"{}\"", 80 + path.to_string_lossy() 75 81 ) 76 - .await? 77 - } 82 + }), 78 83 CmdOption::ReIndexFailed => { 79 84 reindex_failed_videos(&db_pool, args.remove_missing, args.headless, multi_progress) 80 - .await? 85 + .await 86 + .context("Failed to reindex failed videos") 81 87 } 82 88 } 83 - Ok(()) 84 89 }