aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen_map/gen_map.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gen_map/gen_map.py')
-rwxr-xr-xscripts/gen_map/gen_map.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/gen_map/gen_map.py b/scripts/gen_map/gen_map.py
index 75aa7a48..9660565d 100755
--- a/scripts/gen_map/gen_map.py
+++ b/scripts/gen_map/gen_map.py
@@ -166,10 +166,12 @@ def parse_section_html(section, summary_class: str) -> t.Tuple[str, str, int]:
return num, summary, duration
-def get_lehrplan(subject: str, form: str) -> Lehrplan:
+def get_lehrplan(subject: str, form: str, form_type: str) -> Lehrplan:
"""Retrieve the sections and expected duration from lehrplanplus"""
lpp_url = '/'.join([LPP_BASE_URL, form, subject])
+ if form_type:
+ lpp_url += f'/{form_type}'
resp = requests.get(lpp_url, timeout=10)
html = BeautifulSoup(resp.text)
@@ -292,8 +294,12 @@ def print_map(rows: list[str], template_path: Path, outfile):
def main():
"""Create a rough map template for a certain school year"""
parser = argparse.ArgumentParser()
- parser.add_argument('subject', type=str)
+ parser.add_argument('subject')
parser.add_argument('form', type=int)
+ parser.add_argument(
+ '--form-type',
+ help='type of the form used by LPP',
+ )
parser.add_argument('--template-dir')
parser.add_argument('--year', default=default_year())
parser.add_argument('--land', default=BAYERN)
@@ -307,7 +313,9 @@ def main():
school_holidays[-1].start)
weekly_hours = WEEKLY_HOURS[args.subject][args.form]
- lehrplan = get_lehrplan(args.subject, str(args.form))
+ lehrplan = get_lehrplan(args.subject, str(args.form), args.form_type)
+ if not lehrplan:
+ print('WARNING: empty lehrplan', file=sys.stderr)
rows = gen_latex_table(weekly_hours, lehrplan, school_holidays,
public_holidays, args.inter_section_buffer)