#!/usr/bin/perl -w
##########################################
# (c) 2004 Barry Hughes <bazza@bazza.com>
# make an rss feed of my photos dir, so
# the most recently updated is fairly easy
# to grab from it
# Notes: fucking sweem
##########################################

use XML::RSS;
use File::Find;

$photodir = "/home/bazza/public_html/photos";
$baseurl = "http://photos.bazza.com/index.cgi";

my $rss = new XML::RSS (version => '1.0');
$rss->channel(
  title        => "photos.bazza.com",
  link         => "http://photos.bazza.com/",
  description  => "Barry's photos",
);

$rss->image(
  title  => "photos.bazza.com",
  url    => "http://photos.bazza.com/bazza.com.jpg",
  link   => "http://photos.bazza.com",
);

sub wanted;
# Traverse desired filesystems
find(\&wanted, $photodir);

sub wanted {
  if($_ =~ /originals/) {
    my $name = "$File::Find::name";
    push(@list, $name);
  }
}

foreach(sort @list) {
  my $name = $_;
  $name =~ s/$photodir//g;
  $name =~ s/\/originals//g;
  $dirname = $name;
  $name =~ m#^.*/(.*?)$#;
  my $description = $1;
  $rss->add_item(
    title           =>      $dirname,
    link            =>      "$baseurl$name",
    description     =>      "$description",
    );
}

$rss->save("/home/bazza/www/photos/photos.rdf");



syntax highlighted by Code2HTML, v. 0.9