diff --git a/app.py b/app.py index 9567838..1f8c5e8 100644 --- a/app.py +++ b/app.py @@ -138,6 +138,7 @@ def playlists(): @app.route("/quiz/") def quiz(playlist_id): game_mode = request.args.get('mode', 'artist') + is_multiplayer = request.args.get('local_multiplayer') == '1' sp = get_spotify_client() tracks = get_all_playlist_tracks(sp, playlist_id) @@ -180,8 +181,9 @@ def quiz(playlist_id): all_tracks.append(track_info) user = get_user_from_cookie() + template = "quiz_multiplayer.html" if is_multiplayer else "quiz_single.html" return render_template( - "quiz.html", + template, track=track, access_token=access_token, playlist_id=playlist_id, diff --git a/templates/quiz_base.html b/templates/quiz_base.html new file mode 100644 index 0000000..6a8c545 --- /dev/null +++ b/templates/quiz_base.html @@ -0,0 +1,67 @@ + + + + {{ translations['quiz_title'] }} + + + + {% block extra_head %}{% endblock %} + + +
+ {% block quiz_content %}{% endblock %} +
+ {% block extra_body %}{% endblock %} + + \ No newline at end of file diff --git a/templates/quiz_multiplayer.html b/templates/quiz_multiplayer.html new file mode 100644 index 0000000..37d4f86 --- /dev/null +++ b/templates/quiz_multiplayer.html @@ -0,0 +1,97 @@ +{% extends "quiz_base.html" %} +{% block quiz_content %} + +
+ {{ translations['songs_in_playlist'] }} {{ total_questions }} +
+
+ {{ translations['end_quiz'] }} +
+

{{ translations['question_artist'] }}

+ +
+ + + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ {% if game_mode == 'artist' %} +

{{ translations['tip_artist'] }}

+ {% elif game_mode == 'title' %} +

{{ translations['tip_title'] }}

+ {% elif game_mode == 'year' %} +

{{ translations['tip_year'] }}

+ {% endif %} +
+{% endblock %} +{% block extra_body %} +{% raw %} +{% if request.args.get('local_multiplayer') %} +
+
+

Lokaler Multiplayer

+

Gib bis zu 4 Spielernamen ein:

+
+
+
+
+
+ +
+
+
+ +{% endif %} +{% endraw %} + +{% endblock %} \ No newline at end of file diff --git a/templates/quiz_single.html b/templates/quiz_single.html new file mode 100644 index 0000000..9d2c836 --- /dev/null +++ b/templates/quiz_single.html @@ -0,0 +1,67 @@ +{% extends "quiz_base.html" %} +{% block quiz_content %} +
+ {{ translations['songs_in_playlist'] }} {{ total_questions }} + + {{ translations['score'] }}: {{ score }} / {{ answered if answered > 0 else 1 }} + ({{ ((score / (answered if answered > 0 else 1)) * 100) | round(0) if answered > 0 else 0 }}{{ translations['percent'] }}) + +
+
+ {{ translations['end_quiz'] }} +
+

{{ translations['question_artist'] }}

+ +
+ + + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ {% if game_mode == 'artist' %} +

{{ translations['tip_artist'] }}

+ {% elif game_mode == 'title' %} +

{{ translations['tip_title'] }}

+ {% elif game_mode == 'year' %} +

{{ translations['tip_year'] }}

+ {% endif %} +
+{% endblock %} +{% block extra_body %} + + +{% endblock %} \ No newline at end of file