Пример #1
0
def pkg_read():
    path = get_file_path(json.loads(request.data)['file'])
    try:
        # Read the file
        content = docker_interface.file_read(session['user_container_name'], path).splitlines(True)
        return jsonify(result=content)
    except:  # catch *all* exceptions
        app.logger.error("Unable to read file. " + str(sys.exc_info()[0]))
        raise PackageError("An internal error occurred.")
Пример #2
0
def pkg_read():
    path = get_file_path(json.loads(request.data)['file'])
    try:
        # Read the file
        content = docker_interface.file_read(session['user_container_name'],
                                             path).splitlines(True)
        return jsonify(result=content)
    except:  # catch *all* exceptions
        app.logger.error("Unable to read file. " + str(sys.exc_info()[0]))
        raise PackageError("An internal error occurred.")
Пример #3
0
def transfer_logged_video(filename):
    # TODO: stream the video
    data = base64.b64encode(file_read(session['user_container_name'],
                                      filename))
    return '<video controls><source type="video/mp4" src="data:video/mp4;base64,{}"></video>'.format(
        urllib.quote(data.rstrip('\n')))
Пример #4
0
def pkg_read():
    path = get_file_path(json.loads(request.data)['file'])
    # Read the file
    content = docker_interface.file_read(session['user_container_name'], path).splitlines(True)
    return jsonify(result=content)
Пример #5
0
def _read_file_from_container(path):
    return docker_interface.file_read(session['user_container_name'],
                                      path).splitlines(True)
Пример #6
0
def transfer_logged_video(filename):
    data = base64.b64encode(file_read(session['user_container_name'], filename))
    return '<a href="data:video/mpeg;base64,{}" download="video.mpg">Download video</a>'.format(urllib.quote(data.rstrip('\n')))
Пример #7
0
def transfer_logged_memory(filename):
    return file_read(session['user_container_name'], filename)
Пример #8
0
def transfer_logged_memory(filename):
    return file_read(session['user_container_name'], filename)
Пример #9
0
def transfer_logged_video(filename):
    data = base64.b64encode(file_read(session['user_container_name'], filename))
    return '<video controls><source type="video/mp4" src="data:video/mp4;base64,{}"></video>'.format(urllib.quote(data.rstrip('\n')))
Пример #10
0
def pkg_read():
    path = get_file_path(json.loads(request.data)['file'])
    # Read the file
    content = docker_interface.file_read(session['user_container_name'],
                                         path).splitlines(True)
    return jsonify(result=content)