mirror of
https://github.com/FliegendeWurst/KIT-ILIAS-downloader.git
synced 2024-08-28 04:04:18 +00:00
Add option to save ILIAS pages (fix #22)
This commit is contained in:
parent
1c41c95773
commit
3e0a2bf154
@ -41,6 +41,10 @@ pub struct Opt {
|
||||
#[structopt(long)]
|
||||
pub combine_videos: bool,
|
||||
|
||||
/// Save overview pages of ILIAS courses and folders
|
||||
#[structopt(long)]
|
||||
pub save_ilias_pages: bool,
|
||||
|
||||
/// Verbose logging
|
||||
#[structopt(short, multiple = true, parse(from_occurrences))]
|
||||
pub verbose: usize,
|
||||
|
@ -34,11 +34,13 @@ pub async fn download(path: PathBuf, ilias: Arc<ILIAS>, url: &URL, name: &str) -
|
||||
} else {
|
||||
ilias.get_course_content(&url).await?
|
||||
};
|
||||
if let Some(s) = content.1.as_ref() {
|
||||
let path = path.join("course.html");
|
||||
write_file_data(&path, &mut s.as_bytes())
|
||||
.await
|
||||
.context("failed to write course page html")?;
|
||||
if ilias.opt.save_ilias_pages {
|
||||
if let Some(s) = content.1.as_ref() {
|
||||
let path = path.join("course.html");
|
||||
write_file_data(&path, &mut s.as_bytes())
|
||||
.await
|
||||
.context("failed to write course page html")?;
|
||||
}
|
||||
}
|
||||
for item in content.0 {
|
||||
let item = item?;
|
||||
|
@ -12,11 +12,13 @@ use super::{ILIAS, URL};
|
||||
|
||||
pub async fn download(path: &Path, ilias: Arc<ILIAS>, url: &URL) -> Result<()> {
|
||||
let content = ilias.get_course_content(&url).await?;
|
||||
if let Some(s) = content.1.as_ref() {
|
||||
let path = path.join("folder.html");
|
||||
write_file_data(&path, &mut s.as_bytes())
|
||||
.await
|
||||
.context("failed to write folder page html")?;
|
||||
if ilias.opt.save_ilias_pages {
|
||||
if let Some(s) = content.1.as_ref() {
|
||||
let path = path.join("folder.html");
|
||||
write_file_data(&path, &mut s.as_bytes())
|
||||
.await
|
||||
.context("failed to write folder page html")?;
|
||||
}
|
||||
}
|
||||
for item in content.0 {
|
||||
let item = item?;
|
||||
|
Loading…
Reference in New Issue
Block a user