galsync

galsync

Synchronization between Gallery and your local filesystem
version beta-1b

Contents: Overview / Requirements / Building / Usage / Screenshot / License / Contact / Download

Overview

Galsync is a program designed to synchronize the albums in your PHP Gallery application with files in local folders. It has been designed to be both interactive and completely hands-off, with both the occassinal user and the knowledgable Unix script-writer in mind. It can work on a single album or on every album in your gallery. You have the ability to specify bidirectional synchronization or limit it to strictly downloading (for instance, making backups) or uploading.

All of the actions you want galsync to perform are stored in a configuration file. The first time you run galsync, it will notice that you have no such file, will present you with friendly prompts, and will build up a good templated configuration file based on your answers. In this way, you do not need to learn yet another configuration file format (unless you really want to) and do not even need to touch a text editor.

Requirements

Galsync has been written in C++ and obviously needs a compiler like g++ and a make system such as gmake. In addition to this, it relies on the following libraries:

  • STL – If you have g++, you already have this
  • getopt – Your OS probably also has Gnu getopt, too
  • readline – Your OS probably has libreadline, as well
  • libcurl – getopt has been tested against libcurl version 7.12.3, but it is entirely possible that earlier versions will work, too. If you get error messages about curl_free, your version is too old.

Galsync was developed on Mac OS X (with the devloper tools and Fink packages installed) and Redhat 9, but should run under most any Unix-like operating with a little bit of tweaking.

Building

Simply unpack the archive and run “make” or “gmake“. After it is complete, you should have the file “galsync” in the local folder. You can copy this to somewhere in your path such as /usr/local/bin.

Usage

There are two main modes of galsync: configuration and synchronizing. Configuration happens automatically by answering a few questions about your gallery setup. Synchronization happens without any user intervention using your configuration file(s) and the Gallery Remote protocol.

When configuring a single album to a single local folder, a file named galsync.conf is created in the current directory. It is expected that all synchronization happens in this same directory. All downloaded files appear here and all uploaded images come from here. It is very tempting and easy to just do this in any ol’ folder. Be sure that you create an empty folder, change directories into it, then run “galsync -c“.

When configuring galsync for all albums, the current folder gets a dummy galsync.conf file. This configuration file has no associated album on the server and is simply a placeholder, telling galsync to recurse into all of the subfolders. A subfolder is created for each album on the server and each of these gets its own galsync.conf file.

When synchronizing, galsync.conf is read and the appropriate action, via the Gallery Remote interface, is performed. It all depends on how your configuration file is set up.

“Screenshot”

A screenshot for a text-based application makes little sense, but how about a transcript?

Script started on Mon Dec 20 19:42:12 2004
[fibonacci:/tmp/blah] enigma% galsync 

ERROR: Auto-configure argument (-c) not specified and no galsync.conf.
       You need to create a configuration file by using the -c argument.

galsync version beta-1
Usage:
galsync [-q] [-c]
 -q : quiet
 -c : auto-configure

Without an auto-configure parameter, galsync looks for the file galsync.conf
in the current folder.

If this is your first time using galsync, you should probably auto-configure
one or more albums to synchronize:
 galsync -c
This will ask you a few questions about your Gallery installation, then write
out configuration files.  You can then run galsync without arguments and it
will read the configuration files and start synchronizing.

[fibonacci:/tmp/blah] enigma% galsync -c

You have two ways to auto-configure galsync: single album or all.
[S]ingle album - A single galsync.conf file is created and placed in the
                 current directory.  When you synchronize with your online
                 Gallery, only the contents of a single album (you will get
                 to choose which one shortly) gets synchronized with the
                 contents of the current folder.
[A]ll albums -   Under the current folder, a number of subdirectories are
                 created--one for each album on the server.  When you
                 synchronize, each folder is entered and synchronized with
                 the server, giving a backup/upload of all of your albums
                 with one command.
[S]ingle, [A]ll, or [Q]uit? a
I will now ask you a few questions about your gallery configuration.
Your answers will be stored in the configuration file galsync.conf.
Please note that if you choose to save your Gallery login password, it
is saved as plaintext in the config file.  This is not that big of a deal
on a single-user system, but is a security issue on multiuser machines.
You can hit Ctrl-C at any time to abort this process.

First, I need to know if there is an HTTP proxy server on your network.
Most people do not have them, but there might be one on your network if
you are on a large corporate LAN.  Most people can leave this blank.  If
you do have a proxy server, please enter it in the format of
http://server:port
For example "http://10.1.1.254:80" or "http://saturn:80"
If you do not have a proxy server, just hit Enter to leave this blank.
 ?
What is the URL of your Gallery installation?
For example: http://myserver.com/gallery
 ? http://adjectivenoun.org/gallery
