modified: app.py

This commit is contained in:
Simon
2025-05-17 08:58:22 +02:00
parent 98fecf3776
commit 54e6a4d192

4
app.py
View File

@@ -29,7 +29,7 @@ def similarity(a, b):
return SequenceMatcher(None, a.lower(), b.lower()).ratio() return SequenceMatcher(None, a.lower(), b.lower()).ratio()
def clean_title(title): def clean_title(title):
# Entfernt (feat. ...), [Remix ...], (Remix), [xyz], usw. # Entfernt alles in () oder []
return re.sub(r"(\s*[\(\[][^)\]]*[\)\]])", "", title).strip() return re.sub(r"(\s*[\(\[][^)\]]*[\)\]])", "", title).strip()
@app.route("/") @app.route("/")
@@ -159,7 +159,7 @@ def check_answer():
correct_answer = data.get('correct_answer', '').lower() correct_answer = data.get('correct_answer', '').lower()
game_mode = data.get('game_mode', 'artist') game_mode = data.get('game_mode', 'artist')
# Titel ggf. bereinigen # Beim Titelmodus Klammerzusätze entfernen
if game_mode == 'title': if game_mode == 'title':
guess = clean_title(guess) guess = clean_title(guess)
correct_answer = clean_title(correct_answer) correct_answer = clean_title(correct_answer)