<& beforetext &>

The Tunes:

Pick your key and click on a format.

<%init> my $basedir = $r->dir_config('basedir'); my $conf = $m->comp("/$basedir/config"); <%perl> my $srcdir = $conf->{srcdir}; opendir(D, $srcdir) || die "can't opendir $srcdir $!"; my %files = (); while (my $file = readdir(D)){ next unless -f "$srcdir/$file"; next unless $file =~ /\.abc$/i; my ($title, $key, $notes); $notes = ''; open (F, "$srcdir/$file") || die "can't open $srcdir/$file $!"; while (){ s/[\x0A\x0D]+$//; if (/^T:(.+)/){ $title = $1; }elsif (/^K:(\w+)/){ $key = $1 unless $key; #just take the first one $key =~ s/(m|[Mm]ix|[Dd]or)$//; #just pretend they're regular keys for now }elsif (/^N:(.+)/){ $notes .= $1.' '; }elsif (/^%%/){ next; }elsif (! /^[A-Z:]/){ last; } } close F; $files{$title} = [$file, $key, $notes]; } foreach my $title (sort keys %files) { my ($file, $key, $notes) = @{$files{$title}}; $file =~ s/\.abc//; $m->current_comp->call_method('dorow', title=>$title, id=>$file, key=>$key, notes=>$notes, ); }

More tunes may follow as I get the time to enter them, someday. <& aftertext &> %#That's the end of the HTML, everything else is Perl. %# ********************************************* %# shared %# ********************************************* <%shared> my %keypos = ( 'A,,' => 0, 'A,' => 12, 'A' => 24, 'A#,,'=> 1, 'A#,'=> 13, 'A#' => 25, 'Bb,,'=> 1, 'Bb,'=> 13, 'Bb' => 25, 'B,,' => 2, 'B,' => 14, 'B' => 26, 'C,' => 3, 'C' => 15, 'c' => 27, 'C#,' => 4, 'C#' => 16, 'c#' => 28, 'Db,' => 4, 'Db' => 16, 'db' => 28, 'D,' => 5, 'D' => 17, 'd' => 29, 'D#,' => 6, 'D#' => 18, 'd#' => 30, 'Eb,' => 6, 'Eb' => 18, 'eb' => 30, 'E,' => 7, 'E' => 19, 'e' => 31, 'F,' => 8, 'F' => 20, 'f' => 32, 'F#,' => 9, 'F#' => 21, 'f#' => 33, 'Gb,' => 9, 'Gb' => 21, 'gb' => 33, 'G,' => 10, 'G' => 22, 'g' => 34, 'G#,' => 11, 'G#' => 23, 'g#' => 35, 'Ab,' => 11, 'Ab' => 23, 'ab' => 36, ); my %keys_at_pos; foreach my $key (keys %keypos){ unshift @{$keys_at_pos{$keypos{$key}}}, $key; } %# ********************************************* %# end shared %# ********************************************* %# ********************************************* %# dorow METHOD %# ********************************************* <%method dorow> <%args> $id $key $title $notes=>'' <%init> my $basedir = $r->dir_config('basedir'); my $conf = $m->comp("/$basedir/config"); <%$title%>: %foreach my $o (@{$conf->{outputs}}){ % my ($display_name, $out_type, $ext) = @$o; % my $base = "$out_type/$id.$ext?key=$key"; <%$display_name%> %} <& "/$basedir/index.html:keyselect", key => $key, id=>$id &> <%$notes%> %# ********************************************* %# end dorow %# ********************************************* %# ********************************************* %# keyselect METHOD %# ********************************************* <%method keyselect> <%args> $key $id %# ********************************************* %# end keyselect %# *********************************************