Synology NAS as Eye-Fi server
In theory, the a digital camera, an Eye-Fi wireless SD card, and a Synology NAS running Photo Station, should be a terrific combination for quickly putting snapshots online without giving up control over the image files (like you would with flickr, 500px, and friends). One would only need to put together some kind of server software on the NAS that accepts new images taken with the Eye-Fi card and puts them right into Photo Station.
Seriously, how hard can it be?
DISCLAIMER: As always, I take no responsibility for anything that happens because you follow these instructions – but you probably knew that. This is by no means a secure, production-level setup, but just me playing with stuff. Messing with your NAS’s root filesystem, as described below, is always done at your own risk, and the eyefiserver2 python script is not guaranteed to be secured against attacks, either. Don’t blame me. For anything. Ever.
The idea of hosting your own Eye-Fi server without having your pictures transferred all over the internet is not new – and thanks to the work of Jeff Tchang, David Grant, and others, there’s a Python-based piece of Ey-Fi server software that is able to link with an Eye-Fi card and download JPGs straight from the camera to a directory of your choosing. Detailed information about eyeserver2 can be found at http://code.google.com/p/eyefiserver2/.
Installing eyefiserver2
To set up eyesfierver2 on you Synology NAS, you need to
- Install and set up PhotoStation (if you haven’t already) via the Package Center
- Install the Python 2.7 package via the Package Center
- Enable SSH access and login as ‚root‘ (same password as ‚admin‘)
- Download eyefiserver2-DEV.tar.gz, untar it, and copy the files to their locations in the Synology’s file system; or simply
cd / && curl http://eyefiserver2.googlecode.com/files/eyefiserver2-DEV.tar.gz | tar xvz
which does the same thing.
- Install the official Eye-Fi server software on your Windows PC or Mac, and set it up to transfer files to your computer
- Jot down your Eye-Fi card’s MAC address and upload key, which can be found in
C:\Users\kevin\AppData\Roaming\Eye-Fi\Settings.xml
(on Windows 7, an possibly 8)~/Library/Eye-Fi/Settings.xml
(on Mac OS X)C:\Documents and Settings\\Local Settings\Application Data\Roaming\Eye-Fi\Settings.xml
(on Windows XP)
You’re looking for a 12-digit hexadecimal number (the MAC address) and a 32-digit hexadecimal number (the upload key).
- Edit
/etc/eyefiserver.conf
on the NAS to reflect the MAC address and upload key you just found out (mac_0
andupload_key_0
, respectively). Don’t put any separators between the bytes of the MAC address, just00deadbeef00
to represent00:DE:AD:BE:EF:00
is fine. Also, change the dir, uid, gid, file mode, and dir mode as follows:
upload_dir:/volume1/photo/new
upload_uid:1026
upload_gid:100
upload_file_mode:444
upload_dir_mode:666This will make sure that any JPG transferred from your Eye-Fi card is placed in the ‚new‘ album on your PhotoStation.
- Put eyefiserver into your DiskStation’s startup sequence by issuing the following command:
echo -e "#!/bin/sh\n/usr/local/bin/eyefiserver.py start /etc/eyefiserver.conf /var/log/eyefiserver.log" >> /etc/rc.local
- Reboot your NAS, and you should be set. When taking a new picture, you should see appropriate activity in
/var/log/eyefiserver.log
.
Indexing new pictures
With the above steps, new pictures recorded on your Eye-Fi SD card will be transferred directly into the ‚new‘ directory of the ‚photo‘ share on your NAS. However, they will not yet show up in a ‚new‘ album on your PhotoStation, because the NAS hasn’t included them in the media index yet. Files transferred via CIFS/SMB or AFP are automatically added to the index, but files coming in via NFS or from a program running on the NAS itself (like eyefiserver) are not.
To fix this, add the following to /usr/local/bin/eyefiserver.py
:
- Somewhere among the
import
statements at the top of the file (e.g., around line 60), add
import subprocess
- After the line reading
os.chmod(imagePath, string.atoi(file_mode))
(somewhere around line 609), insert the following:
# add file to synology index
eyeFiLogger.debug("adding " + imagePath + " to synoindex")
subprocess.call(["synoindex", "-a", imagePath])Be sure to place these lines at the same indentation level as the preceding
if
statement – this is Python, after all. The section of the file should then read:if file_mode != "": os.chmod(imagePath, string.atoi(file_mode)) # add file to synology index eyeFiLogger.debug("adding " + imagePath + " to synoindex") subprocess.call(["synoindex", "-a", imagePath])
Now, whenever eyefiserver is writing an image file to disk, it calls
synoindex
to immediately add it to the index, which in turn makes it appear in PhotoStation as well.
You may also want to set up appropriate permissions within PhotoStation to the ‚new‘ album.
A word on performance
Eyefiserver2 shouldn’t be a drain on your NAS performance at all – but adding images to the index could be. This is because the media indexing service on the DiskStation will automatically create thumbnails and preview-sized versions of your images, so that they can later display quickly within PhotoStation. In the short-term, this causes significant load on the NAS’s CPU.
On my web-facing DS112j, which is about the slowest DiskStation you can buy from Synology, adding a 12MP JPG to PhotoStation including indexing at „normal“ quality, takes roughly a minute – enough for casual pictures taken during an afternoon with the kids at home. If you come home with a card loaded with several dozens of pictures from a day out at the zoo, be prepared to wait a bit until they appear on your PhotoStation. Of course, a higher-spec Synology will help there, too.
If indexing lots of image files slows down your DiskStation (e.g. when moving them from your PC or Mac over to PhotoStation), you might also want to have a look at Michael Medin’s article about creating thumbnails via NFS.
8 Comments