From fa170afd817648f306e322802ca85b6abbd37f74 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Jun 2011 16:33:26 +0200 Subject: Initial commit --- cgi-bin/artist.plx | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 cgi-bin/artist.plx (limited to 'cgi-bin/artist.plx') diff --git a/cgi-bin/artist.plx b/cgi-bin/artist.plx new file mode 100644 index 0000000..cb6ea29 --- /dev/null +++ b/cgi-bin/artist.plx @@ -0,0 +1,141 @@ +#!c:/perl/bin/perl + +use CGI; +use strict; +use Search; +use Globals; +use Globals qw($delim); +use Globals qw($debug); +use Globals qw(%PLATTERS); +use Globals qw($target); +use Globals qw($bgcolour); + +my $query = CGI::new(); +my $artist = $query->param( "name" ); +$artist =~ s/(The |)(.*?)(, The|)/$2/; +my $reqAlbum = $query->param( "album" ); +my $inv = $query->param( "inv" ); +my $target = $query->cookie("target"); +my $webpage; + +if ( $target =~ /narrow/ ) +{ + $webpage = openTemplate("artistNarrow"); +} +else +{ + $webpage = openTemplate("artist"); +} + +Search::setArtist($artist); +Search::searchFor('album'); +Search::setExact(1); +if (length $inv > 0) { Search::setInv(split(',', $inv)) } +else { Search::setInv(keys %PLATTERS) } + +my @albums = Search::go() unless !$artist; + +my $albumlist; +my $hasMisc; +my $init; +my $index; +my $albumcount; +my $countreport; +my $firstAlbum; +foreach( @albums ) { + my ($year, $album, $platter) = split($delim); + my $selected; + print "$year, $album, $platter\n" if ($debug); + my $link = 'search.plx?artist='.makeUnNice($artist).'&album='.makeUnNice($album). + '&exact=1&searchFor=track&inv='.$platter; + + if ($album =~ /^\Q$reqAlbum\E$/) { + $init = $link.'&output=album'; + $selected = ' selected'; $reqAlbum = 'found'; + } + + $albumcount++; + + if ($album =~ /^Miscellany$/) { + if (!$hasMisc) { + $index = $link.'&output=album'; + $hasMisc = 1; + } + } + else { + + $firstAlbum = $link.'&output=album' if (!$firstAlbum); + $albumlist .= "\n