mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 10:32:22 +01:00
Volume control from the web interface.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from django.contrib import admin
|
||||
from .models import Queue, Playlist, PlaylistSong
|
||||
from .models import Queue, Playlist, PlaylistSong, QueueCommand
|
||||
|
||||
|
||||
admin.site.register(Playlist)
|
||||
@ -9,3 +9,6 @@ admin.site.register(PlaylistSong)
|
||||
@admin.register(Queue)
|
||||
class OrderAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'playlist', 'random_playlist')
|
||||
|
||||
|
||||
admin.site.register(QueueCommand)
|
||||
|
||||
19
marietje/queues/migrations/0002_auto_20170130_1348.py
Normal file
19
marietje/queues/migrations/0002_auto_20170130_1348.py
Normal file
@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-01-30 13:48
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('queues', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='queue',
|
||||
options={'permissions': (('can_skip', 'Can skip the currently playing song'), ('can_move', 'Can move all songs in the queue'), ('can_cancel', 'Can cancel all songs in the queue'), ('can_control_volume', 'Can control the volume of Marietje'))},
|
||||
),
|
||||
]
|
||||
25
marietje/queues/migrations/0003_queuecommand.py
Normal file
25
marietje/queues/migrations/0003_queuecommand.py
Normal file
@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-01-30 14:56
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('queues', '0002_auto_20170130_1348'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='QueueCommand',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('command', models.TextField()),
|
||||
('executed', models.BooleanField(default=False)),
|
||||
('queue', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='queues.Queue')),
|
||||
],
|
||||
),
|
||||
]
|
||||
@ -63,6 +63,7 @@ class Queue(models.Model):
|
||||
('can_skip', 'Can skip the currently playing song'),
|
||||
('can_move', 'Can move all songs in the queue'),
|
||||
('can_cancel', 'Can cancel all songs in the queue'),
|
||||
('can_control_volume', 'Can control the volume of Marietje'),
|
||||
)
|
||||
|
||||
name = models.TextField()
|
||||
@ -138,5 +139,10 @@ class Queue(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
|
||||
|
||||
class QueueCommand(models.Model):
|
||||
queue = models.ForeignKey(
|
||||
Queue,
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
command = models.TextField()
|
||||
executed = models.BooleanField(default=False)
|
||||
|
||||
@ -65,7 +65,9 @@
|
||||
<td class="title"></td>
|
||||
<td class="requestedby"></td>
|
||||
<td class="timeleft"></td>
|
||||
<td><a id="skip" href="#"></a></td>
|
||||
<td>
|
||||
<a id="skip" href="#"></a>{% if perms.queues.can_control_volume %} <a id="volume-down" class="glyphicon glyphicon-volume-down" href="#"></a> <a id="volume-up" class="glyphicon glyphicon-volume-up" href="#"></a>{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user