galsync

gal­sync

Synchronization between Gallery and your local filesys­tem
ver­sion beta-1b

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

Overview

Galsync is a pro­gram designed to syn­chro­nize the albums in your PHP Gallery appli­ca­tion with files in local fold­ers. It has been designed to be both inter­ac­tive and com­pletely hands-off, with both the occassi­nal user and the knowl­edgable Unix script-writer in mind. It can work on a sin­gle album or on every album in your gallery. You have the abil­ity to spec­ify bidi­rec­tional syn­chro­niza­tion or limit it to strictly down­load­ing (for instance, mak­ing back­ups) or upload­ing.

All of the actions you want gal­sync to per­form are stored in a con­fig­u­ra­tion file. The first time you run gal­sync, it will notice that you have no such file, will present you with friendly prompts, and will build up a good tem­plated con­fig­u­ra­tion file based on your answers. In this way, you do not need to learn yet another con­fig­u­ra­tion file for­mat (unless you really want to) and do not even need to touch a text edi­tor.

Requirements

Galsync has been writ­ten in C++ and obvi­ously needs a com­piler like g++ and a make sys­tem such as gmake. In addi­tion to this, it relies on the fol­low­ing libraries:

  • STL — If you have g++, you already have this
  • getopt — Your OS prob­a­bly also has Gnu getopt, too
  • read­line — Your OS prob­a­bly has libread­line, as well
  • libcurl — getopt has been tested against libcurl ver­sion 7.12.3, but it is entirely pos­si­ble that ear­lier ver­sions will work, too. If you get error mes­sages about curl_free, your ver­sion is too old.

Galsync was devel­oped on Mac OS X (with the devloper tools and Fink pack­ages installed) and Redhat 9, but should run under most any Unix-like oper­at­ing with a lit­tle bit of tweak­ing.

Building

Simply unpack the archive and run “make” or “gmake”. After it is com­plete, you should have the file “gal­sync” in the local folder. You can copy this to some­where in your path such as /usr/local/bin.

Usage

There are two main modes of gal­sync: con­fig­u­ra­tion and syn­chro­niz­ing. Configuration hap­pens auto­mat­i­cally by answer­ing a few ques­tions about your gallery setup. Synchronization hap­pens with­out any user inter­ven­tion using your con­fig­u­ra­tion file(s) and the Gallery Remote pro­to­col.

When con­fig­ur­ing a sin­gle album to a sin­gle local folder, a file named galsync.conf is cre­ated in the cur­rent direc­tory. It is expected that all syn­chro­niza­tion hap­pens in this same direc­tory. All down­loaded files appear here and all uploaded images come from here. It is very tempt­ing and easy to just do this in any ol’ folder. Be sure that you cre­ate an empty folder, change direc­to­ries into it, then run “galsync -c”.

When con­fig­ur­ing gal­sync for all albums, the cur­rent folder gets a dummy galsync.conf file. This con­fig­u­ra­tion file has no asso­ci­ated album on the server and is sim­ply a place­holder, telling gal­sync to recurse into all of the sub­fold­ers. A sub­folder is cre­ated for each album on the server and each of these gets its own galsync.conf file.

When syn­chro­niz­ing, galsync.conf is read and the appro­pri­ate action, via the Gallery Remote inter­face, is per­formed. It all depends on how your con­fig­u­ra­tion file is set up.

Screenshot”

A screen­shot for a text-based appli­ca­tion makes lit­tle sense, but how about a tran­script?

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

gal­sync is an Open Source project dis­trib­uted 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 talk­ing the Gallery Remote pro­to­col that you can use in your own apps.

Contact

gal­sync is still a beta appli­ca­tion. The best I can say is “it works for me.” I would love to hear any feed­back you may have on it. How can it be made bet­ter? Does it work on your sys­tem (whether or not the sys­tem 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 devel­oper and do not always have as much spare time as I want to do this kind of thing. Contact me at enigma at net­ninja d0t com.

Download

Unless some­one would like to vol­un­teer to put together a Debian *.deb or a Redhat *.rpm, gal­sync is avail­able 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 *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>