mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 22:12:22 +01:00
Clean up unnecessary imports.
Retrieve first queue from a function.
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import socket, struct, binascii
|
||||
from django.conf import settings
|
||||
from queues.models import Queue, Playlist
|
||||
|
||||
|
||||
def song_to_dict(song, hash=False, user=False):
|
||||
@ -38,3 +39,15 @@ def send_to_bertha(file):
|
||||
hash = binascii.hexlify(sock.recv(64))
|
||||
sock.close()
|
||||
return hash
|
||||
|
||||
|
||||
def get_first_queue():
|
||||
queue = Queue.objects.first()
|
||||
if queue is None:
|
||||
playlist = Playlist()
|
||||
playlist.save()
|
||||
random_playlist = Playlist()
|
||||
random_playlist.save()
|
||||
queue = Queue(name='Queue', playlist=playlist, random_playlist=random_playlist)
|
||||
queue.save()
|
||||
return queue
|
||||
|
||||
Reference in New Issue
Block a user