Added download url handler

This commit is contained in:
=
2012-09-24 18:50:09 +01:00
parent e7db7f79d9
commit d9a31b6028
6 changed files with 14 additions and 0 deletions

0
manage.py Normal file → Executable file
View File

View File

@@ -10,9 +10,23 @@ class AudioHandler(object):
def urls(self):
pattern_list = [
url(r'^stream/(?P<mix_id>\d+)/$', 'spa.audio.start_streaming', name='audio_start_streaming'),
url(r'^download/(?P<mix_id>\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)

0
static/js/libs/ape/apeClientJS.js Normal file → Executable file
View File

0
static/js/libs/ape/apeClientMoo.js Normal file → Executable file
View File

0
static/js/libs/ape/apeCore.js Normal file → Executable file
View File

0
static/js/libs/ape/apeCoreSession.js Normal file → Executable file
View File