diff --git a/_working/create b/_working/create old mode 100755 new mode 100644 diff --git a/dss/settings.py b/dss/settings.py index 1edcacb..d317930 100644 --- a/dss/settings.py +++ b/dss/settings.py @@ -215,4 +215,8 @@ PIPELINE_CSS = { }, } INTERNAL_IPS = ('127.0.0.1',) -GOOGLE_ANALYTICS_CODE = localsettings.GOOGLE_ANALYTICS_CODE \ No newline at end of file +GOOGLE_ANALYTICS_CODE = localsettings.GOOGLE_ANALYTICS_CODE + +SENDFILE_BACKEND = localsettings.SENDFILE_BACKEND +SENDFILE_ROOT = os.path.join(MEDIA_ROOT, 'mixes') +SENDFILE_URL = '/mixes' \ No newline at end of file diff --git a/manage.py b/manage.py old mode 100755 new mode 100644 diff --git a/spa/audio.py b/spa/audio.py index 44829f8..cd9b12f 100644 --- a/spa/audio.py +++ b/spa/audio.py @@ -2,13 +2,9 @@ from wsgiref.util import FileWrapper from django.conf.urls import url from django.http import HttpResponse, Http404 import os +from sendfile import sendfile from spa.models.Mix import Mix -class FixedFileWrapper(FileWrapper): - def __iter__(self): - self.filelike.seek(0) - return self - class AudioHandler(object): @property def urls(self): @@ -22,13 +18,15 @@ def start_streaming(request, mix_id): mix = Mix.objects.get(pk=mix_id) if mix is not None: filename = mix.local_file.file.name # Select your file here. - wrapper = FixedFileWrapper(open(filename, 'rb')) - response = HttpResponse(wrapper, content_type='audio/mpeg') + response = sendfile(request, filename) + """ + #wrapper = FixedFileWrapper(open(filename, 'rb')) + response = HttpResponse(FileIterWrapper(open(filename)), content_type='audio/mpeg') response['Content-Length'] = os.path.getsize(filename) response['Content-Type'] = "audio/mpeg" - response['Content-Disposition'] = "inline; filename=stream.mp3" - response['Cache-Control'] = "no-cache" response['Content-Transfer-Encoding'] = "binary" + response['Cache-Control'] = "no-cache" + """ return response except Exception, ex: print ex diff --git a/spa/models/Mix.py b/spa/models/Mix.py index c3fd541..6965997 100644 --- a/spa/models/Mix.py +++ b/spa/models/Mix.py @@ -62,6 +62,7 @@ class Mix(_BaseModel): return settings.STATIC_URL + 'img/default-track.png' def get_stream_path(self): + #return 'media/%s/' % self.local_file.name return '/audio/stream/%d' % self.id; @classmethod diff --git a/static/bin/sm/soundmanager2.swf b/static/bin/sm/soundmanager2.swf old mode 100755 new mode 100644 diff --git a/static/bin/sm/soundmanager2_debug.swf b/static/bin/sm/soundmanager2_debug.swf old mode 100755 new mode 100644 diff --git a/static/bin/sm/soundmanager2_flash9.swf b/static/bin/sm/soundmanager2_flash9.swf old mode 100755 new mode 100644 diff --git a/static/bin/sm/soundmanager2_flash9_debug.swf b/static/bin/sm/soundmanager2_flash9_debug.swf old mode 100755 new mode 100644 diff --git a/static/img/whats-on.png b/static/img/whats-on.png old mode 100755 new mode 100644 diff --git a/static/js/libs/sm/soundmanager2.js b/static/js/libs/sm/soundmanager2.js old mode 100755 new mode 100644