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/tracks.pm | 85 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 cgi-bin/playlists/tracks.pm (limited to 'cgi-bin/playlists/tracks.pm') diff --git a/cgi-bin/playlists/tracks.pm b/cgi-bin/playlists/tracks.pm new file mode 100644 index 0000000..5e73766 --- /dev/null +++ b/cgi-bin/playlists/tracks.pm @@ -0,0 +1,85 @@ +package tracks; + +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, + 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/g; + + bless ($self); + return $self; +} + +sub desc { + return "Track Search Results"; + } + +sub header { + my $self = shift; + $self->{playlist} .= '
    '; +} + +sub track { + my $self = shift; + my ($folder, $trackartist, $album, $year, $track, $url, $platter) = @_; + + $self->{count}++; + + $self->{playlist} .= "
  1. "; + + #prepare urls + + $self->{playlist} .= ' "'.makeHTML($track).""
    "; + + # prepare artist info + foreach( ($folder, $trackartist) ) { + + $self->{playlist} .= "".makeHTML($_)."," if (/.+/); + } + chop $self->{playlist}; # remove trailing comma + + if (length $album > 0) { # album + $self->{playlist} .= "
    from "; + $album =~ s/\(\d{4}\)(\/|$)/$1/; + $self->{playlist} .= makeHTML($album).""; + if ($year > 0) { $self->{playlist} .= " ($year)" } + } + + $self->{playlist} .= "
     
  2. \n"; +} + +sub dump { + my $self = shift; + $self->{playlist} =~ s/%SHORTCUTS%//; + if ($self->{count} > 0) + { + my $REPORT = "Found ".$self->{count}." matches."; + $self->{playlist} =~ s/%COUNT%/$REPORT/; + return $self->{playlist}."

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

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