From 429ecf6ee0fdecc95e4ff895166db42d44ce9c95 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Thu, 9 Jan 2020 18:30:34 +0100 Subject: [PATCH] Added support for official abbreviations --- src/twomartens/allrisscraper/definitions.py | 26 +++++++++++++++++++++ src/twomartens/allrisscraper/main.py | 7 ++++++ 2 files changed, 33 insertions(+) create mode 100644 src/twomartens/allrisscraper/definitions.py diff --git a/src/twomartens/allrisscraper/definitions.py b/src/twomartens/allrisscraper/definitions.py new file mode 100644 index 0000000..6702f24 --- /dev/null +++ b/src/twomartens/allrisscraper/definitions.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Jim Martens +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +ABBREVIATIONS = { + "Eimsbüttel": { + "RaLNS": "RaLoNiS", + "HKS": "HaKuSp", + "GNUVWD": "GNUVWDi", + "AS": "StaPla", + "AU": "Uni" + } +} diff --git a/src/twomartens/allrisscraper/main.py b/src/twomartens/allrisscraper/main.py index eccc35f..5266510 100644 --- a/src/twomartens/allrisscraper/main.py +++ b/src/twomartens/allrisscraper/main.py @@ -27,6 +27,7 @@ from selenium.webdriver.firefox import webdriver from selenium.webdriver.firefox.options import Options from twomartens.allrisscraper import meeting +from twomartens.allrisscraper import definitions ALLRIS_LOGIN: str = "https://2martens.de/allris-eimsbüttel" @@ -140,6 +141,7 @@ def get_abbreviated_committee_name(name: str) -> str: start_committee = "Sitzung des Ausschusses" start_regional_committee = "Sitzung des Regionalausschusses" start_plenary = "Sitzung der Bezirksversammlung" + start_youth_help_committee = "Sitzung des Jugendhilfeausschusses" abbreviated_name = "" if start_plenary in name: abbreviated_name = "BV" @@ -153,6 +155,11 @@ def get_abbreviated_committee_name(name: str) -> str: second_part = name[len(start_regional_committee):] second_split = second_part.split(sep="/") abbreviated_name = f"Ra{get_abbreviation(second_split)}" + elif start_youth_help_committee in name: + abbreviated_name = "JHA" + + if abbreviated_name in definitions.ABBREVIATIONS["Eimsbüttel"]: + abbreviated_name = definitions.ABBREVIATIONS["Eimsbüttel"][abbreviated_name] return abbreviated_name