Compare commits
No commits in common. "main" and "v0.4.0" have entirely different histories.
29 changed files with 170 additions and 338 deletions
|
@ -25,7 +25,7 @@ i.owner, .gold {
|
|||
display: none;
|
||||
}
|
||||
|
||||
a.group, a.running {
|
||||
a.group {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,11 @@ article.message {
|
|||
}
|
||||
|
||||
#hero {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: radial-gradient(
|
||||
circle 50vh at calc(100vw - 4rem) 50%,
|
||||
var(--pico-primary-background),
|
||||
|
@ -85,41 +90,19 @@ article.message {
|
|||
color-mix(in hsl, var(--pico-primary-background) 30%, var(--pico-background-color)) 60%,
|
||||
color-mix(in hsl, var(--pico-primary-background) 10%, var(--pico-background-color)) 80%,
|
||||
var(--pico-background-color));
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
display: grid;
|
||||
grid-template-rows: 1fr min-content;
|
||||
align-items: center;
|
||||
padding: 4rem;
|
||||
|
||||
main {
|
||||
display: contents;
|
||||
.big-logo {
|
||||
font-size: 8rem;
|
||||
}
|
||||
section {
|
||||
max-width: 20rem;
|
||||
|
||||
h1 {
|
||||
font-size: 4rem;
|
||||
}
|
||||
}
|
||||
.full-page {
|
||||
height: 100%;
|
||||
display: grid;
|
||||
grid-template-rows: 1fr;
|
||||
align-items: center;
|
||||
margin-bottom: 4rem;
|
||||
|
||||
&.r {
|
||||
-ms-grid-column-align: end;
|
||||
}
|
||||
.big-logo {
|
||||
font-size: 8rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 4rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
h1,
|
||||
h2,
|
||||
|
@ -196,29 +179,9 @@ table select {
|
|||
color: var(--pico-color-red-500);}
|
||||
}
|
||||
|
||||
table.results, table.musics {
|
||||
table.results {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sc i {
|
||||
margin-right: .5em;
|
||||
}
|
||||
|
||||
@media (width < 576px) {
|
||||
[role="group"] {
|
||||
display: grid;
|
||||
& > :first-child {
|
||||
border-radius: var(--pico-border-radius) var(--pico-border-radius) 0 0 !important;
|
||||
}
|
||||
& > :not(:first-child) {
|
||||
margin-left: 0 !important;
|
||||
margin-top: calc(var(--pico-border-width) * -1);
|
||||
}
|
||||
& > :last-child {
|
||||
border-radius: 0 0 var(--pico-border-radius) var(--pico-border-radius) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.brand-name {
|
||||
color: var(--pico-primary);
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="256" height="256" version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<linearGradient id="Gradient" x1="0" x2="0" y1="0" y2="1">
|
||||
<stop offset="0%" style="stop-color:#AA40BF;stop-opacity:1" />
|
||||
<stop offset="100%" style="stop-color:#AA40BF;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<filter id="alpha-to-white">
|
||||
<feColorMatrix in="SourceGraphic" type="matrix"
|
||||
values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
|
||||
</filter>
|
||||
<g id="child-svg"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" height="16px" width="16px"><path d="M18.7134 8.12811L18.4668 8.69379C18.2864 9.10792 17.7136 9.10792 17.5331 8.69379L17.2866 8.12811C16.8471 7.11947 16.0555 6.31641 15.0677 5.87708L14.308 5.53922C13.8973 5.35653 13.8973 4.75881 14.308 4.57612L15.0252 4.25714C16.0384 3.80651 16.8442 2.97373 17.2761 1.93083L17.5293 1.31953C17.7058 0.893489 18.2942 0.893489 18.4706 1.31953L18.7238 1.93083C19.1558 2.97373 19.9616 3.80651 20.9748 4.25714L21.6919 4.57612C22.1027 4.75881 22.1027 5.35653 21.6919 5.53922L20.9323 5.87708C19.9445 6.31641 19.1529 7.11947 18.7134 8.12811ZM7 3H12V6H9V17C9 19.2091 7.20914 21 5 21C2.79086 21 1 19.2091 1 17C1 14.7909 2.79086 13 5 13C5.72857 13 6.41165 13.1948 7 13.5351V3ZM18 13.5351V11H20V17C20 19.2091 18.2091 21 16 21C13.7909 21 12 19.2091 12 17C12 14.7909 13.7909 13 16 13C16.7286 13 17.4117 13.1948 18 13.5351Z" /></svg></g>
|
||||
</defs>
|
||||
<rect
|
||||
width="256"
|
||||
height="256"
|
||||
fill="url(#Gradient)"
|
||||
ry="128"
|
||||
x="0"
|
||||
y="0" />
|
||||
<use xlink:href="#child-svg" filter="url(#alpha-to-white)"
|
||||
transform="matrix(8,0,0,8,64,64)" />
|
||||
</svg>
|
Before Width: | Height: | Size: 1.7 KiB |
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"name": "MyWebSite",
|
||||
"short_name": "MySite",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/web-app-manifest-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "/web-app-manifest-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
],
|
||||
"theme_color": "#aa40bf",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 47 KiB |
|
@ -1,24 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% load form %}
|
||||
{% block content %}
|
||||
<h1>Créer mon compte</h1>
|
||||
{% for error in form.non_field_errors %}<article class="message error">{{ error }}</article>{% endfor %}
|
||||
<form method="post" {% if action %}action="{% url action %}"{% endif %}>
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for field in form %}
|
||||
<label for="{{ field.id_for_label }}">
|
||||
{{ field.label }}
|
||||
{{ field }}
|
||||
{% if field.errors %}
|
||||
<small id="{{ field.errors.field_id }}_error" class="form-error">{{ field.errors|join:", " }}</small>
|
||||
{% endif %}
|
||||
</label>
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
<button type="submit">Créer mon compte</button>
|
||||
<fieldset>
|
||||
<a href="{% url "login" %}" role="button" class="secondary">J'ai déjà un compte</a>
|
||||
</fieldset>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
<h1>Créer un compte</h1>
|
||||
{% form form submit="Créer mon compte" %}
|
||||
{% endblock content %}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
Musik
|
||||
{% endblock title %}
|
||||
</title>
|
||||
{% include "favicon.html" %}
|
||||
<link rel="icon" href="{% static "logo.svg" %}">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Exo:ital,wght@0,100..900;1,100..900&display=swap"
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
{% load static %}
|
||||
<meta name="theme-color" content="#aa40bf">
|
||||
<link rel="icon" type="image/png" href="{% static "favicon/favicon-96x96.png" %}" sizes="96x96">
|
||||
<link rel="icon" type="image/svg+xml" href="{% static "favicon/favicon.svg" %}">
|
||||
<link rel="shortcut icon" href="{% static "favicon/favicon.ico" %}">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{% static "favicon/apple-touch-icon.png" %}">
|
||||
<meta name="apple-mobile-web-app-title" content="Musik">
|
||||
<link rel="manifest" href="{% static "favicon/site.webmanifest" %}">
|
|
@ -1 +1 @@
|
|||
Musik {{ VERSION }} – © <a href="https://code.edgarpierre.fr/edpibu/musik">Edgar P. Burkhart</a> – <a href="{% url "legal" %}">Mentions légales et confidentialité</a>
|
||||
Musik {{ VERSION }} – © <a href="https://code.edgarpierre.fr/edpibu/musik">Edgar P. Burkhart</a> – <a href="{% url "legal" %}">Mentions légales</a>
|
||||
|
|
|
@ -1,25 +1,11 @@
|
|||
{% load static %}
|
||||
<div id="hero">
|
||||
<main>
|
||||
<div class="full-page">
|
||||
<div>
|
||||
<i class="ri-music-ai-fill big-logo"></i>
|
||||
<h1>Musik</h1>
|
||||
<p>
|
||||
<a href="{% url "home" %}" role="button"><i class="ri-play-fill"></i> Jouer</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="full-page r">
|
||||
<section>
|
||||
<h2>
|
||||
<span class="brand-name"><i class="ri-music-ai-fill"></i> Musik</span> Le jeu où ta playlist devient ton arme secrète !
|
||||
</h2>
|
||||
<p>
|
||||
Invite ta bande, ajoute tes sons fétiches, et c’est parti ! Une playlist Youtube apparaît, mélangeant les coups de cœur de tout le monde. Le jeu ? Écoute, devine qui a choisi quoi, et découvre les secrets musicaux de tes potes. Entre pièges, révélations et fous rires, Musik c’est le jeu parfait pour tester vos oreilles… et vos amitiés. Prêt à jouer le DJ incognito ?
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
<i class="ri-music-ai-fill big-logo"></i>
|
||||
<h1>Musik</h1>
|
||||
<p>
|
||||
<a href="{% url "home" %}" role="button"><i class="ri-play-fill"></i> Jouer</a>
|
||||
</p>
|
||||
</main>
|
||||
<footer>
|
||||
{% include "footer.html" %}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
Youtube est une marque de Google LLC.
|
||||
</p>
|
||||
<p>
|
||||
Les données saisies dans Musik (groupes créés, listes de musiques) sont conservées jusqu'à demande de suppression. La suppression du compte entraîne la suppression de l'ensemble des données qui y sont liées.
|
||||
La suppression du compte peut être demandée dans les paramètres du compte. La suppression des données est immédiate et définitive.
|
||||
La suppression des données stockée par le service Musik pour son utilisation peut être demandée par email à <a href="mailto:contact@edgarpierre.fr">Edgar P. Burkhart</a>.
|
||||
</p>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<form method="post" {% if action %}action="{% url action %}"{% endif %}>
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
{% if field.id_for_label %}
|
||||
<label for="{{ field.id_for_label }}">
|
||||
{{ field.label }}
|
||||
<fieldset>
|
||||
{% if field.id_for_label %}
|
||||
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
|
||||
{% else %}
|
||||
<legend>{{ field.label }}</legend>
|
||||
{% endif %}
|
||||
|
@ -15,16 +15,16 @@
|
|||
{% if field.errors %}
|
||||
<small id="{{ field.errors.field_id }}_error" class="form-error">{{ field.errors|join:", " }}</small>
|
||||
{% endif %}
|
||||
</label>
|
||||
</fieldset>
|
||||
{% endfor %}
|
||||
<button type="submit">Me connecter</button>
|
||||
<fieldset>
|
||||
<p>
|
||||
<a href="{% url "signup" %}" role="button" class="secondary">Créer mon compte</a>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
</p>
|
||||
<p>
|
||||
<a href="{% url "password_reset" %}"
|
||||
role="button"
|
||||
class="outline secondary">J'ai oublié mon mot de passe</a>
|
||||
</fieldset>
|
||||
</p>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -32,12 +32,10 @@ services:
|
|||
rabbitmq:
|
||||
image: rabbitmq
|
||||
container_name: musik_rabbitmq
|
||||
restart: unless-stopped
|
||||
|
||||
postgres:
|
||||
image: postgres:17
|
||||
container_name: musik_postgres
|
||||
restart: unless-stopped
|
||||
env_file: stack.env
|
||||
volumes:
|
||||
- /docker/musik/postgres:/var/lib/postgresql/data
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
# Generated by Django 5.2.3 on 2025-06-15 14:19
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("game", "0022_musicgameorder_value"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name="musicvideo",
|
||||
options={"ordering": ["blacklisted", "-date_added"]},
|
||||
),
|
||||
]
|
|
@ -66,12 +66,6 @@ class MusicVideo(models.Model):
|
|||
fields=("yt_id", "owner", "group"), name="unique_music_in_group"
|
||||
)
|
||||
]
|
||||
ordering = ["blacklisted", "-date_added"]
|
||||
|
||||
|
||||
class GameManager(models.Manager):
|
||||
def playing(self):
|
||||
return self.filter(over=False)
|
||||
|
||||
|
||||
class MusikGame(models.Model):
|
||||
|
@ -83,8 +77,6 @@ class MusikGame(models.Model):
|
|||
playlist_loading = models.BooleanField(default=False)
|
||||
over = models.BooleanField(default=False)
|
||||
|
||||
objects = GameManager()
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("game_detail", kwargs={"pk": self.pk})
|
||||
|
||||
|
@ -99,9 +91,6 @@ def generateYoutubePlaylist(sender, instance, created, **kwargs):
|
|||
|
||||
if creds := instance.group.owner.youtubecredentials:
|
||||
tasks.generate_playlist.delay_on_commit(creds.credentials, instance.pk)
|
||||
else:
|
||||
instance.playlist_loading = False
|
||||
instance.save()
|
||||
|
||||
|
||||
@receiver(post_delete, sender=MusikGame)
|
||||
|
@ -121,10 +110,13 @@ class MusicGameOrder(models.Model):
|
|||
value = models.PositiveIntegerField(default=0)
|
||||
|
||||
def update_value(self):
|
||||
x = self.musicgameanswer_set.filter(game__player=F("answer")).count()
|
||||
n = self.game.players.count()
|
||||
n = max(3, n)
|
||||
self.value = 1000 * 2 ** (-(x - 2) / (n - 2))
|
||||
n_right = self.musicgameanswer_set.filter(game__player=F("answer")).count()
|
||||
if n_right == 0:
|
||||
self.value = 1000
|
||||
else:
|
||||
self.value = 1000 / (
|
||||
1 + ((n_right - 1) / (self.game.players.count() - 1)) ** 0.5
|
||||
)
|
||||
self.save()
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -18,7 +18,7 @@ def generate_playlist(creds, game_pk):
|
|||
"description": "Playlist générée par Musik",
|
||||
},
|
||||
"status": {
|
||||
"privacyStatus": "unlisted",
|
||||
"privacyStatus": "private",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
|
@ -12,5 +12,68 @@
|
|||
{% include "game/include/group_buttons.html" %}
|
||||
{% include "game/include/group_games.html" %}
|
||||
{% include "game/include/group_members.html" %}
|
||||
{% include "game/include/group_musics.html" %}
|
||||
<h2>
|
||||
<i class="ri-music-2-fill"></i> Mes musiques <span class="music-count">{{ musics.count }}</span>
|
||||
</h2>
|
||||
<details>
|
||||
<summary role="button">
|
||||
<i class="ri-music-2-fill"></i> Liste des musiques
|
||||
</summary>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Musique</th>
|
||||
<th>ID</th>
|
||||
<th>
|
||||
<i class="ri-history-fill"></i>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for music in musics %}
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" name="musics" value="{{ music.pk }}">
|
||||
</td>
|
||||
<th>{{ music.title }}</th>
|
||||
<td>
|
||||
<a href="https://youtu.be/{{ music.yt_id }}">{{ music.yt_id }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" disabled {% if music.blacklisted %}checked{% endif %}>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="4">Aucune musique.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if musics %}
|
||||
<fieldset role="group">
|
||||
<button type="submit"
|
||||
formaction="{% url "group_remove_music" pk=group.pk %}"
|
||||
class="secondary">
|
||||
<i class="ri-delete-bin-fill"></i> Supprimer
|
||||
</button>
|
||||
<button type="submit"
|
||||
class="secondary"
|
||||
formaction="{% url "group_unblacklist_music" pk=group.pk %}">
|
||||
<i class="ri-history-fill"></i> Retirer de la blacklist
|
||||
</button>
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
</form>
|
||||
</details>
|
||||
<form method="post" action="{% url "group_add_music" pk=group.pk %}">
|
||||
{% csrf_token %}
|
||||
<fieldset role="group">
|
||||
<input type="string" name="yt_id" id="yt_id" placeholder="Musique" required>
|
||||
<button type="submit">Ajouter</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
{% load form youtube %}
|
||||
{% if group.musikgame_set.exists %}
|
||||
{% for game in group.musikgame_set.playing %}
|
||||
<a class="running" href="{{ game.get_absolute_url }}">
|
||||
<article><i class="ri-play-circle-fill i"></i>{{ game.date }}</article>
|
||||
</a>
|
||||
{% endfor %}
|
||||
<h2>
|
||||
<i class="ri-play-circle-fill"></i> Parties
|
||||
</h2>
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
<h2>
|
||||
<i class="ri-music-2-fill"></i> Mes musiques <span class="music-count">{{ musics.count }}</span>
|
||||
</h2>
|
||||
<details>
|
||||
<summary role="button">
|
||||
<i class="ri-music-2-fill"></i> Liste des musiques
|
||||
</summary>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="overflow-auto">
|
||||
<table class="musics">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Musique</th>
|
||||
<th>ID</th>
|
||||
<th>
|
||||
<i class="ri-history-fill"></i>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for music in musics %}
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" name="musics" value="{{ music.pk }}">
|
||||
</td>
|
||||
<th>{{ music.title }}</th>
|
||||
<td>
|
||||
<a href="https://youtu.be/{{ music.yt_id }}">{{ music.yt_id }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" disabled {% if music.blacklisted %}checked{% endif %}>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="4">Aucune musique.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% if musics %}
|
||||
<fieldset role="group">
|
||||
<button type="submit"
|
||||
formaction="{% url "group_remove_music" pk=group.pk %}"
|
||||
class="secondary">
|
||||
<i class="ri-delete-bin-fill"></i> Supprimer
|
||||
</button>
|
||||
<button type="submit"
|
||||
class="secondary"
|
||||
formaction="{% url "group_unblacklist_music" pk=group.pk %}">
|
||||
<i class="ri-history-fill"></i> Retirer de la blacklist
|
||||
</button>
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
</form>
|
||||
</details>
|
||||
<form method="post" action="{% url "group_add_music" pk=group.pk %}">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
<textarea name="yt_id" id="yt_id" placeholder="Musiques" required></textarea>
|
||||
<button type="submit">Ajouter</button>
|
||||
</fieldset>
|
||||
</form>
|
|
@ -21,6 +21,6 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if not musikgame.over %}<button type="submit">Sauvegarder mes réponses</button>{% endif %}
|
||||
{% if not musikgame.over %}<button type="submit">Valider mes réponses</button>{% endif %}
|
||||
</form>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -9,31 +9,31 @@
|
|||
{% endif %}
|
||||
{{ musikgame.date }}
|
||||
</h1>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset role="group">
|
||||
{% if musikgame.playlist or musikgame.playlist_loading %}
|
||||
{% if musikgame.playlist or musikgame.playlist_loading %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset role="group">
|
||||
<a target="_blank"
|
||||
href="{% yt_playlist musikgame %}"
|
||||
role="button"
|
||||
{% if musikgame.playlist_loading %}aria-busy="true"{% endif %}><i class="ri-youtube-fill"></i> Playlist</a>
|
||||
{% endif %}
|
||||
{% if musikgame.over %}
|
||||
<a href="{% url "game_answer" musikgame.pk %}"
|
||||
role="button"
|
||||
class="secondary"><i class="ri-play-list-2-fill"></i> Mes réponses</a>
|
||||
{% else %}
|
||||
<a href="{% url "game_answer" musikgame.pk %}" role="button"><i class="ri-play-list-2-fill"></i> Répondre</a>
|
||||
{% endif %}
|
||||
</fieldset>
|
||||
{% if is_leader and not musikgame.over %}
|
||||
<fieldset>
|
||||
<button type="submit" formaction="{% url "game_end" musikgame.pk %}">
|
||||
<i class="ri-stop-circle-fill"></i> Finir la partie
|
||||
</button>
|
||||
{% if musikgame.over %}
|
||||
<a href="{% url "game_answer" musikgame.pk %}"
|
||||
role="button"
|
||||
class="secondary"><i class="ri-play-list-2-fill"></i> Mes réponses</a>
|
||||
{% else %}
|
||||
<a href="{% url "game_answer" musikgame.pk %}" role="button"><i class="ri-play-list-2-fill"></i> Répondre</a>
|
||||
{% endif %}
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% if is_leader and not musikgame.over %}
|
||||
<fieldset>
|
||||
<button type="submit" formaction="{% url "game_end" musikgame.pk %}">
|
||||
<i class="ri-stop-circle-fill"></i> Finir la partie
|
||||
</button>
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endif %}
|
||||
<h2>
|
||||
<i class="ri-group-2-fill"></i> Joueurs
|
||||
</h2>
|
||||
|
|
|
@ -5,12 +5,10 @@
|
|||
<i class="ri-group-2-fill"></i> {{ group.name }}
|
||||
</h1>
|
||||
<p>
|
||||
{% if group.owner.youtubecredentials.credentials %}
|
||||
<i class="ri-youtube-fill"></i> Une playlist sera générée automatiquement sur le compte Youtube de <strong>{{ group.owner }}</strong> (<strong>{{ group.owner.youtubecredentials.title }}</strong>).
|
||||
{% elif user == group.owner %}
|
||||
<a href="{% url "youtube_login" %}" role="button"><i class="ri-youtube-fill"></i> Connecter mon compte Youtube</a>
|
||||
{% if not user.youtubecredentials.credentials %}
|
||||
<a href="{% url "youtube_login" %}" role="button"><i class="ri-youtube-fill"></i> Me connecter au compte Youtube</a>
|
||||
{% else %}
|
||||
<small>Aucune playlist Youtube ne sera générée car <strong>{{ group.owner }}</strong> n'a pas lié son compte Youtube.</small>
|
||||
<i class="ri-youtube-fill"></i> Une playlist sera générée automatiquement sur le compte Youtube <strong>{{ user.youtubecredentials.title }}</strong>.
|
||||
{% endif %}
|
||||
</p>
|
||||
{% form form %}
|
||||
|
|
|
@ -104,31 +104,28 @@ class GroupAddMusicView(MemberFilterMixin, SingleObjectMixin, View):
|
|||
|
||||
def post(self, request, pk):
|
||||
group = self.get_object()
|
||||
ids = request.POST.get("yt_id")
|
||||
for yt_id in ids.split():
|
||||
if not yt_id:
|
||||
messages.add_message(request, messages.ERROR, "Aucun identifiant donné")
|
||||
return redirect(group)
|
||||
yt_id = utils.parse_musik(yt_id)
|
||||
yt_id = request.POST.get("yt_id")
|
||||
if not yt_id:
|
||||
messages.add_message(request, messages.ERROR, "Aucun identifiant donné")
|
||||
return redirect(group)
|
||||
yt_id = utils.parse_musik(yt_id)
|
||||
|
||||
title = utils.get_yt_title(yt_id)
|
||||
if not title:
|
||||
messages.add_message(
|
||||
request, messages.ERROR, f"Vidéo Youtube invalide : {yt_id}"
|
||||
)
|
||||
else:
|
||||
try:
|
||||
group.musicvideo_set.create(
|
||||
yt_id=yt_id, title=title, owner=request.user
|
||||
)
|
||||
except IntegrityError:
|
||||
messages.add_message(
|
||||
request, messages.ERROR, f"Vidéo Youtube déjà ajoutée : {yt_id}"
|
||||
)
|
||||
title = utils.get_yt_title(yt_id)
|
||||
if not title:
|
||||
messages.add_message(
|
||||
request, messages.ERROR, f"Vidéo Youtube invalide : {yt_id}"
|
||||
)
|
||||
return redirect(group)
|
||||
try:
|
||||
group.musicvideo_set.create(yt_id=yt_id, title=title, owner=request.user)
|
||||
except IntegrityError:
|
||||
messages.add_message(
|
||||
request, messages.ERROR, f"Vidéo Youtube déjà ajoutée : {yt_id}"
|
||||
)
|
||||
|
||||
messages.add_message(
|
||||
request, messages.SUCCESS, f"Vidéo Youtube ajoutée : {yt_id}"
|
||||
)
|
||||
messages.add_message(
|
||||
request, messages.SUCCESS, f"Vidéo Youtube ajoutée : {yt_id}"
|
||||
)
|
||||
return redirect(group)
|
||||
|
||||
|
||||
|
@ -139,24 +136,19 @@ class GroupAddMemberView(MemberFilterMixin, SingleObjectMixin, View):
|
|||
group = self.get_object()
|
||||
if not group.is_leader(request.user):
|
||||
raise PermissionDenied()
|
||||
usernames = request.POST.get("username")
|
||||
for username in usernames.split():
|
||||
user = User.objects.filter(username=username).first()
|
||||
if not user:
|
||||
messages.add_message(
|
||||
request, messages.ERROR, f"{username} n'existe pas."
|
||||
)
|
||||
elif user == group.owner:
|
||||
messages.add_message(
|
||||
request, messages.WARNING, f"{user} est le propriétaire du groupe."
|
||||
)
|
||||
elif user in group.members.all():
|
||||
messages.add_message(
|
||||
request, messages.WARNING, f"{user} est déjà membre du groupe."
|
||||
)
|
||||
else:
|
||||
group.members.add(user)
|
||||
username = request.POST.get("username")
|
||||
user = User.objects.get(username=username)
|
||||
if user == group.owner:
|
||||
messages.add_message(
|
||||
request, messages.WARNING, f"{user} est le propriétaire du groupe."
|
||||
)
|
||||
return redirect(group)
|
||||
if user in group.members.all():
|
||||
messages.add_message(
|
||||
request, messages.WARNING, f"{user} est déjà membre du groupe."
|
||||
)
|
||||
|
||||
group.members.add(user)
|
||||
return redirect(group)
|
||||
|
||||
|
||||
|
@ -327,12 +319,15 @@ class GameCreateView(LoginRequiredMixin, CreateView):
|
|||
pm_list = list(zip(players, musics))
|
||||
random.shuffle(pm_list)
|
||||
for (player, music), order in zip(pm_list, range(1, len(pm_list) + 1)):
|
||||
music.blacklisted = True
|
||||
music.save()
|
||||
models.MusicGameOrder.objects.create(
|
||||
game=form.instance, player=player, music_video=music, order=order
|
||||
)
|
||||
|
||||
form.instance.playlist_loading = True
|
||||
form.instance.save()
|
||||
if models.YoutubeCredentials.objects.filter(user=self.request.user).exists():
|
||||
form.instance.playlist_loading = True
|
||||
form.instance.save()
|
||||
return res
|
||||
|
||||
|
||||
|
@ -478,9 +473,6 @@ class GameEndView(LoginRequiredMixin, SingleObjectMixin, View):
|
|||
if not game.group.is_leader(request.user):
|
||||
raise PermissionDenied()
|
||||
game.over = True
|
||||
models.MusicVideo.objects.filter(musicgameorder__game=game).update(
|
||||
blacklisted=True
|
||||
)
|
||||
|
||||
for go in game.musicgameorder_set.all():
|
||||
go.update_value()
|
||||
|
|
|
@ -13,7 +13,7 @@ https://docs.djangoproject.com/en/5.2/ref/settings/
|
|||
import os
|
||||
from pathlib import Path
|
||||
|
||||
VERSION = "0.4.4"
|
||||
VERSION = "0.4.0"
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "musik"
|
||||
version = "0.4.4"
|
||||
version = "0.4.0"
|
||||
description = "Le jeu de Musik."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
|
|
2
uv.lock
generated
2
uv.lock
generated
|
@ -423,7 +423,7 @@ wheels = [
|
|||
|
||||
[[package]]
|
||||
name = "musik"
|
||||
version = "0.4.4"
|
||||
version = "0.4.0"
|
||||
source = { virtual = "." }
|
||||
dependencies = [
|
||||
{ name = "celery" },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue