mirror of
https://github.com/FliegendeWurst/KIT-ILIAS-downloader.git
synced 2024-08-28 04:04:18 +00:00
parent
1953a019aa
commit
147af49eb8
@ -4,7 +4,9 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- Display a warning if two or more courses/folders have the same name ([#31])
|
||||||
|
|
||||||
## [0.3.3] - 2022-03-21
|
## [0.3.3] - 2022-03-21
|
||||||
### Addded
|
### Addded
|
||||||
- `--all` flag to download all courses ([#30])
|
- `--all` flag to download all courses ([#30])
|
||||||
@ -153,6 +155,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
## [0.1.0] - 2020-04-21
|
## [0.1.0] - 2020-04-21
|
||||||
(undocumented)
|
(undocumented)
|
||||||
|
|
||||||
|
[#31]: https://github.com/FliegendeWurst/KIT-ILIAS-downloader/issues/31
|
||||||
[#30]: https://github.com/FliegendeWurst/KIT-ILIAS-downloader/issues/30
|
[#30]: https://github.com/FliegendeWurst/KIT-ILIAS-downloader/issues/30
|
||||||
[#28]: https://github.com/FliegendeWurst/KIT-ILIAS-downloader/pull/28
|
[#28]: https://github.com/FliegendeWurst/KIT-ILIAS-downloader/pull/28
|
||||||
[#27]: https://github.com/FliegendeWurst/KIT-ILIAS-downloader/issues/27
|
[#27]: https://github.com/FliegendeWurst/KIT-ILIAS-downloader/issues/27
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::{path::Path, sync::Arc};
|
use std::{path::Path, sync::Arc, collections::HashSet};
|
||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
|
|
||||||
@ -20,11 +20,17 @@ pub async fn download(path: &Path, ilias: Arc<ILIAS>, url: &URL) -> Result<()> {
|
|||||||
.context("failed to write folder page html")?;
|
.context("failed to write folder page html")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let mut names = HashSet::new();
|
||||||
for item in content.0 {
|
for item in content.0 {
|
||||||
let item = item?;
|
let item = item?;
|
||||||
let path = path.join(file_escape(
|
let item_name = file_escape(
|
||||||
ilias.course_names.get(item.name()).map(|x| &**x).unwrap_or(item.name()),
|
ilias.course_names.get(item.name()).map(|x| &**x).unwrap_or(item.name()),
|
||||||
));
|
);
|
||||||
|
if names.contains(&item_name) {
|
||||||
|
warning!(format => "folder {} contains duplicated folder {:?}", path.display(), item_name);
|
||||||
|
}
|
||||||
|
names.insert(item_name.clone());
|
||||||
|
let path = path.join(item_name);
|
||||||
let ilias = Arc::clone(&ilias);
|
let ilias = Arc::clone(&ilias);
|
||||||
spawn(process_gracefully(ilias, path, item));
|
spawn(process_gracefully(ilias, path, item));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user