modified: app.py
This commit is contained in:
4
app.py
4
app.py
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user