Moved lists back to same folder as songs.
[songbook.git] / web / displayset.php
index 111c43a..6ca458f 100644 (file)
@@ -4,14 +4,14 @@
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
-  <title>Songbook Artist</title>
+  <title>Songbook List</title>
   <link rel="stylesheet" type="text/css" media="screen" href="/css/Music.css">
   <link rel="stylesheet" type="text/css" media="print" href="/css/Print.css">
   <link rel="SHORTCUT ICON" href="http://defaria.com/favicon.ico" type="image/png">
 
 <?php
 include_once "songbook.php";
-$set = $_REQUEST ["set"];
+$set = $_REQUEST["set"];
 ?>
 
 <style>
@@ -31,7 +31,7 @@ width: 100%;
 <div id="content">
 
 <?php
-global $songDir;
+global $songDir, $artists;
 
 print "<ol>";
 
@@ -44,31 +44,41 @@ foreach (file("$songDir/$set") as $line) {
     continue;
   } // if
 
-  if (preg_match ("/(.*)\s+-\s+(.*)/", $line, $matches)) {
-    $song   = trim ($matches[1]);
-    $artist = trim ($matches[2]);
+  if (preg_match("/(.*)\s+-\s+(.*)/", $line, $matches)) {
+    $song   = trim($matches[1]);
+    $artist = trim($matches[2]);
   } else {
-    $song   = trim ($line);
-    $artist = "";
+    $song   = trim($line);
+    $artist = '';
   } // if
 
   if (file_exists ("$songDir/$song.pro")) {
     print "<li><a href=\"webchord.cgi?chordpro=$song.pro\">";
-    print basename ($song);
+    print basename($song);
     print "</a>";
   } else {
     print "<li>";
-    print basename ($song);
-  }
+    print basename($song);
+  } // if
+
+  if ($artist == '') {
+    $artist = getArtist ("$songDir/$song.pro");
+  } // if
+
+  if ($artist != '') {
+    print " - ";
 
-  if ($artist <> "") {
-    print " - <a href=\"displayartist.php?artist=$artist\">$artist</a>";
+    if (in_array ($artist, $artists)) {
+      print "<a href=\"displayartist.php?artist=$artist\">$artist</a>";
+    } else {
+       print $artist;
+    } // if
   } // if
 
   print "</li>";
 } // foreach
 
-print "</okkkl>";
+print "</ol>";
 ?>
 
 </body>