Announce: galleryadd.pl 1.10

iainlea

Joined: 2004-09-24
Posts: 10
Posted: Mon, 2005-02-28 07:33

A perl script to add images or a recursive directory structure to a gallery.

I modified the galleryadd.pl script from Jesse Mullan (jmullan@visi.com)
and added a number of new features for ease of use.

You can download it here: http://iainlea.dyndns.org/software/galleryadd/

Usage: galleryadd.pl [options] [file(s) | dir(s)]
       -a album  album to be used for uploading image(s) or directory
       -c album  create new album for uploading image(s) or directory
       -d text   description for new album
       -g url    URL of gallery (default: http://gallery.yoursite.com)
       -l        list available albums for specified gallery 
       -n        do not verify if album exists before starting upload
       -p pass   password to use to login to gallery
       -q        quiet mode (unless errors are encountered)
       -t text   title for new album (if not specified uses -A value)
       -u user   username to use to login to gallery (default: admin)
       -z        zap caption that is by default derived from filename
       -h        help
       -v        verbose

Examples:
  galleryadd.pl -g http://gallery -u admin -p mypass -a mycars bmw.jpg

    upload image bmw.jpg to album mycars

$GALLERY_[URL|USER|PASS|ALBUM|LOG] variables settable as defaults.

Changelog:

- added size + speed stats for upload (Upload file.jpg [132.1K] [280KB/s] [OK])
- added $ENV{GALLERY_LOG} for verbose logfile 
- changed fetch-albums code to be in &FetchAlbumList function
- changed cookie_jar saving from autosave => 1 to $cookie_jar_save
- fixed stripping of path from filename for ParseCmdLine function
- fixed -v option to expand "~/galleryadd.log" to $HOME/filename
- fixed '-c newalbum' to exit if album already exists in gallery
- fixed -l option which was printing no files error message
- fixed logic so that ! [-a|-c] prints error message and usage 
- fixed logic so that -c newalbum can be done without adding images
- fixed @ARGV to be sorted before calling AddDir/AddImage (cygwin)

Here is an example run that creates a top level album and uploads a few images:

$ galleryadd.pl -g gallery.mysite.com -u admin -p mypass -c 20050220 *.jpg

System  gallery.mysite.com 
Login:  admin  [OK]
Create  20050220  [OK]
Album:  fetching list  [OK]
Album:  20050220  [OK]
Upload  race1.jpg  [687K] [355KB/s] [OK]
Upload  race2.jpg  [1.5M] [1.1MB/s] OK]
Upload  race3.jpg  [ 98K] [340KB/s] [OK]

Enjoy. Feedback and any patches welcome.

Iain