move category to config

This commit is contained in:
lelo 2025-06-29 08:07:11 +00:00
parent ddfa0f920b
commit cb906fb82b

View File

@ -8,6 +8,7 @@ import auth
app_config = auth.return_app_config() app_config = auth.return_app_config()
BASE_DIR = os.path.realpath(app_config['BASE_DIR']) BASE_DIR = os.path.realpath(app_config['BASE_DIR'])
CATEGORY_KEYWORDS = os.path.realpath(app_config['CATEGORY_KEYWORDS'])
log_db = sqlite3.connect("access_log.db", check_same_thread=False) log_db = sqlite3.connect("access_log.db", check_same_thread=False)
@ -88,21 +89,6 @@ def extract_structure_from_string(input_string):
# first part not a number # first part not a number
pass pass
# define your mapping: category → list of trigger-words
CATEGORY_KEYWORDS = {
'Predigt': ['predig', 'thema'],
'Vorwort': ['wort', 'einladung', 'begrüßung', 'ansprache', 'einleitung', 'aufruf zum', 'zuruf zum'],
'Kinderchor': ['kinderchor'],
'Jugendchor': ['jugendchor'],
'Orchester': ['orchester', 'sinfonie', 'symphonie'],
'Chor': ['chor'],
'Gemeinsamer Gesang': ['gemeinsam', 'gemeindelied', 'gemeinsamer gesang'],
'Gruppenlied': ['gruppenlied', 'jugend', 'lied', 'musikgruppe'],
'Gedicht': ['gedicht'],
'Erzählung': ['vortrag', 'erzä', 'program'],
'Instrumental': ['instrumental', 'musikstück', 'harfenstück'],
}
# walk the dict in your desired priority order # walk the dict in your desired priority order
category = None category = None
text = left_side.lower() text = left_side.lower()