diff options
Diffstat (limited to 'import')
-rw-r--r-- | import/src/main.rs | 74 |
1 files changed, 3 insertions, 71 deletions
diff --git a/import/src/main.rs b/import/src/main.rs index f139d40..645bca0 100644 --- a/import/src/main.rs +++ b/import/src/main.rs @@ -29,7 +29,7 @@ struct Args { #[derive(Subcommand)] enum Action { - Create { + New { path: PathBuf, #[arg(short = 't', long)] tmdb_search: Option<String>, @@ -44,22 +44,6 @@ enum Action { #[arg(short, long)] series: bool, }, - Set { - #[arg(short = 'I', long)] - item: PathBuf, - #[arg(short, long)] - poster: Option<PathBuf>, - #[arg(short, long)] - title: Option<String>, - #[arg(short = 'D', long)] - tagline: Option<String>, - #[arg(short = 'd', long)] - description: Option<String>, - #[arg(short = 'c', long)] - clear_inputs: bool, - #[arg(short = 'i', long, num_args(0..))] - input: Vec<PathBuf>, - }, } fn main() -> anyhow::Result<()> { @@ -70,7 +54,7 @@ fn main() -> anyhow::Result<()> { let args = Args::parse(); match args.action { - Action::Create { + Action::New { path, tmdb_id, tmdb_search, @@ -220,7 +204,7 @@ fn main() -> anyhow::Result<()> { }; if args.dry { - println!("{node:#?}") + println!("{}", serde_json::to_string_pretty(&node)?) } else { std::fs::create_dir_all(&path)?; if let Some(source_path) = source_path_e { @@ -254,58 +238,6 @@ fn main() -> anyhow::Result<()> { Ok(()) } - Action::Set { .. } => { - // let mut iteminfo: ItemInfo = match File::open(item.clone()) { - // Ok(f) => serde_json::from_reader(f)?, - // Err(e) => { - // warn!("could not load item info: {e}"); - // warn!("using the default instead"); - // ItemInfo { - // common: CommmonInfo { - // poster: None, - // backdrop: None, - // tagline: None, - // description: None, - // title: item.to_str().unwrap().to_string(), - // index: None, - // }, - // duration: 0.0, - // tracks: Default::default(), - // } - // } - // }; - - // if let Some(title) = title { - // iteminfo.title = title; - // } - // if let Some(poster) = poster { - // iteminfo.poster = Some(poster); - // } - // if let Some(d) = description { - // iteminfo.description = Some(d); - // } - // if let Some(d) = tagline { - // iteminfo.tagline = Some(d); - // } - // if clear_inputs { - // iteminfo.tracks = Default::default() - // } - - // // for input_path in input { - // // let input = File::open(input_path.clone()).unwrap(); - // // let mut input = EbmlReader::new(input); - // // import_read(&input_path, &mut input, &mut iteminfo)?; - // // } - - // let k = serde_json::to_string_pretty(&iteminfo)?; - // if args.dry { - // println!("{k}") - // } else { - // let mut f = File::create(item)?; - // f.write_all(k.as_bytes())?; - // } - Ok(()) - } } } |