Testing connectivity
Server active
What is the username for logging in as [default:admin]?
 ?
What is the password for user "admin" [default:ask each time]?
 ? [password was typed]
How would you like to synchronize your local folder to the Gallery server?
 D : download only
 U : upload only
 B : both download and upload (default)
 ? b
For file uploads, please list the file extensions you wish to upload.
This is a comma-separated list of just the extensions without the
"dot" prefixes.  (default: "jpg,gif,png")
 ?
Retrieving album list from server...
Successfully logged in to version 2.14 server as admin
Got list of 47 albums
Creating folder and config for "2004-Q4"
Creating folder and config for "album01"
Creating folder and config for "blues04"
Creating folder and config for "brandons_fridge"
Creating folder and config for "cats"
Creating folder and config for "cd_burning_man"
Creating folder and config for "chickeninacan"
Creating folder and config for "conrad37"
Creating folder and config for "dc8"
Creating folder and config for "defcon2001"
Creating folder and config for "enigma"
Creating folder and config for "enigma27"
Creating folder and config for "eric"
Creating folder and config for "fenians"
Creating folder and config for "flugtag"
Creating folder and config for "food"
Creating folder and config for "geocaching"
Creating folder and config for "giantcheeseburger"
Creating folder and config for "hike-20030913"
Creating folder and config for "hike-20040307"
Creating folder and config for "house-pine"
Creating folder and config for "housewarming"
Creating folder and config for "junkdrawer"
Creating folder and config for "kate"
Creating folder and config for "kittens1"
Creating folder and config for "kittens2"
Creating folder and config for "lisabday2002"
Creating folder and config for "metal"
Creating folder and config for "nojess"
Creating folder and config for "ny2004"
Creating folder and config for "oc-2003-12"
Creating folder and config for "omsi"
Creating folder and config for "paintings"
Creating folder and config for "paper"
Creating folder and config for "party"
Creating folder and config for "portland"
Creating folder and config for "portland-200409"
Creating folder and config for "random"
Creating folder and config for "sapporo"
Creating folder and config for "scrapple"
Creating folder and config for "snow"
Creating folder and config for "spookycastle"
Creating folder and config for "thanksgiving2004"
Creating folder and config for "trips"
Creating folder and config for "vegas2k"
Creating folder and config for "warpcore"
Creating folder and config for "wrt54g"

Congratuations, galsync has been configured.  Now run galsync
[fibonacci:/tmp/blah] enigma% galsync

Successfully logged in to version 2.14 server as admin
Going into folder "2004-Q4"
Got list of 136 images in 2004-Q4
Downloading A_E.jpg
Downloading BC.jpg
Downloading BC_Cracks.jpg
Downloading BC_Gets_Down_with_Diana_and_Kim.jpg
    [ ... transcript edited, lines removed ... ]
Downloading when_jerry_s_ghost_attacks_natalie.jpg
Downloading which_slice_is_not_like_the_others.jpg
Going into folder "album01"
Got list of 33 images in album01
Downloading img_0019.jpg
Downloading img_0020.jpg
    [ ... transcript edited, lines removed ... ]
Downloading img_0057.jpg
Going into folder "blues04"
Got list of 7 images in blues04
Downloading 100_0016_1.jpg
    [ ... transcript edited, lines removed ... ]
Downloading Sonny_L_Ass_Pan_1_1.jpg
Going into folder "brandons_fridge"
Got list of 34 images in brandons_fridge
Downloading 01_groceries.jpg
Downloading 02_grocery_zuul.jpg
Downloading 03_alf_groceries.jpg
    [ ... transcript edited, lines removed ... ]
Downloading 20_theyre_here.jpg

…etc.

License

galsync is an Open Source project distributed under the Gnu Public License. Compile it, use it, pick it apart to see how it works–but if you change it, please let me know what you did. There is a good C++ class in there for talking the Gallery Remote protocol that you can use in your own apps.

Contact

galsync is still a beta application. The best I can say is “it works for me.” I would love to hear any feedback you may have on it. How can it be made better? Does it work on your system (whether or not the system is listed above)? Does it not work for you? Were you able to improve it? I would love to hear your feedback–although keep in mind that I work full-time as a hardware/firmware developer and do not always have as much spare time as I want to do this kind of thing. Contact me at enigma at netninja d0t com.

Download

Unless someone would like to volunteer to put together a Debian *.deb or a Redhat *.rpm, galsync is available only in source code form.

Latest Release (Change Log)
galsync-beta-1b.tgz (19 kb)

Earlier Releases
galsync-beta-1a.tgz (19 kb)
galsync-beta-1.tgz (19 kb)

Leave a Reply

Your email address will not be published. Required fields are marked *