Package: eyeflask
EyeFlaskSimpleFlask-based Python3 EyeFi serverDocumentation:eyeflask.readthedocs.orgIntroductionI use an Eye-Fi SD card in my portable scanner. Unfortunately, it used
to upload directly to Evernote, but no longer supports uploading
directly to any service that suits my needs. Additionally, they don’t
provide a Linux version of their server software.EyeFlask is a simple Flask-based Eye-Fi server written for Python >=
3.4. The Eye-Fi card can connect to it and will upload images to the
folder specified in the config. EyeFlask attempts to verify the file
integrity using the same security protocols used by Eye-Fi Server.DependenciesPython >= 3.4Seerequirements.txtQuickstartUsing a virtual env is highly recommended. Since EyeFlask is Python 3.4+
only, there’s no excuse not to use one!python3-mvenv venvon some systems may need to install venv for
Python3.4 (e.g.sudoapt-getinstallpython3.4-venv)venv/bin/pip3 install eyeflaskCopyeyeflask/extras/eyeflask-sample.cfgtoeyeflask.cfg,
modify with your values, and put it inyour instance
folderRun:venv/bin/eyeflaskScan some stuff, see if it ends up in your uploads folderDevelopment SetupClone the repo:git clonehttps://github.com/n8henrie/eyeflask&& cd    eyeflaskMake a virtualenv:python3-mvenv venvMake an instance folder:mkdir-pinstanceCopy the config sample:cpeyeflask/extras/eyeflask-sample.cfginstance/eyeflask.cfgEdit the config to include your upload directory and upload_key (see
below):vim instance/eyeflask.cfgInstall with dev dependencies:venv/bin/pip install .[dev]Run:eyeflask(orvenv/bin/python-meyeflask.cli)Scan some stuff, see if it ends up in your uploads folderConfigurationUPLOAD_KEY: See FAQ, belowUPLOAD_FOLDER: Destination folder for uploads. May optionally be
astrftimestring to specify a subfolder format (e.g.
`/path/to/eyeflask-uploads/%Y/%m-%d/’)ExtrasEyeFlask will help get the images uploaded and extracted to your server
(e.g. a Raspberry Pi in my case), but what do to from there? If you’re
running Raspbian Jessie (and using systemd), I’ve included in theextrasfolder a few files that may be of interested.upload_scans.servicewill run a given script when called (e.g.sudo   systemctl start upload_scans.service)upload_scans.timeris an examplesystemd timer
unitthat will callupload_scans.serviceevery 10 minutesupload_scans.pathis an examplesystemd path
unitthat will callupload_scans.serviceevery time a file changes in
a watched directoryPut together, this makes itreallyeasy to put together a script toupload new scans to a Dropbox
folderwhenever a new one is added, or whatever command you’d like to run on
all your scans.I’ve also includedeyeflask/extras/eyeflask.service, which is a
samplesystemd service
fileto run EyeFlask at startup and restart it on errors.AcknowledgementsMuch of the code for EyeFlask came from or was inspired by the following
projects / links. Many thanks to the authors for their work! If I’ve
forgotten anyone, let me know.https://github.com/tachang/EyeFiServerhttps://github.com/dgrant/eyefiserver2https://code.google.com/archive/p/sceye-fi/wikis/UploadProtocol.wikihttps://launchpad.net/eyefihttps://code.google.com/archive/p/eyefiserver/https://github.com/BrentSouza/WP7EyeFiConnectorTroubleshooting / FAQWhere do I find my upload key?You’ll need a supported platform (OS X or Windows) withEye-FiCenter.appinstalled, and need to have uploaded photos to
that computer at least once. This ensures everything is working, and
generates theSettings.xmlfile, from which you need to copy the
upload key intoeyeflask.cfg.OS X:~/Library/Eye-Fi/Settings.xmlWindows 7:C:\Users\[user]\AppData\Roaming\Eye-Fi\Settings.xml(source)Windows XP:C:\DocumentsandSettings\[user]\ApplicationData\Eye-Fi\Settings.xml(source)Is it okay to be running this with the built-in Flask server?It’s not perfect, but it seems to work okay for me and my single Eye-Fi
card setup. You’d probably be better off running it behindgunicornor a gunicorn / nginx setup, but I’m
running it behind Flask alone for simplicity and because I haven’t had
any issues so far.If you want to give it a go with gunicorn / nginx, I’ve included anextremelysimplified nginx configuration file:eyeflask/extras/nginx.conf. After installinggunicorninto your
virtualenv, hopefully you’ll be able to get it running behind nginx
without much trouble with something like:venv/bin/pip install gunicorn
venv/bin/gunicorn 'eyeflask:create_app("instance/eyeflask.cfg")'For debugging you can also use the flags--log-file=---log-level=debug.NB: I donotplan on providing support for nginx / gunicorn setups,
as I don’t know enough about it to be particularly helpful. I just
verified that it seemed to work. (Just FYI, Gunicornwithoutnginx didnotseem to work unless I used one of the async workers, kept
getting timeouts.)Why am I getting repeat or unreliable file uploads on my Raspberry Pi?I’m not sure. I was gettingexcellentreliability when running
EyeFlask on my Macbook Air andverypoor reliability on my Raspberry
Pi B+ with EyeFlask 0.1.0. It seemed like the file would be uploaded
exctracted without issue, but the EyeFi card kept sending the same file
over and over, leading me to believe that the confirmation response
wasn’t getting received every time. I thought it might have something to
do with slow response times, so I did a little code optimization with
0.1.1 which seems to have helped. I also gave up and put EyeFlask behind
a gunicorn / nginx setup, and between the two of these changes I have
much better upload reliability.Changelog0.1.3 :: 20170310Add strftime based subfolders to config (see issue #2)Encourage use of virtualenv in the READMETest docs creation in TravisFix some flake8 compliants0.1.2 :: 20170303Python 3.6 compatibilityStop usingsrc/subdirectoryTry to fix some Pandoc exceptions0.1.1 :: 20160318Usearray.arrayinstead ofstruct.iter_unpackfor modest
speed boostRenamestart_sessiontohandle_SOAP– because that’s what it
doesExtract the image from the tarfile data prior to writing to disk
(eliminating the need to delete the tarfile afterwards)0.1.0 :: 20160227Initial release to GitHub, PyPI