2020-04-24 20:41:22 +02:00
|
|
|
import argparse
|
|
|
|
from pathlib import Path, PurePath
|
2020-04-23 11:49:15 +02:00
|
|
|
|
2020-04-24 20:41:22 +02:00
|
|
|
import PFERD
|
|
|
|
from PFERD.transform import (attempt, glob, keep, move, move_dir, optionally,
|
|
|
|
re_move)
|
|
|
|
|
|
|
|
tf_ss_2020_numerik = attempt(
|
|
|
|
re_move(r"Übungsblätter/(\d+)\. Übungsblatt/.*", "Blätter/Blatt_{1:0>2}.pdf"),
|
|
|
|
keep,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
tf_ss_2020_db = attempt(
|
|
|
|
move_dir("Begrüßungsvideo/", "Vorlesung/Videos/"),
|
|
|
|
move_dir("Vorlesungsmaterial/Vorlesungsvideos/", "Vorlesung/Videos/"),
|
|
|
|
move_dir("Vorlesungsmaterial/", "Vorlesung/"),
|
|
|
|
keep,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
tf_ss_2020_rechnernetze = attempt(
|
|
|
|
re_move(r"Vorlesungsmaterial/.*/(.+?)\.mp4", "Vorlesung/Videos/{1}.mp4"),
|
|
|
|
move_dir("Vorlesungsmaterial/", "Vorlesung/"),
|
|
|
|
keep,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
tf_ss_2020_sicherheit = attempt(
|
|
|
|
move_dir("Vorlesungsvideos/", "Vorlesung/Videos/"),
|
|
|
|
move_dir("Übungsvideos/", "Übung/Videos/"),
|
|
|
|
re_move(r"VL(.*)\.pdf", "Vorlesung/{1}.pdf"),
|
|
|
|
re_move(r"Übungsblatt (\d+)\.pdf", "Blätter/Blatt_{1:0>2}.pdf"),
|
|
|
|
move("Chiffrat.txt", "Blätter/Blatt_01_Chiffrat.txt"),
|
|
|
|
keep,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
tf_ss_2020_pg = attempt(
|
|
|
|
move_dir("Vorlesungsaufzeichnungen/", "Vorlesung/Videos/"),
|
|
|
|
move_dir("Vorlesungsmaterial/", "Vorlesung/"),
|
|
|
|
re_move(r"Übungen/uebungsblatt(\d+).pdf", "Blätter/Blatt_{1:0>2}.pdf"),
|
|
|
|
keep,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def df_ss_2020_or1(path: PurePath) -> bool:
|
|
|
|
if glob("Tutorien/")(path): return True
|
|
|
|
if glob("Tutorien/Tutorium 10, dienstags 15:45 Uhr/")(path): return True
|
|
|
|
if glob("Tutorien/*")(path): return False
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
tf_ss_2020_or1 = attempt(
|
|
|
|
move_dir("Vorlesung/Unbeschriebene Folien/", "Vorlesung/Folien/"),
|
|
|
|
move_dir("Video zur Organisation/", "Vorlesung/Videos/"),
|
|
|
|
keep,
|
|
|
|
)
|
2020-04-23 11:49:15 +02:00
|
|
|
|
|
|
|
|
2020-04-23 12:35:58 +02:00
|
|
|
def main() -> None:
|
2020-04-24 20:41:22 +02:00
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument("--test-run", action="store_true")
|
|
|
|
parser.add_argument("synchronizers", nargs="*")
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
PFERD.enable_logging()
|
|
|
|
pferd = PFERD.Pferd(Path(__file__).parent, test_run=args.test_run)
|
|
|
|
|
|
|
|
if not args.synchronizers or "numerik" in args.synchronizers:
|
|
|
|
pferd.ilias_kit(
|
|
|
|
target="Numerik",
|
|
|
|
course_id="1083036",
|
|
|
|
transform=tf_ss_2020_numerik,
|
|
|
|
cookies="ilias_cookies.txt",
|
|
|
|
)
|
|
|
|
|
|
|
|
if not args.synchronizers or "db" in args.synchronizers:
|
|
|
|
pferd.ilias_kit(
|
|
|
|
target="DB",
|
|
|
|
course_id="1101554",
|
|
|
|
transform=tf_ss_2020_db,
|
|
|
|
cookies="ilias_cookies.txt",
|
|
|
|
)
|
|
|
|
|
|
|
|
if not args.synchronizers or "rechnernetze" in args.synchronizers:
|
|
|
|
pferd.ilias_kit(
|
|
|
|
target="Rechnernetze",
|
|
|
|
course_id="1099996",
|
|
|
|
transform=tf_ss_2020_rechnernetze,
|
|
|
|
cookies="ilias_cookies.txt",
|
|
|
|
)
|
|
|
|
|
|
|
|
if not args.synchronizers or "sicherheit" in args.synchronizers:
|
|
|
|
pferd.ilias_kit(
|
|
|
|
target="Sicherheit",
|
|
|
|
course_id="1101980",
|
|
|
|
transform=tf_ss_2020_sicherheit,
|
|
|
|
cookies="ilias_cookies.txt",
|
|
|
|
)
|
|
|
|
|
|
|
|
if not args.synchronizers or "pg" in args.synchronizers:
|
|
|
|
pferd.ilias_kit(
|
|
|
|
target="PG",
|
|
|
|
course_id="1106095",
|
|
|
|
transform=tf_ss_2020_pg,
|
|
|
|
cookies="ilias_cookies.txt",
|
|
|
|
)
|
|
|
|
|
|
|
|
if not args.synchronizers or "or1" in args.synchronizers:
|
|
|
|
pferd.ilias_kit(
|
|
|
|
target="OR1",
|
|
|
|
course_id="1105941",
|
|
|
|
dir_filter=df_ss_2020_or1,
|
|
|
|
transform=tf_ss_2020_or1,
|
|
|
|
cookies="ilias_cookies.txt",
|
|
|
|
)
|
2020-04-23 11:49:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|