New version
authorAndrew DeFaria <Andrew@DeFaria.com>
Wed, 7 Jun 2017 04:40:32 +0000 (21:40 -0700)
committerAndrew DeFaria <Andrew@DeFaria.com>
Wed, 7 Jun 2017 04:40:32 +0000 (21:40 -0700)
Fixed bugs with handling of globals
Updated displayset.php to only link artists we know about
Sorted set lists

Songs/Andrew's Songs.lst
Songs/Herb Medley.lst
Songs/KARR.lst
Songs/New Songs.lst
Songs/RickSet.lst
web/displayartist.php
web/displayset.php
web/songbook.php

index b3bf2d9..c27e951 100644 (file)
@@ -1,10 +1,11 @@
 Andrew's Songs
 Across the Universe - Beatles
-All You Need Is Love - ohn Lennon/Paul McCartney
+All You Need Is Love - Beatles
 Amie - Pure Prairie League
 Breakdown - Tom Petty
 Brown Eyed Girl - Van Morrison
 Country Road - John Denver
+Daydream Believer - Monkees
 Desperado - The Eagles
 Drugstore Novels - Cast of Shadows
 Fire and Rain - James Taylor
@@ -16,9 +17,10 @@ Here in Heaven - Mike Fraser
 Hold On - Kansas
 Hotel California - Eagles
 I Can See Clearly Now - Johnny Nash or Jimmy Cliff
-I Still Can't Say Goodbye - Chet Atkins
-I'm Your Captain - Grand Funk Railroad
+I'm a Believer - Monkees
 Imagine - John Lennon
+I'm Your Captain - Grand Funk Railroad
+I Still Can't Say Goodbye - Chet Atkins
 Kashmir - Led Zeppelin
 Last Man on Earth - Alice Cooper
 Leather And Lace - Stevie Nicks
@@ -45,7 +47,7 @@ Serenade - Steve Miller
 Sister Golden Hair - America
 Sitting on the Dock of the Bay - Otis Redding
 Space Oddity - David Bowie
-Strong Enough To Win - Mike Fraser
+Strong Enough to Win - Mike Fraser
 Swingtown - Steve Miller
 Take It Easy - Eagles
 Turn the Page - Bob Seager
@@ -56,5 +58,3 @@ Where You Take Me - Jen Hajj
 Who'll Stop The Rain - Creedence Clearwater Revival
 You Ain't Seen Nothing Yet - Backman Turner Overdrive
 Young as You - Mike Fraser
-I'm a Believer - Monkees
-Daydream Believer - Monkees
index 75a9521..49c6c88 100644 (file)
@@ -1,7 +1,7 @@
 Herb Medley
-Panama Red - New Riders of the Purple Sage
-One Toke Over the Line - Brewer and Shipley
-Last Dance with Mary Jane - Tom Petty
 Cherry Bomb - John Mellencamp
-Mellow Yellow - Donovan
 Eight Miles High - The Bryds
+Last Dance with Mary Jane - Tom Petty
+Mellow Yellow - Donovan
+One Toke Over the Line - Brewer and Shipley
+Panama Red - New Riders of the Purple Sage
index 8264c4b..2996dc6 100644 (file)
@@ -1,47 +1,47 @@
 KARR
-Locomotive Breath - Jethro Tull
-Landslide - Fleetwood Mac
-Jenny Jenny - Tommy Tutone
-Norwegian Wood - Beatles
-Peaceful Easy Feeling - Eagles
+All Right Now - Free
 Angel
-The Letter - Joe Cocker
-Sweet Melisa - Allman Brothers
+Badge
+Best of My Love - Eagles
+Blackbird - Beatles
+Bring It on Home
 Can't find My Way Home - Steve Windwood
-Wish You Were Here - Pink Floyd
-From the Beginning - ELP
+Can't You See - Marshall Tucker
+Casey Jones - Grateful Dead
 Drugstore Novels - Cast of Shadows
-Tequila Sunrise - Eagles
-Space Oddity - David Bowie
-Nowhere Man - Beatles
-Seven Bridges Road - Eagles
-Stuck in the Middle With You - Stealers Wheel
-Suite Judy Blue Eyes - Crosby, Stills and Nash
 Dust in the Wind - Kansas
-Badge
 For What It's Worth
-Ramblin' Man - Allman Brothers
-Sister Golden Hair - America
-Take It Easy - Eagles
-Ventura Highway - America
-Wild Nights - Van Morrison
-All Right Now - Free
-Blackbird - Beatles
-Lucky Man - ELP
-Casey Jones - Grateful Dead
-Turn the Page - Bob Segar
+From the Beginning - ELP
 Gold Dust Woman
+Hold On/Your Move - Triumph/Yes
+Jenny Jenny - Tommy Tutone
+Landslide - Fleetwood Mac
+Let It Be - Beatles
+Locomotive Breath - Jethro Tull
+Lucky Man - ELP
 Lying Eyes - Eagles
+Norwegian Wood - Beatles
+Nowhere Man - Beatles
 Panama Red
+Peaceful Easy Feeling - Eagles
+Pink Houses - John Cougar
+Ramblin' Man - Allman Brothers
+Seven Bridges Road - Eagles
+Sister Golden Hair - America
 Something - Beatles
-Best of My Love - Eagles
 Southern Cross
+Space Oddity - David Bowie
+Stuck in the Middle With You - Stealers Wheel
+Suite Judy Blue Eyes - Crosby, Stills and Nash
+Sweet Melisa - Allman Brothers
+Take It Easy - Eagles
+Tequila Sunrise - Eagles
+The Letter - Joe Cocker
 The Weight
