[Bins] gallery cleanup script

Jérôme SAUTRET jerome at sautret.org
Sat Mar 1 21:44:26 GMT 2003


On Sat, Mar 01, 2003 at 06:35:15PM +0100, Jochen Schaeuble wrote:
> Hi,
> I've written a simple & stupid perl script that removes left over files
> in the gallery destination directory (i.e. if the original file was
> renamed or removed). The current implementation doesn't actually remove
> files. It only prints a message that a file/directory should be deleted.
> 
> I would be happy if someone on the list could test this script and give
> me some feedback if it works.

Here are some remarks about the script :

Only filenames ending with .jpg and .jpg.xml are tested, but some
images can use other extensions. Here are the graphic formats that
bins recognizes to be published on the Web :

my @webFormats = ("JPEG", "GIF", "PNG"); # Image formats that can go
                                         # into the web album (other
                                         # formats will be converted
                                         # to JPEG).

So, perhaps you can test for jpg, jpeg, gif and png. This could detect
most of the files to be removed. Most, because there is another
problem : bins handles others formats in the source directory :

# @knownImageExtentions defines file extensions that BINS can handle as
# input image.
my @knownImageExtentions = ("jpg", "jpeg", "gif", "png", "tiff",
			    "bmp", "tga", "ps", "eps", "fit", "pcx",
			    "miff", "pix", "pnm", "rgb", "im1", "xcf",
			    "xwd", "xpm", "avs", "dcm", "dcx", "dib",
			    "dps", "dpx", "epdf", "epi", "ept", "fpx",
			    "icb", "mat", "mtv", "pbm", "pcd", "pct",
			    "pdb", "ppm", "ptif", "pwp", "ras", "thm",
			    );


So, an image can have a .jpg extension in the dest directory but
another one in the source one. It becomes difficult when two files use
the same name with two different extensions, like picture.jpg and
picture.tiff. Well, bins doesn't handle that, but it should ;-)
For now, just replacing the extension of the source image not in
webFormats by .jpg to test it in the dest dir should be OK.

I've also noticed that the script deletes static.* directory, which
isn't in the source directory but in the templates directory.

Anyway, I think that a clean up feature like that could be useful and
added to bins. It can be executed after every album creation.

-- 
Jérôme SAUTRET (Jerome @ SAUTRET.org)           http://SAUTRET.org
Key 0x95D463F3 fingerprint 3B69 3B60 4D32 B8DF 2BF3 8035 5036 D41A 95D4 63F3



More information about the Bins mailing list