fix all pylint complaints

This commit is contained in:
Daan Sprenkels
2019-01-21 22:26:43 +01:00
parent 2c41e85753
commit 19c1c70cd3
28 changed files with 85 additions and 119 deletions

View File

@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.

View File

@ -1,3 +0,0 @@
from django.db import models
# Create your models here.

View File

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View File

@ -14,16 +14,16 @@ from .decorators import token_required
@csrf_exempt
@token_required
def queue(request):
queue = get_object_or_404(Queue, id=request.POST.get('queue'))
current_queue = get_object_or_404(Queue, id=request.POST.get('queue'))
commands = queue.queuecommand_set.filter(executed=False)
commands = current_queue.queuecommand_set.filter(executed=False)
for command in commands:
command.executed = True
command.save()
return JsonResponse({
'current_song': playlist_song_to_dict(queue.current_song(), hash=True, replaygain=True),
'queue': [playlist_song_to_dict(playlist_song, hash=True, replaygain=True) for playlist_song in queue.queue()[:1]],
'current_song': playlist_song_to_dict(current_queue.current_song(), include_hash=True, include_replaygain=True),
'queue': [playlist_song_to_dict(playlist_song, include_hash=True, include_replaygain=True) for playlist_song in current_queue.queue()[:1]],
'commands': [command.command for command in commands]
})
@ -31,9 +31,9 @@ def queue(request):
@csrf_exempt
@token_required
def play(request):
queue = get_object_or_404(Queue, id=request.POST.get('queue'))
queue.started_at = timezone.now()
queue.save()
current_queue = get_object_or_404(Queue, id=request.POST.get('queue'))
current_queue.started_at = timezone.now()
current_queue.save()
current_song = queue.current_song()
current_song.played_at = queue.started_at
current_song.save()
@ -41,11 +41,12 @@ def play(request):
return JsonResponse({})
# pylint: disable=redefined-builtin
@csrf_exempt
@token_required
def next(request):
queue = get_object_or_404(Queue, id=request.POST.get('queue'))
player_song = queue.current_song()
current_queue = get_object_or_404(Queue, id=request.POST.get('queue'))
player_song = current_queue.current_song()
player_song.state = 2
player_song.save()
return JsonResponse({})