X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=songbook%2Fweb%2Fsongbook.php;h=54d5fea92878848f4e9bd8de482809a77540c8e5;hb=568ef4de0e64eef58b6fa75d5554fffc8d234efe;hp=d43dedd65a681f896ce51446890810ec2a80d850;hpb=92a2b6e641d8149d6c0fb79b671cdacb4c8686b5;p=clearscm.git diff --git a/songbook/web/songbook.php b/songbook/web/songbook.php deleted file mode 120000 index d43dedd..0000000 --- a/songbook/web/songbook.php +++ /dev/null @@ -1 +0,0 @@ -/web/php/songbook/songbook.php \ No newline at end of file diff --git a/songbook/web/songbook.php b/songbook/web/songbook.php new file mode 100644 index 0000000..54d5fea --- /dev/null +++ b/songbook/web/songbook.php @@ -0,0 +1,97 @@ +"; + print "Songs: "; + print ""; + print ""; +} // songsDropdown + +function artistsDropdown () { + global $songs; + + $artists = getArtists ($songs); + + print "
"; +} // artistsDropdown + +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 "