mirror of
https://github.com/fergalmoran/dss.api.git
synced 2025-12-22 09:18:13 +00:00
Fixed post flow
This commit is contained in:
@@ -88,14 +88,19 @@ class RadioHelper(Helper):
|
||||
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())
|
||||
item = {
|
||||
'url': m.get_stream_url(),
|
||||
'slug': m.get_full_url(),
|
||||
'title': str(m)
|
||||
}
|
||||
ice_scrobbler.play(item)
|
||||
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:
|
||||
except Exception as ex:
|
||||
pass
|
||||
|
||||
return Response(status=HTTP_400_BAD_REQUEST)
|
||||
|
||||
@@ -42,13 +42,12 @@ def get_server_details():
|
||||
|
||||
|
||||
def shuffle():
|
||||
url = "http://%s:%s/a/shuffle" % (settings.RADIO_HOST, settings.RADIO_PORT)
|
||||
r = requests.post(url)
|
||||
|
||||
def play(url):
|
||||
url = "http://%s:%s/a/shuffle" % (settings.RADIO_HOST, settings.RADIO_PORT)
|
||||
url = "http://{}:{}/a/shuffle".format(settings.RADIO_HOST, settings.RADIO_PORT)
|
||||
r = requests.post(url)
|
||||
|
||||
def play(item):
|
||||
url = "http://{}:{}/a/play".format(settings.RADIO_HOST, settings.RADIO_PORT)
|
||||
r = requests.post(url, data=item)
|
||||
|
||||
if __name__ == '__main__':
|
||||
d = get_server_details("localhost", "8000", "dss")
|
||||
|
||||
Reference in New Issue
Block a user