#!/usr/bin/perl -w

my $song = "";
my $votes = 0;
my $start = 0;
my $art = "";

while (<>) {
  # skip starting rubbish
  $start = 0, next if /--------/;
  $start = 1, next if /Song/;
  next unless $start;

  # chop into fields (fixed with)
  chomp;
  $_ .= " "x80;
  my ( $s, $a, $n, $v, $c ) =
	m/^(................)(................)(...............)(.....)(.+)$/;

  # If there's a vote number, then it's a new song.
  $v =~ s/ //g;
  if ( $v =~ /^\d+/ ) {
	if ( $song ) {
	  $song =~ s/^\s+//;
	  $song =~ s/\s+$//;
	  $song =~ s/\s+/ /g;
	  $art =~ s/^\s+//;
	  $art =~ s/\s+$//;
	  $art =~ s/\s+/ /g;
	  print "$song ($art): $votes\n";
	  $art = "";
	  $song = "";
	}
    $votes = $v;
  }

  $song .= " $s";
  $art .= " $a";
}

if ( $song ) {
  $song =~ s/^\s+//;
  $song =~ s/\s+$//;
  $song =~ s/\s+/ /g;
  $art =~ s/^\s+//;
  $art =~ s/\s+$//;
  $art =~ s/\s+/ /g;
  print "$song ($art): $votes\n";
  $art = "";
  $song = "";
}

