$songDir = "/opt/songbook/Songs";
$debug = $_REQUEST["debug"];
+// Initialize music objects
+$songs = getSongs($songDir);
+$sets = getSets($songDir);
+$artists = getArtists($songs);
+
function debug ($msg) {
global $debug;
} // if
} // debug
-function getSongs () {
- global $songDir;
-
+function getSongs ($songDir) {
return glob("$songDir/*.pro");
} // getSongs
-function getSets () {
- global $songDir;
-
+function getSets ($songDir) {
return glob("$songDir/*.lst");
} // getSets
function songsDropdown () {
- $songs = getSongs();
+ global $songs;
print "<form method=\"get\" action=\"webchord.cgi\" name=\"song\">";
print "Songs: ";
} // songsDropdown
function artistsDropdown () {
- $songs = getSongs();
- $artists = getArtists ($songs);
+ global $artists;
print "<form method=\"get\" action=\"displayartist.php\" name=\"artist\">";
print "Artists: ";
} // artistsDropdown
function setsDropdown () {
- $sets = getSets();
+ global $sets;
print "<form method=\"get\" action=\"displayset.php\" name=\"set\">";
print "Sets: ";
} // getArtist
function getArtists ($songs) {
- $artists = array();
-
foreach ($songs as $song) {
$artist = getArtist ($song);
return array_keys ($artists);
} // getArtists
-function formatTable ($songs) {
- echo "<ol>";
-
- foreach ($songs as $song) {
- $artist = getArtist ($song);
-
- $title = basename ($song, ".pro");
-
- echo "<li><a href=\"webchord.cgi?chordpro=$song\">$title</a>";
-
- if ($artist != "") {
- echo " ($artist)";
- } // if
- } // foreach
-
- echo "</ol>";
-} // formatTable