#!/usr/bin/perl
# Filename:	run_album.cgi
# Author:	David Ljung Madison <DaveSource.com>
# See License:	http://MarginalHacks.com/License/
# Description:	CGI script that can regenerate albums
use strict;

# You might need to set $ENV{HOME} in this..

my $ALBUM_BIN = "/usr/local/bin/album";
my $ALBUM_DIR = "/home/httpd/some/path/to/Photos";
my $ALBUM_URL = "http://SomeDomain.com/path/to/Photos";

# Redirect
my $what = "html";	# So people can read the script at my website
print <<END;
Content-type: text/html

<$what>
<title>Building a new album</title>
<body bgcolor=white>
  <h1>Patience...</h1> <br><br>
  I'm building a new <a href=$ALBUM_URL>album</a>
  right now - please wait a few moments for the build to complete
  <p>
  <font size=+1><b>Please do not reload this page multiple times!</b></font>
</body>
</$what>
END

system("nohup $ALBUM_BIN $ALBUM_DIR > /dev/null &");

