Added support for official abbreviations

This commit is contained in:
Jim Martens 2020-01-09 18:30:34 +01:00
parent 9e2dc083c6
commit 429ecf6ee0
2 changed files with 33 additions and 0 deletions

View File

@ -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"
}
}

View File

@ -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