Add CLI flag for forum downloading

This commit is contained in:
FliegendeWurst 2020-04-22 12:21:14 +02:00
parent 84eda01c29
commit 6fea6f2d0f

View File

@ -525,6 +525,9 @@ fn process(ilias: Arc<ILIAS>, path: PathBuf, obj: Object) -> impl std::future::F
tokio::io::copy(&mut reader, &mut file).await.unwrap(); tokio::io::copy(&mut reader, &mut file).await.unwrap();
}, },
Forum { url, .. } => { Forum { url, .. } => {
if !ilias.opt.forum {
return;
}
if let Err(e) = fs::create_dir(&path) { if let Err(e) = fs::create_dir(&path) {
if e.kind() != io::ErrorKind::AlreadyExists { if e.kind() != io::ErrorKind::AlreadyExists {
println!("error: {:?}", e); println!("error: {:?}", e);
@ -573,6 +576,9 @@ fn process(ilias: Arc<ILIAS>, path: PathBuf, obj: Object) -> impl std::future::F
} }
}, },
Thread { url } => { Thread { url } => {
if !ilias.opt.forum {
return;
}
if let Err(e) = fs::create_dir(&path) { if let Err(e) = fs::create_dir(&path) {
if e.kind() != io::ErrorKind::AlreadyExists { if e.kind() != io::ErrorKind::AlreadyExists {
println!("error: {:?}", e); println!("error: {:?}", e);
@ -640,6 +646,10 @@ struct Opt {
#[structopt(short, long)] #[structopt(short, long)]
no_videos: bool, no_videos: bool,
/// Download forum content
#[structopt(short = "t", long)]
forum: bool,
/// Re-download already present files /// Re-download already present files
#[structopt(short)] #[structopt(short)]
force: bool, force: bool,