diff --git a/spa/audio.py b/spa/audio.py index 4cafad7..116e000 100644 --- a/spa/audio.py +++ b/spa/audio.py @@ -30,9 +30,8 @@ def download(request, mix_id): if mix is not None: if mix.download_allowed: mix.add_download(request.user) - 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)) + filename = "%s/mixes/%s.mp3" % (here(settings.MEDIA_ROOT), mix.uid) + response = sendfile(request, filename, attachment=True, attachment_filename="Deep South Sounds - %s.mp3" % mix.title) return response except Exception, ex: print ex diff --git a/static/js/app/views/mix/mixItemView.coffee b/static/js/app/views/mix/mixItemView.coffee index 811804a..ecd9a4a 100644 --- a/static/js/app/views/mix/mixItemView.coffee +++ b/static/js/app/views/mix/mixItemView.coffee @@ -119,9 +119,9 @@ define ['moment', 'app', 'vent', 'marionette', 'utils', 'models/comment/commentC true mixDownload: -> + console.log("MixItemView: mixDownload") utils.downloadURL("/audio/download/" + @model.get('id')) true - return false; MixItemView diff --git a/static/js/app/views/mix/mixItemView.js b/static/js/app/views/mix/mixItemView.js index ae8c97a..ac9d98c 100644 --- a/static/js/app/views/mix/mixItemView.js +++ b/static/js/app/views/mix/mixItemView.js @@ -156,7 +156,11 @@ return true; }; - MixItemView.prototype.mixDownload = function() {}; + MixItemView.prototype.mixDownload = function() { + console.log("MixItemView: mixDownload"); + utils.downloadURL("/audio/download/" + this.model.get('id')); + return true; + }; return MixItemView;