Esempio n. 1
0
def take_scan():
    # waiting for initialize scannig for good
    time.sleep(3)
    iscanner = ImageScanner()
    scanners = iscanner.list_scanners()
    scanner = scanners[0]
    return scanner.scan().read()
Esempio n. 2
0
def scan(device_id):
    image = ImageScanner(remote_search=False).scan(device_id)
    if image is None:
        return None
    image_data = StringIO()
    image.save(image_data, 'tiff')
    image_data.seek(0) 
    return xmlrpclib.Binary(image_data.read())
Esempio n. 3
0
def scan(device_id):
    image = ImageScanner(remote_search=False).scan(device_id)
    if image is None:
        return None
    image_data = StringIO()
    image.save(image_data, 'tiff')
    image_data.seek(0)
    return xmlrpclib.Binary(image_data.read())
Esempio n. 4
0
                 endpoint='files')
#api.add_resource(HomeAPI, '/', endpoint = 'home')


@app.route("/", defaults={'path': ''})
@app.route('/<path:path>')
def main(path):
    home = path
    parent = path
    if path:
        r = store.getfolder('/' + path)
        while home.rfind('/') > 0:
            home = home[:home.rfind('/')]
        if r["success"] == True:
            if path.rfind('/') > 0:
                parent = path[:path.rfind('/')]
    else:
        r = store.getshares()
    return render_template('index.html',
                           jsonobj=r,
                           parent=parent,
                           current=path,
                           home=home)


if __name__ == '__main__':
    config = ConfigManager()
    store = loadStorage(config)
    iscanner = ImageScanner()
    app.run(host="0.0.0.0", debug=True)
Esempio n. 5
0
def list_scanners():
    devices = ImageScanner(remote_search=False).list_scanners()
    serialized_devices = [scanner_serializer(device) for device in devices]
    return json.dumps(serialized_devices)