def save_audio_file_to_s3(audio_id, file): s3.save_file_to_bucket(localsettings.S3_BUCKET_AUDIO, '%s.flv' % audio_id, open(file), 'public-read', 'video/x-flv') return "S3"
def save_uploaded_video(request, tutorial, form): if not request.FILES: return file = request.FILES['video'] video = file['content'] content_type = file['content-type'] prefix = 'tutorial' if form.cleaned_data["filename_prefix"]: prefix = prefix + '_' + form.cleaned_data["filename_prefix"] filename = "%s_%s.flv" % (prefix, str(now())) f = open(localsettings.INTERNAL_MEDIA_ROOT + filename, 'wb') f.write(video) f.close() s3.save_file_to_bucket(localsettings.S3_BUCKET_STATIC, filename, open(localsettings.INTERNAL_MEDIA_ROOT + filename), 'public-read', content_type) os.remove(localsettings.INTERNAL_MEDIA_ROOT + filename) tutorial.video_path = filename tutorial.save()
def save_video_file_to_s3(task, file): s3.save_file_to_bucket( localsettings.S3_BUCKET_UPLOAD, "%s.wmv" % task.id, open(file), "public-read", "video/x-ms-wmv" ) return "S3"