summaryrefslogtreecommitdiff
path: root/cgi-bin/playlists/artistlist.pm
diff options
context:
space:
mode:
Diffstat (limited to 'cgi-bin/playlists/artistlist.pm')
-rw-r--r--cgi-bin/playlists/artistlist.pm78
1 files changed, 78 insertions, 0 deletions
diff --git a/cgi-bin/playlists/artistlist.pm b/cgi-bin/playlists/artistlist.pm
new file mode 100644
index 0000000..5c419c7
--- /dev/null
+++ b/cgi-bin/playlists/artistlist.pm
@@ -0,0 +1,78 @@
+package artistlist;
+
+use strict;
+use Globals;
+use Globals qw(%PLATTERS);
+use Globals qw(@MUSIC);
+use Globals qw(@VIDEO);
+use Globals qw($target);
+use Globals qw($delim);
+use Globals qw($bgcolour);
+
+sub new {
+ my $self = {
+ mime => "text/html",
+ playlist => openTemplate("search"),
+ artistSearch => 0,
+ section => undef,
+ shortcuts => '<br>',
+ count => 0};
+
+ # show the logo if this is a new page
+ my $logo;
+ $logo = '<a href="front.plx"><img src="/platdoc/img/logo.gif" hspace=0 border=0></a>' if ($target eq '_top');
+ $self->{playlist} =~ s/%LOGO%/$logo/;
+ $self->{playlist} =~ s/%BGCOLOUR%/$bgcolour/;
+
+ bless ($self);
+ return $self;
+}
+
+sub desc {
+ return "Artist Search Results";
+ }
+
+sub header {
+ my $self = shift;
+}
+
+sub track {
+ my ($self, $abc, $artist) = @_;
+ $artist = $abc if !$artist;
+ my $firstletter = substr($abc, 0, 1);
+ if ($firstletter ne $self->{section}) {
+ $self->{playlist} .= '<hr style="color:white; clear:both" align="left">' if ($self->{section});
+ $self->{playlist} .= '<span class="title">'.$firstletter."</span><a name=\"".uc($firstletter)."\">\n</a><p>";
+ $self->{section} = $firstletter;
+ $self->{shortcuts} .= '<a href="#'.$firstletter.'"><b>'.$firstletter.'</b></a>&nbsp;';
+ }
+ my $realength = $artist;
+ $realength=~s/&[^;]*;/x/g;
+ $realength = (int(length($realength) / 20) +1)*120;
+ $self->{playlist} .= "<div style=\"float:left; width:".$realength."px\">".
+ "<a href=\"artist.plx?name=".makeUnNice($artist)."&exact=1\">".makeHTML($artist)."</a>&nbsp;</div>";
+ $self->{count}++;
+}
+
+sub dump {
+ my $self = shift;
+ $self->{playlist} .= "\n<br style=\"clear:both\">";
+ my $shortcuts = $self->{shortcuts};
+ $self->{playlist} =~ s/%SHORTCUTS%/$shortcuts/;
+
+ if ($self->{count} > 0)
+ {
+ my $REPORT = "Found ".$self->{count}." artists.";
+ $self->{playlist} =~ s/%COUNT%/$REPORT/;
+ return $self->{playlist}."</ol><p>$REPORT</body></html>";
+ }
+ else
+ {
+ $self->{playlist} =~ s/%COUNT%/<p>Sorry, no-one found./;
+
+ return $self->{playlist}."</ol></body></html>";
+ }
+}
+
+return 1;
+