Fixed some db stuff and fuck up

This commit is contained in:
Fergal Moran
2015-10-19 19:10:48 +01:00
parent 25bd272b6d
commit 2013130458
3 changed files with 47 additions and 10 deletions

View File

@@ -80,14 +80,22 @@ class RadioHelper(Helper):
return Response(data=ret, status=HTTP_200_OK)
def post(self, request):
if 'action' in request.query_params:
action = request.query_params.get('action')
if action == 'shuffle':
ice_scrobbler.shuffle()
return Response(status=HTTP_200_OK)
if 'update' in request.query_params and 'url' in request.query_params:
activity.post_activity('site:radio_changed', message={
'description': request.query_params.get('update'),
'url': request.query_params.get('url')
})
try:
if 'action' in request.query_params:
action = request.query_params.get('action')
if action == 'shuffle':
ice_scrobbler.shuffle()
return Response(status=HTTP_200_OK)
if action == 'play':
m = Mix.objects.get(slug=request.query_params.get('slug'))
ice_scrobbler.play(m.get_stream_url())
return Response(status=HTTP_200_OK)
if 'update' in request.query_params and 'url' in request.query_params:
activity.post_activity('site:radio_changed', message={
'description': request.query_params.get('update'),
'url': request.query_params.get('url')
})
except:
pass
return Response(status=HTTP_400_BAD_REQUEST)