8 my $machine = $cgi->param('machine');
10 my $dbh = ccbs::db_connect();
12 my $songs_raw = ccbs::db_fetch_all($dbh, 'SELECT song,title,artist,playmode,difficulty,feetrating FROM songratings NATURAL JOIN songs WHERE machine=? ORDER BY LOWER(title)', $machine);
17 for my $song (@$songs_raw) {
18 if ($song->{'song'} != $last_song) {
19 push @songs, { song => $song->{'song'}, title => $song->{'title'}, artist => $song->{'artist'} };
22 my $key = $song->{'playmode'} . '_' . $song->{'difficulty'};
23 $songs[$#songs]->{$key} = $song->{'feetrating'};
24 $last_song = $song->{'song'};
27 print CGI::header(-type=>'text/plain; charset=utf-8');
29 INCLUDE_PATH => 'templates/',
34 my $template = Template->new($config);
37 $template->process('songratings-text.tmpl', { songs => \@songs }, \$output)
38 or die $template->error();