-What I Like About You - Romantics
-Let It Be - Beatles
-Pink Houses - John Cougar
-Can't You See - Marshall Tucker
-Wagon Wheel - Darius Rucker
+Turn the Page - Bob Segar
 Under the Boardwalk - Drifters
-Bring It on Home
-Hold On/Your Move - Triumph/Yes
+Ventura Highway - America
+Wagon Wheel - Darius Rucker
+What I Like About You - Romantics
+Wild Nights - Van Morrison
+Wish You Were Here - Pink Floyd
index 84c84d8..94a3c0a 100644 (file)
@@ -1,29 +1,29 @@
 New Songs
-I Can See Clearly Now - Johnny Nash
-California Dreaming - Mama's and the Papa's
-Mrs. Robinson - Simon and Garfunkel
 All You Need is Love - Beatles
-Dr. My Eyes - Jackson Browne
-Crossroads - Cream
-Our House - Crosby, Stills, Nash and Young
-My Back Pages
 Behind Blue Eyes - The Who
-I Can't Tell You Why - Eagles
-Wild World - Cat Stevens
+California Dreaming - Mama's and the Papa's
+Cherry, Cherry - Neil Diamond
 Crazy Love - Poco
+Crossroads - Cream
+Dreams - Molly Hatchet
+Dr. My Eyes - Jackson Browne
 Evil Ways - Santana
+Funk 49 - Joe Walsh
 Harvest Moon - Neil Young
+I Can See Clearly Now - Johnny Nash
+I Can't Tell You Why - Eagles
 Keep On Rockin' Me Baby - Steve Miller
+Mrs. Robinson - Simon and Garfunkel
+My Back Pages
 One of These Nights - Eagles
+One Way Out - Allman Brothers
+Our House - Crosby, Stills, Nash and Young
 Refugee - Tom Petty
 Sandman - America
 Seagull
-You're So Vain - Carly Simon
-What I've Already Heard - Mike Fraser
-Under the Milky Way - The Church
 Stray Cat Strut - Stray Cats
-One Way Out - Allman Brothers
-Dreams - Molly Hatchet
-Funk 49 - Joe Walsh
-Cherry, Cherry - Neil Diamond
 Sweet Caroline - Neil Diamond
+Under the Milky Way - The Church
+What I've Already Heard - Mike Fraser
+Wild World - Cat Stevens
+You're So Vain - Carly Simon
index 989fccd..451f3b7 100644 (file)
@@ -34,4 +34,4 @@ Tuesday Afternoon
 Turn The Page
 Venus
 We Can Work it Out
-Wild Nights
+Wild Nights
\ No newline at end of file
index a99fb5e..1e40ccd 100644 (file)
@@ -24,9 +24,14 @@ $artist = $_REQUEST ["artist"];
 <div id="content">
 
 <?php
+global $songs;
+
 $artistsSongs = array();
 
+debug ("Processing songs");
+
 foreach ($songs as $song) {
+  debug ("Song: $song");
   $songArtist = getArtist ($song);
 
   if ($songArtist == $artist) {
index 111c43a..dbce735 100644 (file)
@@ -31,7 +31,7 @@ width: 100%;
 <div id="content">
 
 <?php
-global $songDir;
+global $songDir, $artists;
 
 print "<ol>";
 
@@ -61,14 +61,18 @@ foreach (file("$songDir/$set") as $line) {
     print basename ($song);
   }
 
-  if ($artist <> "") {
-    print " - <a href=\"displayartist.php?artist=$artist\">$artist</a>";
+  print " - ";
+
+  if (in_array ($artist, $artists)) {
+    print "<a href=\"displayartist.php?artist=$artist\">$artist</a>";
+  } else {
+    print $artist;
   } // if
 
   print "</li>";
 } // foreach
 
-print "</okkkl>";
+print "</ol>";
 ?>
 
 </body>
index cbfe933..113af43 100644 (file)
@@ -3,6 +3,11 @@ $baseDir = getcwd();
 $songDir = "/opt/songbook/Songs";
 $debug   = $_REQUEST["debug"];
 
+// Initialize music objects
+$songs   = getSongs($songDir);
+$sets    = getSets($songDir);
+$artists = getArtists($songs);
+
 function debug ($msg) {
   global $debug;
 
@@ -11,20 +16,16 @@ function debug ($msg) {
   } // 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:&nbsp;&nbsp;";
@@ -48,8 +49,7 @@ function songsDropdown () {
 } // songsDropdown
 
 function artistsDropdown () {
-  $songs = getSongs();
-  $artists = getArtists ($songs);
+  global $artists;
 
   print "<form method=\"get\" action=\"displayartist.php\" name=\"artist\">";
   print "Artists:&nbsp;&nbsp;";
@@ -66,7 +66,7 @@ function artistsDropdown () {
 } // artistsDropdown
 
 function setsDropdown () {
-  $sets = getSets();
+  global $sets;
 
   print "<form method=\"get\" action=\"displayset.php\" name=\"set\">";
   print "Sets:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
@@ -96,8 +96,6 @@ function getArtist ($song) {
 } // getArtist
 
 function getArtists ($songs) {
-  $artists = array();
-
   foreach ($songs as $song) {
     $artist = getArtist ($song);
 
@@ -109,20 +107,3 @@ function getArtists ($songs) {
   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 "&nbsp;($artist)";
-    } // if
-  } // foreach
-
-  echo "</ol>";
-} // formatTable