#!/usr/bin/perl use DB_File; require '/home/rickheit/public_html/dtrad/common.pl'; %arg = &cgi_handle; chdir($dtdir); tie %tle, DB_File, $titldb, O_RDONLY, 0, $DB_HASH; # is there any comment based on tab? if ($arg{'tab'} eq 'w') { # whistle tab $comment = < This notation is pretty simple; dark circles mean covered holes; empty circles mean uncovered holes; a '+' below means to blow harder to get the upper octave; a '#' below means this note is too low for the whistle chosen and you'll have to fake it :) The author of this program always plays accidentals by closing holes, so you'll never see half-covered holes.

When I was starting, I found notation like this to be very helpful, and I know plenty of people who have trouble reading music who find this notation easier. Good luck! EOF } elsif ($arg{'tab'} eq 'd') { # dulcimer tab $comment = </>/g; $lyrics =~ s/(see\s*also\s*)(.*)/$1.&lxref($2)/eig; $lyrics =~ s/(also\s*see\s*)(.*)/$1.&lxref($2)/eig; $lyrics =~ s/(see\s*notes\s*on\s*)(.*)/$1.&lxref($2)/eig; $lyrics = <

$lyrics
EOF } # format the score(s) for $tn (split(/;/, $arg{'tt'})) { $key = ''; @avail = (); # figure out the key for a whistle if ($arg{'tab'} eq 'w') { unless ($key = $arg{'key'}) { # we need to figure the default whistle key from the tune $buf = `$gettune $tn`; # look for a key signature if ($buf =~ /\nK-\s*([A-G][b#s]?)/) { $key = $1; # turn the key read into the key chosen # (this duplicates (mas o menos) the logic from swtowhis) %trk = ( 'Cb' => 'Gb', 'Db' => 'Ab', 'Eb' => 'Bb', 'F' => 'C', 'G' => 'D', 'A' => 'E', 'B' => 'F#', 'C#' => 'G#', 'D#' => 'A#', 'E#' => 'B#') unless %trk; $key = $trk{$key} if defined($trk{$key}); $key =~ s/#/s/g; } } ($k = $key) =~ s/s/#/g; $notes = "

($k whistle)

\n"; # extra links available for a whistle score $extra = <(Choose a whistle key: A B C D E F G Ab Bb Cb Db Eb Fb Gb A# B# C# D# E# F# G#) EOF } else { push @avail, <Pennywhistle notation EOF } # figure out the key for dulcimer if ($arg{'tab'} eq 'd') { if ($arg{'ds1'}) { $key = "$arg{'ds3'}$arg{'ds2'}$arg{'ds1'}"; $k = "$arg{'ds1'}$arg{'ds2'}$arg{'ds3'}"; } else { # no fakes yet. $key = "EBD"; $k = "DBE"; } $k =~ tr/st/#b/; $notes = "

($k tuning)

\n"; # extra links available for a whistle score $extra = <(another tuning) EOF $moretypes = <Text tab, EOF } else { push @avail, <Dulcimer tab EOF } $key = "-$key" if $key; # is there an MPEG available? if ($s = -s "$dtdir/mp2/$tn.mp2") { $s = int($s/1024); push @avail, <MPEG audio $s K. EOF } # format that avail string $avail = ''; if (@avail) { $avail = "
"; for $i (0..$#avail) { if ($i) { if ($i == $#avail) { $avail .= "and "; } else { $avail .= ", "; } } $avail .= $avail[$i]; } $avail .= " for this song is also available"; } if ($score) { $score .= "

(alternate:)
\n"; } $score .= <

(This score available as $moretypes ABC, SongWright, PostScript, PNG, or PMW, or a MIDI file) $extra $avail EOF # have we come up with a title? unless ($title) { $title = $tle{"tn$tn"}; } } # no song at all? if ($score =~ /^\s*$/ && $lyrics =~ /^\s*$/) { print "Location: $sdtpath/index.html\n\n"; exit 0; } print <$title

Digital Tradition Mirror

$comment

$title

$score $lyrics

Thanks to Mudcat for the Digital Tradition!

Contents: ? A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Main Page
EOF sub lxref { local($b) = @_; tie %songpos, DB_File, $songdb, O_RDONLY, 0, $DB_HASH; tie %tunepos, DB_File, $tunedb, O_RDONLY, 0, $DB_HASH; $b =~ s/[A-Z0-9\.]+[A-Z0-9]/&seals($&)/eg; untie %songpos; untie %tunepos; return $b; } sub seals { local($ti, $tle) = @_; local($aft, $m, $u, $title); $aft = ''; if ($songpos{$ti}) { $m = "ti=$ti"; } elsif ($tunepos{$ti}) { $m = "tt=$ti"; } elsif ($ti =~ s/\..*$//) { $aft = $&; if ($songpos{$ti}) { $m = "ti=$ti"; } elsif ($tunepos{$ti}) { $m = "tt=$ti"; } else { return "$ti$aft"; } } else { return $ti; } $u = `grep -E '$m([^A-Z0-9]|\$)' $dtdir/keep/titles`; $u =~ s/\s*$//; $u =~ s/\s*\t.*$//; $u =~ s/;/;tt/g; $u =~ s/\&*(t.)=/;$1/g; $u =~ s/^;//; if ($u =~ /ti([^&;]*)/) { $title = $tle{"ti$1"}; } if (!$title && $u =~ /tn([^&;]*)/) { $title = $tle{"ti$1"}; } if (!$title) { $title = $ti; } return qq($title$aft); } sub cgi_handle { local(@a); if ($ENV{'REQUEST_METHOD'} eq 'POST') { ($stuff = <>) =~ s/^\s*|\s*$//g; } else { $stuff = $ENV{'QUERY_STRING'}; } @a = split(/[\&\=]/, $stuff); for (@a) { s/\+/ /g; s/%(..)/sprintf("%c", hex($1))/eg; } return @a; } # Turns HTML-illegal characters into their cute little ol' coding. sub fixch { $_[0] =~ s/\W/'%'.sprintf('%02X', ord($&))/eg; }