remove creation of the rss/atom feeds - it does not work anyway
authorEugene Crosser <crosser@average.org>
Thu, 10 Jan 2013 12:23:59 +0000 (12:23 +0000)
committerEugene Crosser <crosser@average.org>
Thu, 10 Jan 2013 12:23:59 +0000 (12:23 +0000)
mkgallery.pl

index 5ba15568d09e77017faf41f784ea350c69b46389..f5b6186013ed9bdcac7c3cdc441ad579c4dabdf1 100755 (executable)
@@ -6,7 +6,7 @@ my $version='$Id$';
 # Makes use of modified "slideshow" javascript by Samuel Birch
 # http://www.phatfusion.net/slideshow/
 
-# Copyright (c) 2006-2008 Eugene G. Crosser
+# Copyright (c) 2006-2013 Eugene G. Crosser
 
 #  This software is provided 'as-is', without any express or implied
 #  warranty.  In no event will the authors be held liable for any damages
@@ -42,9 +42,6 @@ binmode(STDOUT, ":utf8");
 my $haveimagick = eval { require Image::Magick; };
 { package Image::Magick; }     # to make perl compiler happy
 
-my $havefeed = eval { require XML::FeedPP; };
-{ package XML::FeedPP; }       # to make perl compiler happy
-
 my $havegeoloc = eval { require Image::ExifTool::Location; };
 { package Image::ExifTool::Location; } # to make perl compiler happy
 
@@ -54,11 +51,9 @@ my $incdir = ".gallery2";
 ######################################################################
 
 my $incpath;
-my $feedobj;
 my $debug = 0;
 my $asktitle = 0;
 my $noasktitle = 0;
-my $feed = "";
 
 charset("utf-8");
 
@@ -67,23 +62,13 @@ unless (GetOptions(
                'incpath'=>\$incpath,
                'asktitle'=>\$asktitle,
                'noasktitle'=>\$noasktitle,
-               'feed=s'=>\$feed,
                'debug'=>\$debug)) {
        &help;
 }
 
-if ($feed && !$havefeed) {
-       print STDERR "You need to install XML::FeedPP to use --feed\n";
-       exit 1;
-}
-
 my $term = new Term::ReadLine "Edit Title";
 
 FsObj->new(getcwd)->iterate;
-if ($feedobj) {
-       $feedobj->{-feed}->pubDate(time);
-       $feedobj->{-feed}->to_file($feedobj->{-savepath});
-}
 
 sub help {
 
@@ -96,11 +81,6 @@ usage: $0 [options]
  --asktitle:    ask to edit album titles even if there are ".title" files
  --noasktitle:  don't ask to enter album titles even where ".title"
                 files are absent.  Use partial directory names as titles.
- --feed=...:   build Atom feed for newly added "albums",
-               enter filename, base URL, and optionally PuSH hub url,
-               separated by commas. (Note: PuSH obviously does not work
-               "out of the box" for static tree! You need a separate
-               "watcher" script to do the publishing for you.)
 __END__
 
        exit 1;
@@ -131,7 +111,7 @@ sub new {
                                -root=>$root,
                                -fullpath=>$root,
                        };
-               # fill in -inc, -feed, -relpath
+               # fill in -inc, -relpath
                initpaths($self); # we are not blessed yet, so cheat.
        }
        bless $self, $class;
@@ -180,70 +160,13 @@ sub initpaths {
                $self->{-relpath} = $relpath;
                $self->{-toppath} = substr($fullpath,0,$pos);
                #print "rel=$relpath, top=$self->{-toppath}, inc=$inc\n";
-               initfeed($self);
        } else {
                $self->{-inc} = 'NO-.INCLUDE-IN-PATH/'; # won't work anyway
-               $self->{-feed} = '';
                $self->{-relpath} = '';
                $self->{-depth} = 0;
        }
 }
 
