Update dependencies; Small fixes; Add two links for SS17

This commit is contained in:
2017-05-05 18:08:25 +02:00
parent 61828c55a9
commit 9dfa19fa53
3 changed files with 310 additions and 154 deletions

View File

@@ -28,13 +28,15 @@ mod catalogs {
type Login = Option<(&'static str, &'static str)>;
type CatalogDef = (&'static str, Login);
// (catalog_name, username, password)
// (catalog_name, (username, password))
pub const DS: CatalogDef = ("16w-diskrete-strukturen", None);
pub const EIDI: CatalogDef = ("eidi1-2016", Some(("eidi-2016", "PGdP.16")));
pub const ERA: CatalogDef = ("era-2016", None);
pub const DS: CatalogDef = ("16w-diskrete-strukturen", None);
}
// TODO: use clap for proper CLI
pub const GAD: CatalogDef = ("17s-grundlagen-algorithmen-und-datenstrukturen", None);
pub const EIDS: CatalogDef = ("TODO", None);
pub const LA: CatalogDef = ("17s-lineare-algebra-fuer-informatik", None);
}
const MAX_RETRIES: u8 = 10;
@@ -98,6 +100,9 @@ fn main() {
"DS" => DS,
"EIDI" => EIDI,
"ERA" => ERA,
"GAD" => GAD,
"EIDS" => EIDS,
"LA" => LA,
n => {
if let Some(username) = matches.value_of("username") {
let password = matches.value_of("password").unwrap();
@@ -226,7 +231,7 @@ fn download_presentation(presentation: &Presentation, out_dir: &Path, auth: &str
let mut path = PathBuf::from(out_dir);
path.push(fix_filename(&filename));
println!("Output file: {:?}", path);
println!("Output file: {}", path.display());
if path.exists() {
if zip_is_valid(&path) {
println!("Already present and valid! Skipping!");
@@ -275,6 +280,14 @@ fn download_presentation(presentation: &Presentation, out_dir: &Path, auth: &str
fn fix_filename(string: &str) -> String {
string.replace('/', "_")
.replace('\\', "_")
.replace(':', " -")
.replace('*', "%2A")
.replace('?', "%3F")
.replace('"', "'")
.replace('<', "'")
.replace('>', "'")
.replace('|', "_")
}
fn json_to_presentations(json_str: &str) -> Vec<Presentation> {