Esempio n. 1
0
def delete_video(request):
    src = request.POST.get('src', '')
    try:
      Video.delete(src)
      return HttpResponse('ok', content_type="application/json")
    except:
      raise Exception('Could not delete video')
def delete_video():
    src = request.form.get('src')
    try:
      Video.delete(src)
      return json.dumps('ok')
    except:
      raise Exception('Could not delete video')
def delete_video(request):
    src = request.POST.get('src')
    try:
        Video.delete(src)
        return Response(json.dumps('ok'))
    except:
        raise Exception('Could not delete video')
Esempio n. 4
0
def upload_video(request):
    options = {
        'validation': None
    }
    try:
        response = Video.upload(DjangoAdapter(request), '/public/', options)
    except Exception:
        response = {'error': str(sys.exc_info()[1])}
    return HttpResponse(json.dumps(response), content_type="application/json")
def upload_video_validation(request):
    def validation(filePath, mimetype):
        size = os.path.getsize(filePath)
        if size > 50 * 1024 * 1024:
            return False
        return True

    options = {'fieldname': 'myFile', 'validation': validation}
    try:
        response = Video.upload(PyramidAdapter(request), '/public/', options)
    except Exception:
        response = {'error': str(sys.exc_info()[1])}
    return Response(json.dumps(response))
def upload_video():
    try:
        response = Video.upload(FlaskAdapter(request), '/public/')
    except Exception:
        response = {'error': str(sys.exc_info()[1])}
    return json.dumps(response)