Add command-line option to download all courses

This commit is contained in:
FliegendeWurst 2022-03-21 11:44:06 +01:00
parent d063abc08e
commit 8906069a67
2 changed files with 11 additions and 2 deletions

View File

@ -83,6 +83,10 @@ pub struct Opt {
/// Attempt to re-use session cookies
#[structopt(long)]
pub keep_session: bool,
/// Download all courses
#[structopt(long)]
pub all: bool,
}
pub static LOG_LEVEL: AtomicUsize = AtomicUsize::new(0);

View File

@ -160,9 +160,14 @@ async fn real_main(mut opt: Opt) -> Result<()> {
PROGRESS_BAR.set_message("initializing..");
}
let sync_url = ilias.opt.sync_url.as_deref().unwrap_or(DEFAULT_SYNC_URL);
let sync_url = if ilias.opt.all {
// change on ILIAS update
format!("{}ilias.php?cmdClass=ilmembershipoverviewgui&cmdNode=iy&baseClass=ilmembershipoverviewgui", ILIAS_URL)
} else {
ilias.opt.sync_url.as_deref().unwrap_or(DEFAULT_SYNC_URL).to_owned()
};
let obj = Object::from_url(
URL::from_href(sync_url).context("invalid sync URL")?,
URL::from_href(&sync_url).context("invalid sync URL")?,
String::new(),
None,
)