mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Update example config
This commit is contained in:
parent
c7a9a42b3d
commit
45e4500a58
@ -11,6 +11,8 @@ logging.basicConfig(level=logging.INFO, format=PFERD.LOG_FORMAT)
|
||||
|
||||
base_dir = PFERD.get_base_dir(__file__)
|
||||
|
||||
# Semester 1
|
||||
|
||||
def gbi_filter(path):
|
||||
# Tutorien rausfiltern
|
||||
if path.parts[:1] == ("Tutoriumsfolien",):
|
||||
@ -43,7 +45,11 @@ def gbi_transform(path):
|
||||
|
||||
# Skripte in Skripte/*
|
||||
new_path = PFERD.move(path, ("Vorlesung: Skript",), ("Skripte",))
|
||||
if new_path is not None: return new_path
|
||||
if new_path is not None:
|
||||
if new_path.name == "k-21-relationen-skript.pdf":
|
||||
return PFERD.rename(new_path, "21-relationen-skript.pdf")
|
||||
|
||||
return new_path
|
||||
|
||||
# Übungsfolien in Übung/*
|
||||
new_path = PFERD.move(path, ("große Übung: Folien",), ("Übung",))
|
||||
@ -147,6 +153,9 @@ def la1_transform(path):
|
||||
# Übungs-Gedöns in Übung/*
|
||||
new_path = PFERD.move(path, ("Informatikervorlesung", "Übungsfolien"), ("Übung",))
|
||||
if new_path is not None:
|
||||
if new_path.name == "Übung_06_ausgewählte Folien.pdf":
|
||||
return PFERD.rename(new_path, "Übung_06_ausgewählte_Folien.pdf")
|
||||
|
||||
return new_path
|
||||
|
||||
# Vorlesungsfolien-Gedöns in Folien/*
|
||||
@ -191,11 +200,95 @@ def prog_transform(path):
|
||||
return PFERD.rename(new_path, "00-02_Organisatorisches.pdf")
|
||||
if new_path.name == "01-01_ Einfache-Programme.pdf":
|
||||
return PFERD.rename(new_path, "01-01_Einfache_Programme.pdf")
|
||||
if new_path.name == "13_Finden_und_ Beheben_von_Fehlern.pdf":
|
||||
return PFERD.rename(new_path, "13_Finden_und_Beheben_von_Fehlern.pdf")
|
||||
|
||||
return new_path
|
||||
|
||||
return path
|
||||
|
||||
# Semester 2
|
||||
|
||||
def algo1_filter(path):
|
||||
# Tutorien rausfiltern
|
||||
if path.parts[:1] == ("Tutorien",):
|
||||
if path.parts[1:] == (): return True
|
||||
#if path.parts[1:2] == ("Tutorium 15",): return True
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def algo1_transform(path):
|
||||
# Folien in Folien/*
|
||||
new_path = PFERD.move(path, ("Vorlesungsfolien",), ("Folien",))
|
||||
if new_path is not None:
|
||||
return new_path
|
||||
|
||||
return path
|
||||
|
||||
def hm2_transform(path):
|
||||
match = re.match(r"blatt(\d+).pdf", path.name)
|
||||
if match:
|
||||
new_path = PFERD.move(path, (), ("Blätter",))
|
||||
number = int(match.group(1))
|
||||
return PFERD.rename(new_path, f"blatt_{number:02}.pdf")
|
||||
|
||||
match = re.match(r"blatt(\d+).loesungen.pdf", path.name)
|
||||
if match:
|
||||
new_path = PFERD.move(path, (), ("Blätter",))
|
||||
number = int(match.group(1))
|
||||
return PFERD.rename(new_path, f"loesung_{number:02}.pdf")
|
||||
|
||||
return path
|
||||
|
||||
def la2_filter(path):
|
||||
# Tutorien rausfiltern
|
||||
if path.parts[:1] == ("Tutorien",):
|
||||
if path.parts[1:] == (): return True
|
||||
#if path.parts[1:2] == ("Tutorium 15",): return True
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def la2_transform(path):
|
||||
# Folien in Folien/*
|
||||
new_path = PFERD.move(path, ("Vorlesungsmaterial",), ("Folien",))
|
||||
if new_path is not None: return new_path
|
||||
|
||||
# Alle Übungsblätter in Blätter/blatt_xx.pdf
|
||||
# Alles andere Übungsmaterial in Blätter/*
|
||||
new_path = PFERD.move(path, ("Übungen",), ("Blätter",))
|
||||
if new_path is not None:
|
||||
|
||||
match = re.match(r"Blatt(\d+).pdf", new_path.name)
|
||||
if match:
|
||||
number = int(match.group(1))
|
||||
return PFERD.rename(new_path, f"blatt_{number:02}.pdf")
|
||||
|
||||
return new_path
|
||||
|
||||
return path
|
||||
|
||||
def swt1_filter(path):
|
||||
# Tutorien rausfiltern
|
||||
if path.parts[:1] == ("Tutorien",):
|
||||
if path.parts[1:] == (): return True
|
||||
#if path.parts[1:2] == ("Tutorium 15",): return True
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def swt1_transform(path):
|
||||
# Folien in Folien/*
|
||||
new_path = PFERD.move(path, ("Vorlesungsmaterial",), ("Folien",))
|
||||
if new_path is not None: return new_path
|
||||
|
||||
# Übungsblätter in Blätter/*
|
||||
new_path = PFERD.move(path, ("Übungen",), ("Blätter",))
|
||||
if new_path is not None: return new_path
|
||||
|
||||
return path
|
||||
|
||||
async def main(args):
|
||||
args = [arg.lower() for arg in args]
|
||||
|
||||
@ -203,16 +296,29 @@ async def main(args):
|
||||
ilias = PFERD.ILIAS(base_dir, "cookie_jar")
|
||||
norbert = PFERD.Norbert(base_dir)
|
||||
|
||||
if not args or "gbi" in args:
|
||||
await ilias.synchronize("855240", "GBI", transform=gbi_transform, filter=gbi_filter)
|
||||
if not args or "hm1" in args:
|
||||
await ffm.synchronize("iana2/lehre/hm1info2018w", "HM1", transform=hm1_transform)
|
||||
if not args or "la1" in args:
|
||||
await ilias.synchronize("874938", "LA1", transform=la1_transform, filter=la1_filter)
|
||||
if not args or "prog" in args:
|
||||
await ilias.synchronize("851237", "Prog", transform=prog_transform, filter=prog_filter)
|
||||
if not args or "norbert" in args:
|
||||
await norbert.synchronize("Prog-Tut")
|
||||
# Semester 1
|
||||
|
||||
# if not args or "gbi" in args:
|
||||
# await ilias.synchronize("855240", "GBI", transform=gbi_transform, filter=gbi_filter)
|
||||
# if not args or "hm1" in args:
|
||||
# await ffm.synchronize("iana2/lehre/hm1info2018w", "HM1", transform=hm1_transform)
|
||||
# if not args or "la1" in args:
|
||||
# await ilias.synchronize("874938", "LA1", transform=la1_transform, filter=la1_filter)
|
||||
# if not args or "prog" in args:
|
||||
# await ilias.synchronize("851237", "Prog", transform=prog_transform, filter=prog_filter)
|
||||
# if not args or "norbert" in args:
|
||||
# await norbert.synchronize("Prog-Tut")
|
||||
|
||||
# Semester 2
|
||||
|
||||
if not args or "algo1" in args:
|
||||
await ilias.synchronize("959260", "Algo1", transform=algo1_transform, filter=algo1_filter)
|
||||
if not args or "hm2" in args:
|
||||
await ffm.synchronize("iana2/lehre/hm2info2019s", "HM2", transform=hm2_transform)
|
||||
if not args or "la2" in args:
|
||||
await ilias.synchronize("950588", "LA2", transform=la2_transform, filter=la2_filter)
|
||||
if not args or "swt1" in args:
|
||||
await ilias.synchronize("945596", "SWT1", transform=swt1_transform, filter=swt1_filter)
|
||||
|
||||
await ffm.close()
|
||||
await ilias.close()
|
||||
|
Loading…
Reference in New Issue
Block a user