DEBUG: $msg
"; } // if } // debug function getSongs () { global $songDir; return glob("$songDir/*.pro"); } // getSongs function getSets () { global $songDir; return glob("$songDir/*.lst"); } // getSets function songsDropdown () { $songs = getSongs(); print "
"; print "Songs:  "; print ""; print " "; print "
"; } // songsDropdown function artistsDropdown () { $songs = getSongs(); $artists = getArtists ($songs); print "
"; print "Artists:  "; print ""; print " "; print "
"; } // artistsDropdown function setsDropdown () { $sets = getSets(); print "
"; print "Sets:     "; print ""; print " "; print "
"; } // setsDropdown function getArtist ($song) { $lyrics = file_get_contents ($song); if (preg_match ("/\{(st|subtitle):(.*)\}/", $lyrics, $matches)) { return trim ($matches[2]); } else { return ""; } // if } // getArtist function getArtists ($songs) { $artists = array(); foreach ($songs as $song) { $artist = getArtist ($song); if ($artist != '') { $artists[$artist] = 1; } // if } // foreach return array_keys ($artists); } // getArtists function formatTable ($songs) { echo "
    "; foreach ($songs as $song) { $artist = getArtist ($song); $title = basename ($song, ".pro"); echo "
  1. $title"; if ($artist != "") { echo " ($artist)"; } // if } // foreach echo "
"; } // formatTable