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/playlists/artistlist.pm | 78 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 cgi-bin/playlists/artistlist.pm (limited to 'cgi-bin/playlists/artistlist.pm') 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 => '
', + count => 0}; + + # show the logo if this is a new page + my $logo; + $logo = '' 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} .= '
' if ($self->{section}); + $self->{playlist} .= ''.$firstletter."\n

"; + $self->{section} = $firstletter; + $self->{shortcuts} .= ''.$firstletter.' '; + } + my $realength = $artist; + $realength=~s/&[^;]*;/x/g; + $realength = (int(length($realength) / 20) +1)*120; + $self->{playlist} .= "

". + "".makeHTML($artist)." 
"; + $self->{count}++; +} + +sub dump { + my $self = shift; + $self->{playlist} .= "\n
"; + 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}."

$REPORT"; + } + else + { + $self->{playlist} =~ s/%COUNT%/

Sorry, no-one found./; + + return $self->{playlist}.""; + } +} + +return 1; + -- cgit v1.2.3