diff --git a/manage.py b/manage.py old mode 100644 new mode 100755 diff --git a/spa/audio.py b/spa/audio.py index 03125d6..082a3b6 100644 --- a/spa/audio.py +++ b/spa/audio.py @@ -10,9 +10,23 @@ class AudioHandler(object): def urls(self): pattern_list = [ url(r'^stream/(?P\d+)/$', 'spa.audio.start_streaming', name='audio_start_streaming'), + url(r'^download/(?P\d+)/$', 'spa.audio.download', name='audio_download'), ] return pattern_list +def download(request, mix_id): + try: + mix = Mix.objects.get(pk=mix_id) + if mix is not None: + filename = mix.local_file.path # Select your file here. + file, ext = os.path.splitext(filename) + response = sendfile(request, filename, attachment=True, attachment_filename="%s.%s" % (mix.title, ext)) + return response + except Exception, ex: + print ex + + raise Http404("Mix not found") + def start_streaming(request, mix_id): try: mix = Mix.objects.get(pk=mix_id) diff --git a/static/js/libs/ape/apeClientJS.js b/static/js/libs/ape/apeClientJS.js old mode 100644 new mode 100755 diff --git a/static/js/libs/ape/apeClientMoo.js b/static/js/libs/ape/apeClientMoo.js old mode 100644 new mode 100755 diff --git a/static/js/libs/ape/apeCore.js b/static/js/libs/ape/apeCore.js old mode 100644 new mode 100755 diff --git a/static/js/libs/ape/apeCoreSession.js b/static/js/libs/ape/apeCoreSession.js old mode 100644 new mode 100755