-sub initfeed {
-       my $self=shift;         # this is not a method but we cheat
-       my $fullpath=$self->{-fullpath};
-       my $toppath=$self->{-toppath};
-       my $inc=$self->{-inc}.$incdir.'/';
-       my $conffile=$toppath.'/'.$incdir.'/feed.conf';
-       my $CONF;
-
-       if (! $incpath) {
-               if ($feed) {
-                       if (open($CONF,">".$conffile)) {
-                               print $CONF $feed,"\n";
-                               close($CONF);
-                       } else {
-                               print STDERR "could not open $conffile: $!\n";
-                       }
-               } else {
-                       if (open($CONF,$conffile)) {
-                               $feed=<$CONF>;
-                               close($CONF);
-                               chop $feed;
-                       }
-               }
-       }
-
-       return unless ($feed);
-
-       my ($feedfile, $feedbase, $feedhub) = split(',', $feed);
-       $feedbase .= '/' unless ($feedbase =~ /\/$/);
-       print "($feedfile, $feedbase, $feedhub)\n";
-
-       $feedobj->{-savepath} = $self->{-toppath}.'/'.$feedfile;
-       $feedobj->{-file} = $feedfile;
-       $feedobj->{-base} = $feedbase;
-       $feedobj->{-hub} = $feedhub;
-       if ( -f $feedobj->{-file} ) {
-               $feedobj->{-feed} = XML::FeedPP::Atom::Atom10->new(
-                                                       $feedobj->{-file});
-               $feedobj->{-feed}->limit_item(15);
-       } else {
-               $feedobj->{-feed} = XML::FeedPP::Atom::Atom10->new;
-               $feedobj->{-feed}->title("Gallery");
-               $feedobj->{-feed}->description("generated by ".
-                       "<a href=\"http://www.average.org/mkgallery/\">".
-                       "mkgallery</a>");
-               $feedobj->{-feed}->link($feedbase, 'type' => 'text/html', 'rel' => 'alternate');
-               $feedobj->{-feed}->xmlns("xmlns:ostatus" =>
-                       "http://ostatus.org/schema/1.0");
-               #$feedobj->{-feed}->copyright("");
-               #$feedobj->{-feed}->language("en");
-               #$feedobj->{-feed}->image($url, $tit, $link, $desc, $w, $h);
-       }
-       $self->{-feed} = $feedobj->{-feed};
-}
-
 sub iterate {
        my $self = shift;
        my $fullpath .= $self->{-fullpath};
@@ -643,16 +566,8 @@ sub startindex {
 
        my $inc = $self->{-inc}.$incdir.'/';
        my $title = $self->{-title};
-       my $feedlink="";
-       if ($feedobj) {
-               $feedlink=Link({-rel=>'alternate',
-                               -type=>'application/atom+xml',
-                               -title=>'Gallery Feed',
-                               -href=>$feedobj->{-base}.$feedobj->{-file}});
-       }
        print $IND start_html(-title => $title,
                        -encoding=>"utf-8",
-                       -head=>$feedlink,
                        -style=>[
                                {-src=>$inc."gallery.css"},
                                {-src=>$inc."custom.css"},
@@ -723,25 +638,6 @@ sub endindex {
 
        close($IND) if ($IND);
        undef $self->{-IND};
-       if ($feedobj) {
-               my $feedtitle=sprintf "%s [%d images, %d subalbums]",
-                               $self->{-title},
-                               $self->{-numofimgs},
-                               $self->{-numofsubs};
-               my $feedlink=$feedobj->{-feed}->link.
-                       $self->{-relpath}."index.html";
-               my $uu;
-               my $us;
-               UUID::generate($uu);
-               UUID::unparse($uu, $us);
-               $feedobj->{-feed}->add_item(
-                       title           => $self->{-title},
-                       link            => $feedlink,
-                       description     => $feedtitle,
-                       pubDate         => time,
-                       guid            => $us,
-               );
-       }
 }
 
 sub startsublist {