use std::{ffi::OsString, time::Duration}; use clap::Parser; use sqlx::sqlite::{SqliteConnectOptions, SqlitePoolOptions}; use witch_watch::{get_db_pool, import_utils::add_omega_watches}; #[derive(Debug, Parser)] struct Cli { #[clap(long, short)] pub db_path: OsString, } #[tokio::main] async fn main() { let cli = Cli::parse(); let path = cli.db_path; let opts = SqliteConnectOptions::new().filename(&path).read_only(true); let movie_db = SqlitePoolOptions::new() .idle_timeout(Duration::from_secs(90)) .connect_with(opts) .await .expect("could not open movies db"); let ww_db = get_db_pool().await; add_omega_watches(&ww_db, &movie_db).await; }