Volume control from the web interface.

This commit is contained in:
Jim Driessen
2017-01-30 16:39:25 +01:00
parent e0ac7cf4ce
commit a5c2331bcf
9 changed files with 97 additions and 6 deletions

View File

@ -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)

View 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'))},
),
]

View 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')),
],
),
]

View File

@ -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)

View File

@ -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 %}&nbsp;&nbsp;&nbsp;&nbsp;<a id="volume-down" class="glyphicon glyphicon-volume-down" href="#"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a id="volume-up" class="glyphicon glyphicon-volume-up" href="#"></a>{% endif %}
</td>
</tr>
</tbody>
</table>