def related_media_collection_stream(self, request, public_id, media_id):
collection = MediaCollection.objects.get(public_id=public_id)
media = MediaCollectionRelated.objects.get(collection=collection, id=media_id)
- response = HttpResponse(stream_from_file(media.file.path), mimetype=media.mime_type)
+ response = StreamingHttpResponse(stream_from_file(media.file.path), mimetype=media.mime_type)
# response['Content-Disposition'] = 'attachment'
return response
collection = MediaCollection.objects.get(public_id=public_id)
media = MediaCollectionRelated.objects.get(collection=collection, id=media_id)
filename = media.file.path.split(os.sep)[-1]
- response = HttpResponse(stream_from_file(media.file.path), mimetype=media.mime_type)
+ response = StreamingHttpResponse(stream_from_file(media.file.path), mimetype=media.mime_type)
response['Content-Disposition'] = 'attachment; ' + 'filename=' + filename
return response
path = cache_data.dir + os.sep + filename
z.write(path, arcname=collection.public_id + os.sep + filename)
- try:
- from django.http import StreamingHttpResponse
- response = StreamingHttpResponse(z, content_type='application/zip')
- except:
- response = HttpResponse(z, content_type='application/zip')
-
+ response = StreamingHttpResponse(z, content_type='application/zip')
response['Content-Disposition'] = "attachment; filename=%s.%s" % \
(collection.code, 'zip')
return response
item = MediaItem.objects.get(public_id=item_public_id)
media = MediaItemRelated.objects.get(item=item, id=media_id)
filename = media.file.path.split(os.sep)[-1]
- response = HttpResponse(stream_from_file(media.file.path), mimetype=media.mime_type)
+ response = StreamingHttpResponse(stream_from_file(media.file.path), mimetype=media.mime_type)
return response
def related_media_item_download(self, request, item_public_id, media_id):
item = MediaItem.objects.get(public_id=item_public_id)
media = MediaItemRelated.objects.get(item=item, id=media_id)
filename = media.file.path.split(os.sep)[-1]
- response = HttpResponse(stream_from_file(media.file.path), mimetype=media.mime_type)
+ response = StreamingHttpResponse(stream_from_file(media.file.path), mimetype=media.mime_type)
response['Content-Disposition'] = 'attachment; ' + 'filename=' + filename
return response
graph.render(output=path)
f.close()
- response = HttpResponse(self.cache_data.read_stream_bin(image_file), mimetype=mime_type)
+ response = StreamingHttpResponse(self.cache_data.read_stream_bin(image_file), mimetype=mime_type)
return response
def list_export_extensions(self):
if 'mp4' in extension:
mime_type = 'video/mp4'
video = item.file.path
- response = HttpResponse(stream_from_file(video), mimetype = mime_type)
+ response = StreamingHttpResponse(stream_from_file(video), mimetype = mime_type)
response['Content-Disposition'] = 'attachment'
return response
if 'webm' in extension:
mime_type = 'video/webm'
video = item.file.path
- response = HttpResponse(stream_from_file(video), mimetype = mime_type)
+ response = StreamingHttpResponse(stream_from_file(video), mimetype = mime_type)
response['Content-Disposition'] = 'attachment'
return response
proc.write_metadata()
except:
pass
- response = HttpResponse(stream_from_file(source), mimetype = mime_type)
+ response = StreamingHttpResponse(stream_from_file(source), mimetype = mime_type)
else:
media = self.cache_export.dir + os.sep + file
if not self.cache_export.exists(file) or not flag.value:
self.setup(type)
resource = self.model.objects.get(code=public_id)
media = self.related.objects.get(resource=resource, id=media_id)
- response = HttpResponse(stream_from_file(media.file.path), mimetype=media.mime_type)
+ response = StreamingHttpResponse(stream_from_file(media.file.path), mimetype=media.mime_type)
return response
def related_download(self, request, type, public_id, media_id):
resource = self.model.objects.get(code=public_id)
media = self.related.objects.get(resource=resource, id=media_id)
filename = media.file.path.split(os.sep)[-1]
- response = HttpResponse(stream_from_file(media.file.path), mimetype=media.mime_type)
+ response = StreamingHttpResponse(stream_from_file(media.file.path), mimetype=media.mime_type)
response['Content-Disposition'] = 'attachment; ' + 'filename=' + filename
return response