diff --git a/server/proj/api/views.py b/server/proj/api/views.py index 413478d..47d69fc 100644 --- a/server/proj/api/views.py +++ b/server/proj/api/views.py @@ -8,7 +8,6 @@ from rest_framework.decorators import action from rest_framework.permissions import AllowAny class FetchAndServeFile(ViewSet): - #http://82.97.242.49:10084/api/station/it-radio/file/5196269acd9d54e86297557a6d9a7aab/ def list(self, request): file_url = f"http://82.97.242.49:10084/api/station/it-radio/file/fc6377b2dae75d29358783bc" api_key = "49226d3488aac3f5:18d88659c6c1c5e131a0ce0a94d55235" @@ -21,8 +20,7 @@ class FetchAndServeFile(ViewSet): response = requests.get(file_url, headers=headers) response.raise_for_status() - print(response.content) - # Create a response with the appropriate content type and headers + file_response = HttpResponse(response.content, content_type='audio/mpeg') file_response['Content-Disposition'] = 'attachment; filename="output.mp3"' return file_response diff --git a/server/proj/audio/views.py b/server/proj/audio/views.py index 037e52c..2a517ae 100644 --- a/server/proj/audio/views.py +++ b/server/proj/audio/views.py @@ -49,7 +49,7 @@ class SongViewSet(GenericViewSet): def get_audio(self, request, azura_id): try: song_obj = Song.objects.get(azura_id=azura_id) - file_url = f"http://82.97.242.49:10084/api/station/it-radio/file/{song_obj.azura_id}/play" + file_url = f"http://82.97.242.49:10084/api/station/it-radio/file/{song_obj.unique_id}/play" API_KEY = "49226d3488aac3f5:18d88659c6c1c5e131a0ce0a94d55235" headers = { "Authorization": f"Bearer {API_KEY}"