mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 20:52:20 +01:00
Skip song from commandline.
This commit is contained in:
16
marietje/marietje/management/commands/skipsong.py
Normal file
16
marietje/marietje/management/commands/skipsong.py
Normal file
@ -0,0 +1,16 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.shortcuts import get_object_or_404
|
||||
from queues.models import Queue
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Skip a song of a playlist.'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('queue_id')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
queue = get_object_or_404(Queue, id=options['queue_id'])
|
||||
player_song = queue.current_song()
|
||||
player_song.state = 2
|
||||
player_song.save()
|
||||
Reference in New Issue
Block a user