A tool to read animebox backup files and export the data in alternate formats.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

47 lines
1.3 KiB

use clap::{App, Arg};
use serde_json::from_reader;
use std::error::Error;
use std::fs::File;
use std::io::BufReader;
use std::path::Path;
const VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");
mod model;
fn read_animeboxes_backup<P: AsRef<Path>>(
path: P,
) -> Result<model::AnimeBoxesBackup, Box<dyn Error>> {
let file = File::open(path)?;
let reader = BufReader::new(file);
let result: model::AnimeBoxesBackup = from_reader(reader)?;
Ok(result)
}
fn main() {
let matches = App::new("AnimeBoxes Sync")
.version(VERSION.unwrap_or("UNKNOWN"))
.author("Drew Short <warrick@sothr.com>")
.about("Parses AnimeBoxes backup files")
.arg(
Arg::with_name("config")
.short("c")
.value_name("FILE")
.help("Set a custom config file")
.takes_value(true),
)
.arg(
Arg::with_name("INPUT")
.help("The AnimeBoxes file to process")
.required(true)
.index(1),
)
.get_matches();
let config = matches.value_of("config").unwrap_or("abs-default.conf");
let path = matches.value_of("INPUT").unwrap();
let result = read_animeboxes_backup(path);
println!("{:#?}", result.unwrap())
}