diff -Naur 092402/gjukebox/NEWS genremod.offof092402/gjukebox/NEWS
--- 092402/gjukebox/NEWS	Sun Sep  8 11:49:36 2002
+++ genremod.offof092402/gjukebox/NEWS	Tue Sep 24 15:17:20 2002
@@ -1,5 +1,11 @@
 Version 4.1pre4
 
+2002-09-24 ejs: Added Varible for Ogg Quality Level
+2002-09-24 ejs: Added Genre,Year, and comment support
+2002-09-24 ejs: Added Strict Exclude Option
+2002-09-24 ejs: Bugfix for getpictures.pl
+2002-09-24 ejs: Added Ogg Import support.
+		WARNING: addmp3id3.pl is now import.pl
 2002-09-08 kdw: Added the setting for coverclick-behaviour.
 2002-09-08 kdw: Bugfix regarding type-conversion in some php-versions.
 2002-09-01 kdw:	The personal and global settings have now an specific sort-order.
diff -Naur 092402/gjukebox/README genremod.offof092402/gjukebox/README
--- 092402/gjukebox/README	Sat Jul  6 17:55:53 2002
+++ genremod.offof092402/gjukebox/README	Tue Sep 24 13:00:50 2002
@@ -13,6 +13,17 @@
 2Mb of size. This is set in the php.ini or php3.inic file. Both of the can
 usually be found in /etc, /etc/httpd/cond or /usr/local/lib.
 
+OGG
+===
+
+If you would like to encode ripped CD's directly to OGG instead of MP3,
+Once you have the Jukebox up and running log in as an administrator.
+
+Go to Administrate -> Conversion Programs 
+1.) change the priority of wav to mp3 to -100 
+2.) change the priority of wav to ogg to 30 
+
+
 Intellectual property
 =====================
 If you use the Jukebox to play music for larger groups you are usually required
diff -Naur 092402/gjukebox/SCRIPTS genremod.offof092402/gjukebox/SCRIPTS
--- 092402/gjukebox/SCRIPTS	Mon Oct 29 16:27:09 2001
+++ genremod.offof092402/gjukebox/SCRIPTS	Tue Sep 24 11:02:13 2002
@@ -18,11 +18,14 @@
 		all initial "The" to the end (Eg "The Man" becomes "Man, The")
 		so the songs end up under the initial character you suspect
 		them to be under.
-addmp3id3.pl    Search the specified directories or files recursively for files
-		ending in .mp3 and containing ID3 tags and then adding them
-		into the jukebox based on that information. This program will
-		only be available if you have mp3id3 installed.
-createalbums.pl Create albums for songs loaded by addmp3id3.pl. Use with -h to
+import.pl       Search the specified directories or files recursively for files
+                ending in .mp3 or .ogg and containing comment tags and then 
+                adding them into the jukebox based on that information.
+                This program has a few options run it with -h for mor infomation. 
+                Ogg import requires ogginfo, mp3 import requires mp3id3. 
+                Very handy for importing huge directories of existing mp3 and ogg
+                files into the database.
+createalbums.pl Create albums for songs loaded by import.pl. Use with -h to
 		get short list with options.
 setmp3id3.pl    Set the ID3 tags of the songs added in the Jukebox according to
 		the contents of the database content. Specifying any options
diff -Naur 092402/gjukebox/TODO genremod.offof092402/gjukebox/TODO
--- 092402/gjukebox/TODO	Sun Dec 16 17:14:41 2001
+++ genremod.offof092402/gjukebox/TODO	Tue Sep 24 11:02:13 2002
@@ -7,4 +7,4 @@
 Write CD:s using cdroast.
 Create RPM of Jukebox.
 Automatic format detection when adding songs through interface.
-Check tracknumber on all duplicate checks not only addmp3id3.
+Check tracknumber on all duplicate checks not only import.
diff -Naur 092402/gjukebox/scripts/addmp3id3.pl genremod.offof092402/gjukebox/scripts/addmp3id3.pl
--- 092402/gjukebox/scripts/addmp3id3.pl	Wed Jul  3 02:52:55 2002
+++ genremod.offof092402/gjukebox/scripts/addmp3id3.pl	Wed Dec 31 18:00:00 1969
@@ -1,162 +0,0 @@
-# ====================================================================
-# Copyright (c) 1999 GlobeCom GCAB AB.  All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer. 
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in
-#    the documentation and/or other materials provided with the
-#    distribution.
-#
-# 3. All advertising materials mentioning features or use of this
-#    software must display the following acknowledgment:
-#    "This product includes software developed by GlobeCom GCAB AB
-#    <http://www.globecom.net/> for use in GlobeCom Jukebox."
-#
-# 4. The names "GlobeCom Jukebox" and "GlobeCom" must not be used to
-#    endorse or promote products derived from this software without
-#    prior written permission. For written permission, please contact
-#    hpj@globecom.net.
-#
-# 5. Products derived from this software may not be called "GlobeCom
-#    Jukebox" nor may "GlobeCom" appear in their names without prior written
-#    permission of the GlobeCom GCAB AB.
-#
-# 6. Redistributions of any form whatsoever must retain the following
-#    acknowledgment:
-#    "This product includes software developed by GlobeCom GCAB AB
-#    <http://www.globecom.net/> for use in GlobeCom Jukebox."
-#
-# THIS SOFTWARE IS PROVIDED BY GLOBECOM GCAB AB ``AS IS'' AND ANY
-# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GLOBECOM GCAB AB OR
-# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE.
-# ====================================================================
-
-use strict;
-use defsjukebox; # Get the settings entered by the user during configuration
-use DBI;
-use MPEG::MP3Info;
-use File::Find ();
-use File::stat;
-use File::Basename;
-
-my $dbh=DBI->connect("dbi:mysql:database=$DBNAME;hostname=$DBSERVER",$DBUSER,$DBPASS) || die;
-
-my $titlefromfile=0; # set to true and the name of the song ( but not artist & album ) is taken from the mp3 filename instead of the mp3id3.
-
-# Check command line options.
-# The "-forceupdate" allows user to force a database entry (if it exists)
-# to be updated from the mp3 ID3 tag of the file.
-my $forceupdate=0;
-if ($ARGV[0]&&$ARGV[0] eq "-forceupdate") {
-    $forceupdate=1;
-    shift @ARGV
-}
-
-# Traverse desired filesystems
-
-my $add=$dbh->prepare("insert into songs (artist,title,volume,file,played,voted,toplist,lastplayed,entered,format,trackno,volid) ".
-		      "values (?,?,?,?,0,0,0,from_unixtime(?),from_unixtime(?),'mp3',?,?)");
-my $dup=$dbh->prepare("select count(*) from songs where (upper(artist) = upper(?) and upper(title) = upper(?)\n".
-		      "   and upper(volume) = upper(?) and (trackno is null or trackno = ? or ? is null)) or file = ?");
-my $dupsong=$dbh->prepare("select id from songs where file = (?)");
-my $modify=$dbh->prepare("update songs set artist = (?), title = (?), volume = (?), trackno = (?) where id = (?)");
-my $rip=$dbh->prepare("insert into ripqueue values (0,?,'mp3','analyse',?,?,?,?,0,'',?,NULL)");
-
-my $vol=$dbh->prepare("select id,mounted from volumes where (flags&2)=2 and length(mounted)>1");
-$vol->execute();
-my %validVol;
-while(my ($volid,$mount)=$vol->fetchrow_array()) {
-    $validVol{$volid}=$mount;
-}
-
-sub addit {
-    my ($name)=@_;
-    my $info=get_mp3tag($name);
-    my $artist=$info->{ARTIST};
-    my $title=$info->{TITLE};
-    my $album=$info->{ALBUM};
-    my $trackno=$info->{TRACKNUM};
-    my $stats=stat($name);
-
-    $title = basename($name, ".mp3") if $titlefromfile;  # JBM - sometimes the filename is a better title due to length limits on mp3id3
-
-    while($name=~s/\/\.\//\//) {
-
-    }
-
-    if ($artist&&$title) {
-	my $now=time;
-	$dup->execute($artist,$title,$album,$trackno,$trackno,$name);
-	my ($count)=$dup->fetchrow_array;
-	if ($count==0) {
-
-	    my $volid;
-	    my $maxSiz=0;
-
-	    for my $nvol (keys %validVol) {
-		my $base=$validVol{$nvol};
-		if (substr($name,0,length($base)) eq $base) {
-		    if ($maxSiz<length($base)) {
-			$maxSiz=length($base);
-			$volid=$nvol;
-			$name=substr($name,$maxSiz);
-			$name=~s/^\///;
-		    }
-		}
-	    }	    
-
-	    print "$artist - $title - $album - ".$validVol{$volid}." - $name\n";
-	    $add->execute($artist,$title,$album,$name,$stats->mtime,$stats->mtime,$trackno,$volid,);
-	    my $songid=$add->{'mysql_insertid'};
-	    $rip->execute($songid,$artist,$title,$album,$name,$trackno);
-	} else {
-          if ( $forceupdate ) {
-            # this file is already in database, we will
-            # update the entry according to the mp3 tag...
-            $dupsong->execute($name);
-            my ($songid)=$dupsong->fetchrow_array;
-            if ( $songid > 0 ) {
-              print "Updating: $artist - $title - $album - $name\n";
-              $modify->execute($artist,$title,$album,$trackno,$songid);
-            }
-          }
-        }
-    }
-    return 0;
-}
-
-my $pwd=`pwd`;
-chomp($pwd);
-
-push(@ARGV,$pwd)
-    if (!@ARGV);
-
-for my $a (@ARGV) {
-    if ($a=~/^\//) {
-	&File::Find::find({wanted => \&wanted, follow => 1},$a);
-    } else {
-	&File::Find::find({wanted => \&wanted, follow => 1},$pwd."/".$a);
-    }
-}
-
-exit;
-no strict;
-sub wanted {
-    /^.*\.[mM][pP]3$/ &&
-	addit($File::Find::name);
-}
diff -Naur 092402/gjukebox/scripts/difvol.pl genremod.offof092402/gjukebox/scripts/difvol.pl
--- 092402/gjukebox/scripts/difvol.pl	Wed Jul  3 02:52:55 2002
+++ genremod.offof092402/gjukebox/scripts/difvol.pl	Tue Sep 24 14:43:59 2002
@@ -127,9 +127,9 @@
 
     {
 	my %info;
-	my $res=$dbh->prepare("select artist,title,volume,trackno from songs where id = $id");
+	my $res=$dbh->prepare("select artist,title,volume,trackno,year,comment,genre from songs where id = $id");
 	$res->execute();
-	my ($artist,$title,$volume,$trackno)=$res->fetchrow_array;
+	my ($artist,$title,$volume,$trackno,$year,$comment,$genreid)=$res->fetchrow_array;
 	if ($artist) {
 	    $info{ARTIST}=$artist;
 	}
@@ -142,10 +142,17 @@
 	if ($trackno) {
 	    $info{TRACKNUM}=$trackno;
 	}
-	$info{YEAR}="";
-	$info{COMMENT}="";
-	$info{GENRE}="";
-
+	if ($comment) {
+		$info{COMMENT}=$comment;
+		}
+	if ($year) {
+		$info{YEAR}=$year;
+		}
+	if ($genreid) {
+		$res=$dbh->prepare("select name from genre where id=$genreid");
+		$res->execute();
+		($info{GENRE})=$res->fetchrow_array();
+		}
 	if (defined %info&&-w $file) {
 	    set_mp3tag($file,\%info);
 	}
@@ -169,7 +176,7 @@
 	    syswrite(POUT,$var,length($var));
 	}
 
-	close PIN;
+	close PING;
 	exit 1
 	    if ($?>>8);
 	close POUT;
diff -Naur 092402/gjukebox/scripts/encodeogg.pl genremod.offof092402/gjukebox/scripts/encodeogg.pl
--- 092402/gjukebox/scripts/encodeogg.pl	Wed Aug 21 16:18:44 2002
+++ genremod.offof092402/gjukebox/scripts/encodeogg.pl	Tue Sep 24 15:01:20 2002
@@ -76,11 +76,12 @@
 
 my $lper=0;
 my $done=100;
+my $quality=fetchsetting("OGGQUALITY");
 
 #start encoding
 open(INPUT,"-|") || do {
     open(STDERR,">&STDOUT");
-    exec ($NICE,"-n","19",$OGGENC,"-q","8","-o",$outfile,$infile) || die "Couldn't encode $infile to ogg";
+    exec ($NICE,"-n","19",$OGGENC,"-q",$quality,"-o",$outfile,$infile) || die "Couldn't encode $infile to ogg";
 };
 
 # catch percent done
diff -Naur 092402/gjukebox/scripts/getnextmp3.pl genremod.offof092402/gjukebox/scripts/getnextmp3.pl
--- 092402/gjukebox/scripts/getnextmp3.pl	Sat Aug 31 17:26:24 2002
+++ genremod.offof092402/gjukebox/scripts/getnextmp3.pl	Tue Sep 24 12:06:40 2002
@@ -274,6 +274,7 @@
 my $slowtmp=fetchsetting("SLOWTMP");
 my $slowpre=fetchsetting("SLOWPRE");
 my $slowskip=fetchsetting("SLOWSKIP");
+my $strictexclude=fetchsetting("STRICTEXCLUDE");
 
 $dbh->do("delete from queue where queue.pri = 0 and user $queue");
 $dbh->do("update settings set value = 0 where name = 'SONGLEN'");
@@ -331,6 +332,21 @@
 		$dbh->do("delete from queue where queueid = ".$queueid);
 	    }
 	}
+	# This section checks to see if the song about to play is in an exclude list.
+        # And Removes it.
+        if($strictexclude){
+                my $eres=$dbh->prepare("select id from groups where enable = '-1000000'");
+                $eres->execute();
+                while( my ($grpid)=$eres->fetchrow_array){
+                        my $eres2=$dbh->prepare("select groupid from groupmember where groupid = '$grpid' and songid = '$id'");
+                        $eres2->execute();
+                        if(my ($testid)=$eres2->fetchrow_array){
+                                $dbh->do("delete from queue where queueid = ".$queueid);
+                                $continue=1;
+                                }
+                        }
+                }
+        #
 	if (!$continue) {
 	    $dbh->do('update queue set pri = 0 where queueid = '.$queueid);
 	    if ($id>=0) {
diff -Naur 092402/gjukebox/scripts/getpictures.pl genremod.offof092402/gjukebox/scripts/getpictures.pl
--- 092402/gjukebox/scripts/getpictures.pl	Wed Jul  3 02:52:55 2002
+++ genremod.offof092402/gjukebox/scripts/getpictures.pl	Tue Sep 24 11:00:33 2002
@@ -298,7 +298,9 @@
 
 sub stripthe {
     my ($str)=@_;
+    my $saved_str=$str;
     $str=~s/(\.,)?(the)$//i;
+    $str =~ s/^(\s+|)$/$saved_str/g;  #If we have an empty string then restore what we're given
     return $str;
 }
 
diff -Naur 092402/gjukebox/scripts/import.pl genremod.offof092402/gjukebox/scripts/import.pl
--- 092402/gjukebox/scripts/import.pl	Wed Dec 31 18:00:00 1969
+++ genremod.offof092402/gjukebox/scripts/import.pl	Fri Sep  6 22:52:21 2002
@@ -0,0 +1,304 @@
+# ====================================================================
+# Copyright (c) 1999 GlobeCom GCAB AB.  All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. All advertising materials mentioning features or use of this
+#    software must display the following acknowledgment:
+#    "This product includes software developed by GlobeCom GCAB AB
+#    <http://www.globecom.net/> for use in GlobeCom Jukebox."
+#
+# 4. The names "GlobeCom Jukebox" and "GlobeCom" must not be used to
+#    endorse or promote products derived from this software without
+#    prior written permission. For written permission, please contact
+#    hpj@globecom.net.
+#
+# 5. Products derived from this software may not be called "GlobeCom
+#    Jukebox" nor may "GlobeCom" appear in their names without prior written
+#    permission of the GlobeCom GCAB AB.
+#
+# 6. Redistributions of any form whatsoever must retain the following
+#    acknowledgment:
+#    "Thsis product includes software developed by GlobeCom GCAB AB
+#    <http://www.globecom.net/> for use in GlobeCom Jukebox."
+#
+# THIS SOFTWARE IS PROVIDED BY GLOBECOM GCAB AB ``AS IS'' AND ANY
+# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GLOBECOM GCAB AB OR
+# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+# ====================================================================
+use strict;
+use defsjukebox; # Get the settings entered by the user during configuration
+use DBI;
+use File::Find ();
+use File::Basename;
+
+
+#set up default values
+my $dontadd =  0; #Set to 1 when we don't want to actaully add stuff (i.e. working on the script)
+my $forceupdate=0; #Force the update of the db from the mp3tags of files found.
+my $titlefromfile = 0;  # Set to true and the name of the song ( but not artist & album ) is taken from the filename instead of the mp3id3.
+			#	Warning, it takes the fullname of the file so jimmy pop - popcorn.mp3 would have a new TITLE of jimmy pop - popcorn
+			#	Use with caution.
+my $dontaddgenres = 0;
+my @dirs;
+my $oggenabled=1;
+my $mp3enabled=1;
+
+#Parse the command line.
+foreach my $param (@ARGV) {
+	if($param eq "-forceupdate"){
+		print "WARNING: Force Update is enabled. All songs found will have their DB entries updated.\n";
+		$forceupdate=1;
+		}
+	elsif($param eq "-titlefromfile"){
+		print "WARNING: Title From File is enabled. Song Title will be the name of the file and not from the comment tags.";
+		$titlefromfile=1;
+		}
+	elsif($param eq "-dontadd"){
+		print "WARNING: Don\'t add is enabled. Songs will not be added to DB.\n";
+		$dontadd = 1;
+		}
+	elsif($param eq "-noogg"){
+		print "WARNING: Ogg support manually Disabled.\n";
+		$oggenabled=0;
+		}
+	elsif($param eq "-nomp3"){
+		print "WARNING: mp3 support manually Disabled.\n";
+		$mp3enabled=0;
+		}
+	elsif($param eq "-dontaddgenre"){
+                print "WARNING: Don't add Genre's is enabled.Genre's will not be added to the DB.\n";
+                $dontaddgenres=1;
+                }
+	elsif($param eq "-h"){
+		print "Usage: import.pl [-dontadd] [-titlefromfile] [-forceupdate] [-noogg] [-nomp3] [dir1] [dir2] [dir3] ...\n";
+		print "\n\t-dontadd\tDon't actually add the files to the database, just show what would be done.\n";
+		print "\n\t-dontaddgenre\tDon't automatically add new genres to the db.(will still set song genre if already exists.\n";
+		print "\n\t-titlefromfile\tThe name of the song ( but not artist & album ) is taken from the filename instead of the mp3id3.\n";
+		print "\t\t\tWarning, it takes the fullname of the file so jimmy pop - popcorn.mp3 would have a new\n";
+		print "\t\t\tTITLE of jimmy pop - popcorn so use with caution.\n";
+		print "\n\t-forceupdate\tAll Duplicate files are forced to update the Database from the comment tags in the files.\n";
+		print "\n\t-nomp3\t\tDon't parse mp3 files.\n";
+		print "\n\t-noogg\t\tDon't parse ogg files.\n";
+		print "\n\tdir1,dir2..\tThe directories to search for valid files. (default is current directory)\n\n\n";
+		exit(1);
+		}	
+	else{
+		push(@dirs,$param);
+		}
+	}
+
+
+#check to make sure we're set up to import these file formats.
+if ($oggenabled&&$OGGINFO){
+	$oggenabled=1;
+	print "Ogg Import Enabled...\n";
+	}
+else{$oggenabled=0;}
+if ($mp3enabled&&$MPG123){
+	use MPEG::MP3Info;
+	print "MP3 Import Enabled...\n";
+	$mp3enabled=1;
+	}
+else{$mp3enabled=0;}
+	
+# Connect to the databse and prep the statements we'll use.
+my $dbh=DBI->connect("dbi:mysql:database=$DBNAME",$DBUSER,$DBPASS) || die;
+my $addsong=$dbh->prepare("insert into songs (artist,title,volume,file,played,voted,toplist,lastplayed,entered,format,trackno,volid,year,comment,genre) values (?,?,?,?,0,0,0,now(),now(),?,?,?,?,?,?)");
+my $findduplicate=$dbh->prepare("select count(*) from songs where (upper(artist) = upper(?) and upper(title) = upper(?) and upper(volume) = upper(?) and (trackno is null or trackno = ? or ? is null)) or file = ?");
+my $analysemp3=$dbh->prepare("insert into ripqueue values (0,?,'mp3','analyse',?,?,?,?,0,'',?,NULL,?,?,?)");
+my $getsongid=$dbh->prepare("select id from songs where file = (?)");
+my $updatesonginfo=$dbh->prepare("update songs set artist = (?), title = (?), volume = (?), trackno = (?), year = (?), comment = (?) where id = (?)");
+my $findgenre=$dbh->prepare("select id from genre where upper(name) = upper(?)");
+my $addgenre=$dbh->prepare("insert into genre (name) values (?)");
+
+# Create a list of Valid Volumes stored in the validVol Hash
+my $vol=$dbh->prepare("select id,mounted from volumes where (flags&2)=2 and length(mounted)>1");
+$vol->execute();
+my %validVol;
+while(my ($volid,$mount)=$vol->fetchrow_array()) {
+    $validVol{$volid}=$mount;
+}
+
+
+#Get the Current Directory
+my $pwd=`pwd`;
+chomp($pwd);
+#Use the Current Directory if no directory is specified.
+if (!@dirs){
+	push(@dirs,$pwd);
+	print "No Directory Given, current dir assumed. (use -h for command line options)\n";
+	}
+
+# Traverse desired filesystems
+for my $a (@dirs) {
+    if ($a=~/^\//) {
+	&File::Find::find({wanted => \&parsefile, follow => 1},$a);
+    } else {
+	&File::Find::find({wanted => \&parsefile, follow => 1},$pwd."/".$a);
+    }
+}
+
+exit;
+
+#Routine called on each file found in specified directory 
+sub parsefile {
+    /^.*\.mp3$/i && $mp3enabled && addfile("mp3",$File::Find::name); # If it's an MP3 file then run addmp3 to add it.
+    /^.*\.ogg$/i && $oggenabled && addfile("ogg",$File::Find::name); # If it's an OGG file then run addogg to add it.
+}
+
+#Routine to add a file to the db (actaully it's the main add function.)
+sub addfile {
+	my ($mode,$name)=@_;
+	#Get Song Header Information.
+	my ($title,$artist,$album,$tracknumber,$date,$genre,$comment);
+	if($mode eq "mp3"){($title,$artist,$album,$tracknumber,$date,$genre,$comment) = getmp3info($name);}
+	elsif($mode eq "ogg"){($title,$artist,$album,$tracknumber,$date,$genre,$comment) = getogginfo($name);}
+	$title = basename($name, ".$mode") if $titlefromfile;  # JBM - sometimes the filename is a better title due to length limits on mp3id3
+	$name=~s/\/\.\//\//g; # Replaces /./ with / ... why /./ would appear I don't know.
+	if ($artist&&$title) {
+		#Check to see if the song is already in the db.
+		$findduplicate->execute($artist,$title,$album,$tracknumber,$tracknumber,$name);
+		my ($count)=$findduplicate->fetchrow_array;
+		if ($count==0) {#This is a unique song so lets add it.
+			#Check to see if it's on a volume already.		
+			my $volumeid;
+			($volumeid,$name)=findvolume($name);
+			#Figure out it's Genreid (and add the genre if allowed).
+			my $genreid = findgenre($genre);
+			#Here we actually add the file to the DB.
+			if($mode eq "mp3"){addmp3($name,$volumeid,$title,$artist,$album,$tracknumber,$date,$genreid,$comment);}
+			elsif($mode eq "ogg"){addogg($name,$volumeid,$title,$artist,$album,$tracknumber,$date,$genreid,$comment);}
+			#Be nice and print a happy message.
+			print "Adding: $artist - $title - $album \n        $genre - $date - $comment \n        - ".$validVol{$volumeid}." - $name\n";
+	    	}
+       		else{
+       			if($forceupdate){
+       				$getsongid->execute($name);
+            			my ($songid)=$getsongid->fetchrow_array;
+            			if ( $songid > 0 ) {
+              				print "Updating: $artist - $title - $album - $name\n";
+              				if(!$dontadd){
+              					$updatesonginfo->execute($artist,$title,$album,$tracknumber,$date,$comment,$songid);
+              					}
+              				}
+       				}
+       			else{print "Duplicate song found (Not Added): $name\n";}
+       			}
+       		}
+    	else{print "Title or Artist Missing (Not Added): $name\n";}
+	return 0;
+	}
+
+		
+#This Routine checks to see if the file is already on a volume
+# and adds it to that volume.
+sub findvolume{
+	my ($name)=@_;
+	my $maxSiz=0;
+	my $volid;
+	for my $nvol (keys %validVol) {
+		my $base=$validVol{$nvol};
+		if (substr($name,0,length($base)) eq $base) {
+			if ($maxSiz<length($base)) {
+				$maxSiz=length($base);
+				$volid=$nvol;
+				$name=substr($name,$maxSiz);
+				$name=~s/^\///;
+	    			}
+			}
+   		}
+	return($volid,$name);
+	}
+
+#Gets the info from an ogg file
+sub getogginfo{
+	my ($name)=@_;
+	#Get the comments field of the ogg file and parse it.
+	open(OGGINFO,"$OGGINFO $name|");
+	my ($var,$value,$title,$artist,$album,$tracknumber,$date,$genre,$comment);
+	while(<OGGINFO>){
+		if($_ =~ m/(title||artist||album||tracknumber||date||genre)=(.*?)$/i){
+			$var=$1;
+			$value=$2;
+			chomp($var);
+			chomp($value);
+			$var =~ tr/A-Z/a-z/; #make lowercase.
+			if($var eq "title"){$title=$value;}
+			elsif($var eq "artist"){$artist=$value;}
+			elsif($var eq "album"){$album=$value;}
+			elsif($var eq "tracknumber"){$tracknumber=$value;}
+			elsif($var eq "date"){$date=$value;}
+			elsif($var eq "genre"){$genre=$value;}
+			elsif($var eq "comment"){$comment=$value;}
+			}
+		}
+	close(OGGINFO);
+	return($title,$artist,$album,$tracknumber,$date,$genre,$comment);
+	}
+
+
+#add an OGG file to the db.
+sub addogg {
+	my ($name,$volumeid,$title,$artist,$album,$tracknumber,$date,$genreid,$comment) = @_;
+	if(!$dontadd){
+		$addsong->execute($artist,$title,$album,$name,'ogg',$tracknumber,$volumeid,$date,$comment,$genreid);
+		}
+	}
+
+#Gets the info from an mp3 file
+sub getmp3info{
+	my ($name) = @_;
+	
+	# Get and parse all of the mp3tag.
+	my $info=get_mp3tag($name);
+	my $artist=$info->{ARTIST};
+	my $title=$info->{TITLE};
+	my $album=$info->{ALBUM};
+	my $genre=$info->{GENRE};
+	my $date=$info->{YEAR};
+	my $tracknumber=$info->{TRACKNUM};
+	my $comment=$info->{COMMENT};
+	return($title,$artist,$album,$tracknumber,$date,$genre,$comment);
+	}
+
+#add an MP3 to the db.
+sub addmp3 {
+	my ($name,$volumeid,$title,$artist,$album,$tracknumber,$date,$genreid,$comment) = @_;
+	if(!$dontadd){
+		$addsong->execute($artist,$title,$album,$name,'mp3',$tracknumber,$volumeid,$date,$comment,$genreid);
+	    	my $songid=$addsong->{'mysql_insertid'};
+	    	$analysemp3->execute($songid,$artist,$title,$album,$name,$tracknumber,$genreid,$date,$comment);
+		}
+	}
+
+sub findgenre {
+	my ($genre) = @_;
+	$findgenre->execute($genre);
+	my ($genreid)=$findgenre->fetchrow_array;
+	if (!$genreid&&!$dontaddgenres){
+		$addgenre->execute($genre);
+		$genreid=$addgenre->{'mysql_insertid'};
+		print "Adding Genre $genre";
+		}
+	return($genreid);
+	}
diff -Naur 092402/gjukebox/scripts/install.pl genremod.offof092402/gjukebox/scripts/install.pl
--- 092402/gjukebox/scripts/install.pl	Sun Sep  8 10:20:23 2002
+++ genremod.offof092402/gjukebox/scripts/install.pl	Tue Sep 24 13:57:12 2002
@@ -81,6 +81,7 @@
 	   "MPG123" => "mpg123",
 	   "OGG123" => "ogg123",
 	   "OGGENC" => "oggenc",
+	   "OGGINFO" => "ogginfo",
 	   "MYSQL" => "mysql",
 	   "MYSQLADMIN" => "mysqladmin",
 	   "ATQ" => "atq",
@@ -101,7 +102,7 @@
 	  "*mixer",
 	  "-jukebox",            # Shell prog
 	  "-jukebox.vanilla",    # Shell prog
-	  "addmp3id3.pl",
+	  "import.pl",
 	  "createalbums.pl",
 	  "difvol.pl",
 	  "download.pl",
@@ -596,6 +597,8 @@
 	system("chmod","a+x","$binbase/$prog");
     }
 }
+if ( -e "$binbase/addmp3id3.pl" ) { unlink "$binbase/addmp3id3.pl";}
+symlink ("$binbase/import.pl","$binbase/addmp3id3.pl");
 
 print "Installing webpages to $webbase\n";
 my $at=$paths{AT};
@@ -747,8 +750,6 @@
 	print "ERROR: This database doesn't seem to be a GlobeCom Jukebox database\n";
 	exit 2;
     }
-    undef $res;
-    $dbh->disconnect;
     print "Database seems to exist, checking for updates for $version\n";
     opendir(SQL,"sql") || die "Can't open sql/ directory";
     my @files;
@@ -760,11 +761,22 @@
 	}
     }
     closedir(SQL);
+    $rootpass =~ m/^-p(.*?)$/;
+    my $rootpassnop = $1;
     @files=sort(@files);
     for my $file (@files) {
 	print ("Running $file\n");
 	system("$MYSQL -u$root -h$dbserver $rootpass -B $dbname -f < sql/$file");
-    }
+    	# Run a .pl update file if it exists.
+	$file =~ m/^update(\d*).sql$/;
+	my $plfile = "sql/update$1.pl";
+	if( -e $plfile){
+		system("$PERL $plfile $dbserver $dbname $root $rootpassnop");
+		}
+	}
+    
+    undef $res;
+    $dbh->disconnect;
 }
 
 system("touch $binbase/.cdserverrc");
@@ -809,11 +821,13 @@
                    in the database. Specifying any options will force moving the
                    database pointing to the new filename even if the move failed.
 
-addmp3id3.pl       Search the specified directories or files recursively for files
-                   ending in .mp3 and containing ID3 tags and then adding them into
-                   the jukebox based on that information. This program will only be
-                   available if you have mp3id3 installed. Very handy for importing
-                   huge directories of existing mp3 files into the database. 
+import.pl          Search the specified directories or files recursively for files
+                   ending in .mp3 or .ogg and containing comment tags and then 
+                   adding them into the jukebox based on that information.
+                   This program has a few options run it with -h for mor infomation.
+                   Ogg import requires ogginfo, mp3 import requires mp3id3.
+                   Very handy for importing huge directories of existing mp3 and ogg
+                   files into the database. 
 
 setmp3id3.pl       Set the ID3 tags of the songs added in the Jukebox according to
                    the contents of the database content. Specifying any options
@@ -826,7 +840,7 @@
 difvol.pl -all     Set the reference volume of songs entered in the jukebox
                    (Warning, will erase all manual modifications).
 
-createalbums.pl -h Create albums from a database created by addmp3id3.pl or
+createalbums.pl -h Create albums from a database created by import.pl or
                    upgraded from Jukebox 3.x
 
 __EOT__
diff -Naur 092402/gjukebox/scripts/ripd.pl genremod.offof092402/gjukebox/scripts/ripd.pl
--- 092402/gjukebox/scripts/ripd.pl	Wed Jul  3 02:52:56 2002
+++ genremod.offof092402/gjukebox/scripts/ripd.pl	Fri Sep  6 22:44:12 2002
@@ -130,7 +130,7 @@
 $SIG{CHLD}=\&reaper;
 
 my $sel=$dbh->prepare("select a.id,a.songid,a.fromid,a.toid,a.artist,a.title,a.album,".
-		      "a.file,b.program,a.user,a.trackno,c.volid,abs(b.priority) as c ".
+		      "a.file,b.program,a.user,a.trackno,a.genre,a.year,a.comment,c.volid,abs(b.priority) as c ".
 		      "from ripqueue a, transformations b left join songs c on a.songid = c.id ".
 		      "where a.fromid like b.fromid and a.toid like b.toid and a.status = 0 ".
 		      "order by c,a.id") || die;
@@ -140,7 +140,7 @@
 for (;;) {
     $sel->execute();
     my $num=0;
-    while(my ($id,$songid,$from,$to,$artist,$title,$album,$file,$program,$user,$trackno,$volid)=$sel->fetchrow_array) {
+    while(my ($id,$songid,$from,$to,$artist,$title,$album,$file,$program,$user,$trackno,$genreid,$year,$comment,$volid)=$sel->fetchrow_array) {
 	my $cf=$from."_".$to;
 	if (!$curconv{$cf}) {
 	    $curconv{$cf}=0;
@@ -212,9 +212,9 @@
 		} elsif ($newfile) {
 		    print "Conversion successfull\n";
 		    if ($songid<=0) {
-			my $sth=$dbc->prepare("insert into songs (artist,title,volume,file,played,voted,toplist,lastplayed,entered,format,user,trackno) ".
-					 "values(?,?,?,?,0,0,0,now(),now(),?,?,?)") || die;
-			$sth->execute($artist,$title,$album,$newfile,$to,$user,$trackno);
+			my $sth=$dbc->prepare("insert into songs (artist,title,volume,file,played,voted,toplist,lastplayed,entered,format,user,trackno,year,genre,comment) ".
+					 "values(?,?,?,?,0,0,0,now(),now(),?,?,?,?,?,?)") || die;
+			$sth->execute($artist,$title,$album,$newfile,$to,$user,$trackno,$year,$genreid,$comment);
 
 			my $progid=-$songid;
 			$songid=$sth->{'mysql_insertid'};
diff -Naur 092402/gjukebox/scripts/setmp3id3.pl genremod.offof092402/gjukebox/scripts/setmp3id3.pl
--- 092402/gjukebox/scripts/setmp3id3.pl	Wed Jul  3 02:52:56 2002
+++ genremod.offof092402/gjukebox/scripts/setmp3id3.pl	Fri Sep  6 22:26:26 2002
@@ -53,18 +53,14 @@
 
 my $dbh=DBI->connect("dbi:mysql:database=$DBNAME;hostname=$DBSERVER",$DBUSER,$DBPASS) || die;
 
-my $del=0;
-if ($ARGV[0]&&$ARGV[0] eq "-d") {
-    $del=1;
-    print "Removing existing tags\n";
-}
-
 # Traverse desired filesystems
 
-my $res=$dbh->prepare("select title,artist,volume,trackno,file from songs where file like '%mp3'") || die;
+my $res=$dbh->prepare("select title,artist,volume,trackno,file,year,comment,genre from songs where file like '%mp3'") || die;
+my $getgenretext=$dbh->prepare("select name from genre where id=(?)") || die;
 $res->execute();
 
-while(my ($title,$artist,$volume,$trackno,$file)=$res->fetchrow_array) {
+
+while(my ($title,$artist,$volume,$trackno,$file,$year,$comment,$year,$genreid)=$res->fetchrow_array) {
     my %info;
 
     if ($title) {
@@ -79,10 +75,16 @@
     if ($trackno) {
 	$info{TRACKNUM}=$trackno;
     }
-    if ($del) {
-	$info{YEAR}="";
-	$info{COMMENT}="";
-	$info{GENRE}="";
+    if ($year) {
+	$info{YEAR}=$year;
+	}
+    if ($comment) {
+	$info{COMMENT}=$comment;
+	}
+    if ($genreid) {
+	$getgenretext->execute($genreid);
+	my ($genre) = $getgenretext->fetchrow_array;
+	$info{GENRE}=$genre;
     }
     if (defined %info) {
 	set_mp3tag($file,\%info);
diff -Naur 092402/gjukebox/scripts/upload.pl genremod.offof092402/gjukebox/scripts/upload.pl
--- 092402/gjukebox/scripts/upload.pl	Tue Aug 20 13:53:54 2002
+++ genremod.offof092402/gjukebox/scripts/upload.pl	Fri Sep  6 23:14:51 2002
@@ -59,18 +59,21 @@
 
 my ($id,$host)=@ARGV;
 
-my ($artist,$title,$album,$filename,$trackno,$format);
+my ($artist,$title,$album,$filename,$trackno,$format,$genreid,$genre,$year,$comment);
 
+$getfile=$dbh->prepare("select file from songs where id = ?");
+$getgenre=$dbh->prepare("select name from genre where id = (?)");
 {
     my $dbh=DBI->connect("dbi:mysql:database=$DBNAME;hostname=$DBSERVER",$DBUSER,$DBPASS) || die;
     {
-	my $res=$dbh->prepare("select songid,artist,title,album,trackno,fromid from ripqueue where id=?");
+	my $res=$dbh->prepare("select songid,artist,title,album,trackno,fromid,year,genreid,comment from ripqueue where id=?");
 	$res->execute($id);
 	my $songid;
-	($songid,$artist,$title,$album,$trackno,$format)=$res->fetchrow_array();
-	$res=$dbh->prepare("select file from songs where id = ?");
-	$res->execute($songid);
-	($filename)=$res->fetchrow_array();
+	($songid,$artist,$title,$album,$trackno,$format,$year,$genreid,$comment)=$res->fetchrow_array();
+	$getfile->execute($songid);
+	($filename)=$getfile->fetchrow_array;
+	$getgenre->execute($genreid);
+	($genre)=$getgenre->fetchrow_array;
 	if (!-f $filename) {
 	    print "File $filename not found\n";
 	    exit 1;
@@ -85,7 +88,7 @@
 }
 
 sub Req {
-    my ($site,$artist,$title,$album,$trackno,$format,$filename)=@_;
+    my ($site,$artist,$title,$album,$trackno,$format,$filename,$year,$comment,$genre)=@_;
     my @req;
 
     my ($user,$pwd,$host,$port,$path)=($site=~/^http:\/\/(?:(?:([^:]+):)?([^\@]+)\@)?([^\/:\@:]+)(?::(\d+))?(\/.*)$/);
@@ -130,6 +133,9 @@
     $body.=&ReqFld($bound,"VOLUME",$album);
     $body.=&ReqFld($bound,"TRACKNO",$trackno);
     $body.=&ReqFld($bound,"FORMAT",$format);
+    $body.=&ReqFld($bound,"YEAR",$year);
+    $body.=&ReqFld($bound,"GENRE",$genre);
+    $body.=&ReqFld($bound,"COMMENT",$comment);
     $body.="--$bound\r\n";
     $body.="Content-Disposition: form-data; name=\"UPLOAD\"; filename=\"whatever.mp3\"\r\n";
     $body.="Content-Type: audio/mpeg\r\n\r\n";
@@ -207,4 +213,4 @@
     close SOCK;
 }
 
-&Req($host,$artist,$title,$album,$trackno,$format,$filename);
+&Req($host,$artist,$title,$album,$trackno,$format,$filename,$year,$comment,$genre);
diff -Naur 092402/gjukebox/sql/settings.sql genremod.offof092402/gjukebox/sql/settings.sql
--- 092402/gjukebox/sql/settings.sql	Tue Sep 10 02:46:26 2002
+++ genremod.offof092402/gjukebox/sql/settings.sql	Tue Sep 24 13:19:02 2002
@@ -60,4 +60,5 @@
 insert into settings values ('TOPLISTBASEMULTIPLIE','Defines how often popular songs are played: lower values=more often','text',5,10050);
 insert into settings values ('MPG123_PARAM','Defines additional paramters for MPG123','text','',50060);
 insert into settings values ('COVERCLICKADD', 'Add songs to queue by clicking the cover', 'check.p', 'YES', 20165);
-insert into settings values ('VERSION','Current version of the database','special','4112', 100000);
+insert into settings values ('VERSION','Current version of the database','special','4113', 100000);
+INSERT INTO settings VALUES ('STRICTEXCLUDE','Do not play a song if it is in an exclude list (even if it was manually picked.)','check','',10111);
diff -Naur 092402/gjukebox/sql/tables.sql genremod.offof092402/gjukebox/sql/tables.sql
--- 092402/gjukebox/sql/tables.sql	Sun Sep  1 08:41:28 2002
+++ genremod.offof092402/gjukebox/sql/tables.sql	Tue Sep 24 13:29:04 2002
@@ -18,6 +18,9 @@
 	volid		int,
 	info		varchar(255),
 	size		int,
+	genre 		int(5) default NULL,
+  	year 		int(4) default NULL,
+  	comment 	varchar(50) default NULL,
 
 	index songartid(artist),
 	index songtitid(title),
@@ -162,7 +165,10 @@
 	status		int,
 	user		varchar(20),
 	trackno		int,
-	log		text
+	log		text,
+	genre 		int(5) default NULL,
+  	year 		int(4) default NULL,
+  	comment 	varchar(50) default NULL
 );
 
 create table volumes (
@@ -181,3 +187,163 @@
 	toplist         double,
 	voted           int(11)
 );
+
+#
+# Table structure for table 'genre'
+#
+
+CREATE TABLE genre (
+  id int(5) NOT NULL auto_increment,
+  name varchar(25) default NULL,
+  PRIMARY KEY  (id)
+) TYPE=MyISAM;
+
+INSERT INTO genre VALUES (1,'A Cappella');
+INSERT INTO genre VALUES (2,'Acid');
+INSERT INTO genre VALUES (3,'Acid Jazz');
+INSERT INTO genre VALUES (4,'Acid Punk');
+INSERT INTO genre VALUES (5,'Acoustic');
+INSERT INTO genre VALUES (6,'Alternative');
+INSERT INTO genre VALUES (7,'AlternRock');
+INSERT INTO genre VALUES (8,'Ambient');
+INSERT INTO genre VALUES (9,'Anime');
+INSERT INTO genre VALUES (10,'Avantgarde');
+INSERT INTO genre VALUES (11,'Ballad');
+INSERT INTO genre VALUES (12,'Bass');
+INSERT INTO genre VALUES (13,'Beat');
+INSERT INTO genre VALUES (14,'Bebob');
+INSERT INTO genre VALUES (15,'Big Band');
+INSERT INTO genre VALUES (16,'Black Metal');
+INSERT INTO genre VALUES (17,'Bluegrass');
+INSERT INTO genre VALUES (18,'Blues');
+INSERT INTO genre VALUES (19,'Booty Bass');
+INSERT INTO genre VALUES (20,'BritPop');
+INSERT INTO genre VALUES (21,'Cabaret');
+INSERT INTO genre VALUES (22,'Celtic');
+INSERT INTO genre VALUES (23,'Chamber Music');
+INSERT INTO genre VALUES (24,'Chanson');
+INSERT INTO genre VALUES (25,'Chorus');
+INSERT INTO genre VALUES (26,'Christian Gangsta Rap');
+INSERT INTO genre VALUES (27,'Christian Rap');
+INSERT INTO genre VALUES (28,'Christian Rock');
+INSERT INTO genre VALUES (29,'Classic Rock');
+INSERT INTO genre VALUES (30,'Classical');
+INSERT INTO genre VALUES (31,'Club');
+INSERT INTO genre VALUES (32,'Club-House');
+INSERT INTO genre VALUES (33,'Comedy');
+INSERT INTO genre VALUES (34,'Contemporary Christian');
+INSERT INTO genre VALUES (35,'Country');
+INSERT INTO genre VALUES (36,'Crossover');
+INSERT INTO genre VALUES (37,'Cult');
+INSERT INTO genre VALUES (38,'Dance');
+INSERT INTO genre VALUES (39,'Dance Hall');
+INSERT INTO genre VALUES (40,'Darkwave');
+INSERT INTO genre VALUES (41,'Death Metal');
+INSERT INTO genre VALUES (42,'Disco');
+INSERT INTO genre VALUES (43,'Dream');
+INSERT INTO genre VALUES (44,'Drum & Bass');
+INSERT INTO genre VALUES (45,'Drum Solo');
+INSERT INTO genre VALUES (46,'Duet');
+INSERT INTO genre VALUES (47,'Easy Listening');
+INSERT INTO genre VALUES (48,'Electronic');
+INSERT INTO genre VALUES (49,'Ethnic');
+INSERT INTO genre VALUES (50,'Eurodance');
+INSERT INTO genre VALUES (51,'Euro-House');
+INSERT INTO genre VALUES (52,'Euro-Techno');
+INSERT INTO genre VALUES (53,'Fast-Fusion');
+INSERT INTO genre VALUES (54,'Folk');
+INSERT INTO genre VALUES (55,'Folk/Rock');
+INSERT INTO genre VALUES (56,'Folklore');
+INSERT INTO genre VALUES (57,'Freestyle');
+INSERT INTO genre VALUES (58,'Funk');
+INSERT INTO genre VALUES (59,'Fusion');
+INSERT INTO genre VALUES (60,'Game');
+INSERT INTO genre VALUES (61,'Gangsta');
+INSERT INTO genre VALUES (62,'Goa');
+INSERT INTO genre VALUES (63,'Gospel');
+INSERT INTO genre VALUES (64,'Gothic');
+INSERT INTO genre VALUES (65,'Gothic Rock');
+INSERT INTO genre VALUES (66,'Grunge');
+INSERT INTO genre VALUES (67,'Hard Rock');
+INSERT INTO genre VALUES (68,'Hardcore');
+INSERT INTO genre VALUES (69,'Heavy Metal');
+INSERT INTO genre VALUES (70,'Hip-Hop');
+INSERT INTO genre VALUES (71,'House');
+INSERT INTO genre VALUES (72,'Humour');
+INSERT INTO genre VALUES (73,'Indie');
+INSERT INTO genre VALUES (74,'Industrial');
+INSERT INTO genre VALUES (75,'Instrumental');
+INSERT INTO genre VALUES (76,'Instrumental Pop');
+INSERT INTO genre VALUES (77,'Instrumental Rock');
+INSERT INTO genre VALUES (78,'Jazz');
+INSERT INTO genre VALUES (79,'Jazz+Funk');
+INSERT INTO genre VALUES (80,'JPop');
+INSERT INTO genre VALUES (81,'Jungle');
+INSERT INTO genre VALUES (82,'Latin');
+INSERT INTO genre VALUES (83,'Lo-Fi');
+INSERT INTO genre VALUES (84,'Meditative');
+INSERT INTO genre VALUES (85,'Merengue');
+INSERT INTO genre VALUES (86,'Metal');
+INSERT INTO genre VALUES (87,'Musical');
+INSERT INTO genre VALUES (88,'National Folk');
+INSERT INTO genre VALUES (89,'Native American');
+INSERT INTO genre VALUES (90,'Negerpunk');
+INSERT INTO genre VALUES (91,'New Age');
+INSERT INTO genre VALUES (92,'New Wave');
+INSERT INTO genre VALUES (93,'Noise');
+INSERT INTO genre VALUES (94,'Oldies');
+INSERT INTO genre VALUES (95,'Opera');
+INSERT INTO genre VALUES (96,'Other');
+INSERT INTO genre VALUES (97,'Polka');
+INSERT INTO genre VALUES (98,'Polsk Punk');
+INSERT INTO genre VALUES (99,'Pop');
+INSERT INTO genre VALUES (100,'Pop/Funk');
+INSERT INTO genre VALUES (101,'Pop-Folk');
+INSERT INTO genre VALUES (102,'Porn Groove');
+INSERT INTO genre VALUES (103,'Power Ballad');
+INSERT INTO genre VALUES (104,'Pranks');
+INSERT INTO genre VALUES (105,'Primus');
+INSERT INTO genre VALUES (106,'Progressive Rock');
+INSERT INTO genre VALUES (107,'Psychedelic');
+INSERT INTO genre VALUES (108,'Psychedelic Rock');
+INSERT INTO genre VALUES (109,'Punk');
+INSERT INTO genre VALUES (110,'Punk Rock');
+INSERT INTO genre VALUES (111,'R&B');
+INSERT INTO genre VALUES (112,'Rap');
+INSERT INTO genre VALUES (113,'Rave');
+INSERT INTO genre VALUES (114,'Reggae');
+INSERT INTO genre VALUES (115,'Retro');
+INSERT INTO genre VALUES (116,'Revival');
+INSERT INTO genre VALUES (117,'Rhytmic Soul');
+INSERT INTO genre VALUES (118,'Rock');
+INSERT INTO genre VALUES (119,'Rock & Roll');
+INSERT INTO genre VALUES (120,'Salsa');
+INSERT INTO genre VALUES (121,'Samba');
+INSERT INTO genre VALUES (122,'Satire');
+INSERT INTO genre VALUES (123,'Showtunes');
+INSERT INTO genre VALUES (124,'Ska');
+INSERT INTO genre VALUES (125,'Slow Jam');
+INSERT INTO genre VALUES (126,'Slow Rock');
+INSERT INTO genre VALUES (127,'Sonata');
+INSERT INTO genre VALUES (128,'Soul');
+INSERT INTO genre VALUES (129,'Sound Clip');
+INSERT INTO genre VALUES (130,'Soundtrack');
+INSERT INTO genre VALUES (131,'Southern Rock');
+INSERT INTO genre VALUES (132,'Space');
+INSERT INTO genre VALUES (133,'Speech');
+INSERT INTO genre VALUES (134,'Swing');
+INSERT INTO genre VALUES (135,'Symphonic Rock');
+INSERT INTO genre VALUES (136,'Symphony');
+INSERT INTO genre VALUES (137,'Synthpop');
+INSERT INTO genre VALUES (138,'Tango');
+INSERT INTO genre VALUES (139,'Techno');
+INSERT INTO genre VALUES (140,'Techno-Industrial');
+INSERT INTO genre VALUES (141,'Terror');
+INSERT INTO genre VALUES (142,'Thrash Metal');
+INSERT INTO genre VALUES (143,'Top 40');
+INSERT INTO genre VALUES (144,'Trailer');
+INSERT INTO genre VALUES (145,'Trance');
+INSERT INTO genre VALUES (146,'Tribal');
+INSERT INTO genre VALUES (147,'Trip-Hop');
+INSERT INTO genre VALUES (148,'Vocal');
+
diff -Naur 092402/gjukebox/sql/update4112.pl genremod.offof092402/gjukebox/sql/update4112.pl
--- 092402/gjukebox/sql/update4112.pl	Wed Dec 31 18:00:00 1969
+++ genremod.offof092402/gjukebox/sql/update4112.pl	Tue Sep 24 13:33:14 2002
@@ -0,0 +1,43 @@
+use strict;
+use DBI;
+
+
+my ($DBHOST,$DBNAME,$DBUSER,$DBPASS)=@ARGV;
+
+my $override = 0;
+
+my $dbh=DBI->connect("dbi:mysql:database=$DBNAME;host=$DBHOST",$DBUSER,$DBPASS) || die;
+my $getvernumber=$dbh->prepare("select value from settings where name = 'VERSION'");
+my $findgenre=$dbh->prepare("select id from genre where upper(name) = upper(?)");
+my $addgenre=$dbh->prepare("insert into genre (name) values (?)");
+$getvernumber->execute();
+my ($vernum)=$getvernumber->fetchrow_array;
+print "DB Version Number = $vernum\n";
+if (($vernum == 4113)||$override){ # just a touch of protection 
+	my $updatealbums=$dbh->prepare("update programs set genre = (?) where id = (?)");
+	my $albumrows=$dbh->prepare("select id,genre from programs");
+	$albumrows->execute();
+	while(my ($id,$genre) = $albumrows->fetchrow_array()){
+		if($genre){
+			if($genre eq "newage"){$genre = "New Age";}
+			if($genre eq "misc"){$genre = "Other";}
+			my $genreid=findgenre($genre);
+			print "Converting $id\t$genre\t$genreid\n";
+			$updatealbums->execute($genreid,$id);
+			}
+		else {print "No Genre for id $id\n";}
+		}
+	}
+
+sub findgenre {
+        my ($genre) = @_;
+        $findgenre->execute($genre);
+        my ($genreid)=$findgenre->fetchrow_array;
+        if (!$genreid){
+                $addgenre->execute($genre);
+                $genreid=$addgenre->{'mysql_insertid'};
+                print "Adding Genre $genre\n";
+                $genreid=0;
+		}
+        return($genreid);
+        }
diff -Naur 092402/gjukebox/sql/update4112.sql genremod.offof092402/gjukebox/sql/update4112.sql
--- 092402/gjukebox/sql/update4112.sql	Wed Dec 31 18:00:00 1969
+++ genremod.offof092402/gjukebox/sql/update4112.sql	Tue Sep 24 14:56:10 2002
@@ -0,0 +1,174 @@
+#
+# Table structure for table 'genre'
+#
+
+CREATE TABLE genre (
+  id int(5) NOT NULL auto_increment,
+  name varchar(25) default NULL,
+  PRIMARY KEY  (id)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'genre'
+#
+
+INSERT INTO genre VALUES (1,'A Cappella');
+INSERT INTO genre VALUES (2,'Acid');
+INSERT INTO genre VALUES (3,'Acid Jazz');
+INSERT INTO genre VALUES (4,'Acid Punk');
+INSERT INTO genre VALUES (5,'Acoustic');
+INSERT INTO genre VALUES (6,'Alternative');
+INSERT INTO genre VALUES (7,'AlternRock');
+INSERT INTO genre VALUES (8,'Ambient');
+INSERT INTO genre VALUES (9,'Anime');
+INSERT INTO genre VALUES (10,'Avantgarde');
+INSERT INTO genre VALUES (11,'Ballad');
+INSERT INTO genre VALUES (12,'Bass');
+INSERT INTO genre VALUES (13,'Beat');
+INSERT INTO genre VALUES (14,'Bebob');
+INSERT INTO genre VALUES (15,'Big Band');
+INSERT INTO genre VALUES (16,'Black Metal');
+INSERT INTO genre VALUES (17,'Bluegrass');
+INSERT INTO genre VALUES (18,'Blues');
+INSERT INTO genre VALUES (19,'Booty Bass');
+INSERT INTO genre VALUES (20,'BritPop');
+INSERT INTO genre VALUES (21,'Cabaret');
+INSERT INTO genre VALUES (22,'Celtic');
+INSERT INTO genre VALUES (23,'Chamber Music');
+INSERT INTO genre VALUES (24,'Chanson');
+INSERT INTO genre VALUES (25,'Chorus');
+INSERT INTO genre VALUES (26,'Christian Gangsta Rap');
+INSERT INTO genre VALUES (27,'Christian Rap');
+INSERT INTO genre VALUES (28,'Christian Rock');
+INSERT INTO genre VALUES (29,'Classic Rock');
+INSERT INTO genre VALUES (30,'Classical');
+INSERT INTO genre VALUES (31,'Club');
+INSERT INTO genre VALUES (32,'Club-House');
+INSERT INTO genre VALUES (33,'Comedy');
+INSERT INTO genre VALUES (34,'Contemporary Christian');
+INSERT INTO genre VALUES (35,'Country');
+INSERT INTO genre VALUES (36,'Crossover');
+INSERT INTO genre VALUES (37,'Cult');
+INSERT INTO genre VALUES (38,'Dance');
+INSERT INTO genre VALUES (39,'Dance Hall');
+INSERT INTO genre VALUES (40,'Darkwave');
+INSERT INTO genre VALUES (41,'Death Metal');
+INSERT INTO genre VALUES (42,'Disco');
+INSERT INTO genre VALUES (43,'Dream');
+INSERT INTO genre VALUES (44,'Drum & Bass');
+INSERT INTO genre VALUES (45,'Drum Solo');
+INSERT INTO genre VALUES (46,'Duet');
+INSERT INTO genre VALUES (47,'Easy Listening');
+INSERT INTO genre VALUES (48,'Electronic');
+INSERT INTO genre VALUES (49,'Ethnic');
+INSERT INTO genre VALUES (50,'Eurodance');
+INSERT INTO genre VALUES (51,'Euro-House');
+INSERT INTO genre VALUES (52,'Euro-Techno');
+INSERT INTO genre VALUES (53,'Fast-Fusion');
+INSERT INTO genre VALUES (54,'Folk');
+INSERT INTO genre VALUES (55,'Folk/Rock');
+INSERT INTO genre VALUES (56,'Folklore');
+INSERT INTO genre VALUES (57,'Freestyle');
+INSERT INTO genre VALUES (58,'Funk');
+INSERT INTO genre VALUES (59,'Fusion');
+INSERT INTO genre VALUES (60,'Game');
+INSERT INTO genre VALUES (61,'Gangsta');
+INSERT INTO genre VALUES (62,'Goa');
+INSERT INTO genre VALUES (63,'Gospel');
+INSERT INTO genre VALUES (64,'Gothic');
+INSERT INTO genre VALUES (65,'Gothic Rock');
+INSERT INTO genre VALUES (66,'Grunge');
+INSERT INTO genre VALUES (67,'Hard Rock');
+INSERT INTO genre VALUES (68,'Hardcore');
+INSERT INTO genre VALUES (69,'Heavy Metal');
+INSERT INTO genre VALUES (70,'Hip-Hop');
+INSERT INTO genre VALUES (71,'House');
+INSERT INTO genre VALUES (72,'Humour');
+INSERT INTO genre VALUES (73,'Indie');
+INSERT INTO genre VALUES (74,'Industrial');
+INSERT INTO genre VALUES (75,'Instrumental');
+INSERT INTO genre VALUES (76,'Instrumental Pop');
+INSERT INTO genre VALUES (77,'Instrumental Rock');
+INSERT INTO genre VALUES (78,'Jazz');
+INSERT INTO genre VALUES (79,'Jazz+Funk');
+INSERT INTO genre VALUES (80,'JPop');
+INSERT INTO genre VALUES (81,'Jungle');
+INSERT INTO genre VALUES (82,'Latin');
+INSERT INTO genre VALUES (83,'Lo-Fi');
+INSERT INTO genre VALUES (84,'Meditative');
+INSERT INTO genre VALUES (85,'Merengue');
+INSERT INTO genre VALUES (86,'Metal');
+INSERT INTO genre VALUES (87,'Musical');
+INSERT INTO genre VALUES (88,'National Folk');
+INSERT INTO genre VALUES (89,'Native American');
+INSERT INTO genre VALUES (90,'Negerpunk');
+INSERT INTO genre VALUES (91,'New Age');
+INSERT INTO genre VALUES (92,'New Wave');
+INSERT INTO genre VALUES (93,'Noise');
+INSERT INTO genre VALUES (94,'Oldies');
+INSERT INTO genre VALUES (95,'Opera');
+INSERT INTO genre VALUES (96,'Other');
+INSERT INTO genre VALUES (97,'Polka');
+INSERT INTO genre VALUES (98,'Polsk Punk');
+INSERT INTO genre VALUES (99,'Pop');
+INSERT INTO genre VALUES (100,'Pop/Funk');
+INSERT INTO genre VALUES (101,'Pop-Folk');
+INSERT INTO genre VALUES (102,'Porn Groove');
+INSERT INTO genre VALUES (103,'Power Ballad');
+INSERT INTO genre VALUES (104,'Pranks');
+INSERT INTO genre VALUES (105,'Primus');
+INSERT INTO genre VALUES (106,'Progressive Rock');
+INSERT INTO genre VALUES (107,'Psychedelic');
+INSERT INTO genre VALUES (108,'Psychedelic Rock');
+INSERT INTO genre VALUES (109,'Punk');
+INSERT INTO genre VALUES (110,'Punk Rock');
+INSERT INTO genre VALUES (111,'R&B');
+INSERT INTO genre VALUES (112,'Rap');
+INSERT INTO genre VALUES (113,'Rave');
+INSERT INTO genre VALUES (114,'Reggae');
+INSERT INTO genre VALUES (115,'Retro');
+INSERT INTO genre VALUES (116,'Revival');
+INSERT INTO genre VALUES (117,'Rhytmic Soul');
+INSERT INTO genre VALUES (118,'Rock');
+INSERT INTO genre VALUES (119,'Rock & Roll');
+INSERT INTO genre VALUES (120,'Salsa');
+INSERT INTO genre VALUES (121,'Samba');
+INSERT INTO genre VALUES (122,'Satire');
+INSERT INTO genre VALUES (123,'Showtunes');
+INSERT INTO genre VALUES (124,'Ska');
+INSERT INTO genre VALUES (125,'Slow Jam');
+INSERT INTO genre VALUES (126,'Slow Rock');
+INSERT INTO genre VALUES (127,'Sonata');
+INSERT INTO genre VALUES (128,'Soul');
+INSERT INTO genre VALUES (129,'Sound Clip');
+INSERT INTO genre VALUES (130,'Soundtrack');
+INSERT INTO genre VALUES (131,'Southern Rock');
+INSERT INTO genre VALUES (132,'Space');
+INSERT INTO genre VALUES (133,'Speech');
+INSERT INTO genre VALUES (134,'Swing');
+INSERT INTO genre VALUES (135,'Symphonic Rock');
+INSERT INTO genre VALUES (136,'Symphony');
+INSERT INTO genre VALUES (137,'Synthpop');
+INSERT INTO genre VALUES (138,'Tango');
+INSERT INTO genre VALUES (139,'Techno');
+INSERT INTO genre VALUES (140,'Techno-Industrial');
+INSERT INTO genre VALUES (141,'Terror');
+INSERT INTO genre VALUES (142,'Thrash Metal');
+INSERT INTO genre VALUES (143,'Top 40');
+INSERT INTO genre VALUES (144,'Trailer');
+INSERT INTO genre VALUES (145,'Trance');
+INSERT INTO genre VALUES (146,'Tribal');
+INSERT INTO genre VALUES (147,'Trip-Hop');
+INSERT INTO genre VALUES (148,'Vocal');
+
+ALTER TABLE songs ADD genre INT(5) DEFAULT NULL;
+ALTER TABLE songs ADD year INT(4) DEFAULT NULL;
+ALTER TABLE songs ADD comment VARCHAR(50) DEFAULT NULL;
+ALTER TABLE ripqueue ADD genre INT(5) DEFAULT NULL;
+ALTER TABLE ripqueue ADD year INT(4) DEFAULT NULL;
+ALTER TABLE ripqueue ADD comment VARCHAR(50) DEFAULT NULL;
+
+INSERT INTO settings VALUES ('STRICTEXCLUDE','Do not play a song if it is in an exclude list (even if it was manually picked.)','check','',10111);
+INSERT INTO settings VALUES ('OGGQUALITY','Quality level when encoding in ogg.','text','8',40015);
+UPDATE settings set description = 'Bitrate to encode ripped MP3 music with (KHz)' where name = 'ENCODING';
+update settings set value = '4113' where name = 'VERSION';
diff -Naur 092402/gjukebox/www/action.php genremod.offof092402/gjukebox/www/action.php
--- 092402/gjukebox/www/action.php	Tue Aug 20 13:53:54 2002
+++ genremod.offof092402/gjukebox/www/action.php	Sun Sep 15 20:46:41 2002
@@ -260,6 +260,9 @@
 	    $title=prepareDB($TITLE);
 	    $volume=prepareDB($VOLUME);
 	    $format=prepareDB($FORMAT);
+	    $genre=prepareDB($GENREID);
+	    $year=prepareDB($YEAR);
+	    $comment=prepareDB($COMMENT);
 	    $trackno=(int)$TRACKNO;
 	    if (!$trackno)
 		$trackno="NULL";
@@ -272,7 +275,7 @@
 	        list($num)=mysql_fetch_array($res);
 	    }
 	    if ($num==0)
-		mysql_query("insert into ripqueue values(0,0,'url',$format,$artist,$title,$volume,$url,0,'$MUSICUSER',$trackno,NULL)");
+		mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) values(0,0,'url',$format,$artist,$title,$volume,$url,0,'$MUSICUSER',$trackno,NULL,$genre,$year,$comment)");
 	    if ($disrip)
 		$location=$HTTP_REFERER;
 	    else
@@ -317,6 +320,9 @@
 		$title=prepareDB(${"TITLE".$i});
 		$album=prepareDB(${"ALBUM".$i});
 		$format=prepareDB(${"FORMAT".$i});
+		$genre=prepareDB(${"GENREID".$i});
+		$year=prepareDB(${"YEAR".$i});
+		$comment=prepareDB(${"COMMENT".$i});
 	        $trackno=(int)${"TRACKNO".$i};
 	        if (!$trackno)
 		    $trackno="NULL";
@@ -328,24 +334,27 @@
 	            list($num)=mysql_fetch_array($res);
 	        }
 	        if ($num==0)
-		    mysql_query("insert into ripqueue values(0,0,'url',$format,$artist,$title,$album,$url,0,'$MUSICUSER',$trackno,NULL)");
+		    mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) values(0,0,'url',$format,$artist,$title,$album,$url,0,'$MUSICUSER',$trackno,NULL,$genre,$year,$comment)");
 	    }
 	    $location=$HTTP_REFERER;
-	} elseif ($CHVOL) {
+	} elseif ($CHVOL) { # Move a song from one volume to another.
 	    for ($id=reset($CHVOL);$id;$id=next($CHVOL)) {
 		$volid=${"CHVOL".$id};
   	        if ($volid==0) {
 		    $volid="NULL";
 		}
-	        list($artist,$title,$album,$ovolid,$trackno)=mysql_fetch_array(mysql_query("select artist,title,volume,volid,trackno from songs where id = $id"));
+	        list($artist,$title,$album,$ovolid,$trackno,$genre,$year,$comment)=mysql_fetch_array(mysql_query("select artist,title,volume,volid,trackno from songs where id = $id"));
 		$artist=prepareDB($artist);
 		$title=prepareDB($title);
 		$album=prepareDB($album);
+		$genre=(INT)$genre;
+		$year=prepareDB($year);
+		$comment=prepareDB($comment);
 	        $trackno=(int)$trackno;
 	        if (!$ovolid)
 		    $ovolid=0;
 	        if ($ovolid!=$volid)
-	            mysql_query("insert into ripqueue values(0,$id,'vol','vol',$artist,$title,$album,$volid,0,'$MUSICUSER',$trackno,NULL)");
+	            mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) values(0,$id,'vol','vol',$artist,$title,$album,$volid,0,'$MUSICUSER',$trackno,NULL)");
 	    }
             $location="left.php";
 	} elseif ($JUKEBOXNAME) {
@@ -373,28 +382,34 @@
 		$id="";
 	    $res=mysql_query("select fromid,toid from transformations where toid != '%' and priority >= 0");
 	    while(list($fromid,$toid)=mysql_fetch_array($res))
-		mysql_query("insert into ripqueue select 0,id,format,'$toid',artist,title,volume,file,0,'',trackno,NULL from songs where format like '$fromid'$id");
+		mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) select 0,id,format,'$toid',artist,title,volume,file,0,'',trackno,NULL,genre,year,comment from songs where format like '$fromid'$id");
 	    $location="tracks.php";
 	} elseif ($ACTION=="removefail") {
 	    mysql_query("delete from ripqueue where status < 0");
 	    $location=$HTTP_REFERER;
-	} elseif ($ACTION=="del") {
-	    $res=mysql_query("select artist,title,volume,file from songs where id = $ID");
-	    list($artist,$title,$album,$file)=mysql_fetch_array($res);
+	} elseif ($ACTION=="del") { # Delete a Song
+	    $res=mysql_query("select artist,title,volume,file,genre,year,comment from songs where id = $ID");
+	    list($artist,$title,$album,$file,$genre,$year,$comment)=mysql_fetch_array($res);
 	    $artist=prepareDB($artist);
 	    $title=prepareDB($title);
 	    $album=prepareDB($album);
 	    $file=prepareDB($file);
-	    mysql_query("insert into ripqueue values (0,$ID,'%','del',$artist,$title,$album,$file,0,'$MUSICUSER',NULL,NULL)");
+	    $genre=(INT)$genre;
+            $year=prepareDB($year);
+            $comment=prepareDB($comment);
+	    mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) values (0,$ID,'%','del',$artist,$title,$album,$file,0,'$MUSICUSER',NULL,NULL,$genre,$year,$comment)");
 
 	    $location="right.php";
-	} elseif ($ACTION=="add"&&$FORMAT) {
+	} elseif ($ACTION=="add"&&$FORMAT) { # Add a song to the db
 	    if ($SONG != "") {
 		$refvol=$REFVOL;
 		$artist=prepareDB($ARTIST);
 		$song=prepareDB($SONG);
 		$volume=prepareDB($VOLUME);
-	        $trackno=(int)$TRACKNO;
+	        $genre=(int)$GENREID;
+                $year=prepareDB($YEAR);
+                $comment=prepareDB($COMMENT);
+                $trackno=(int)$TRACKNO;
 	        if (!$trackno)
 		    $trackno="NULL";
 
@@ -411,48 +426,51 @@
 		    exit;
 		}
 		$file=prepareDB($file);
-	        if ($OLDID) {
+	        if ($OLDID) { # if we have an OLDID then we're just updating the details on a file.
 		    $location="addform.php?OLDID=$OLDID";
 		    if (!$REFVOL)
 			$refvol=0;
 		    else
 			$refvol=$REFVOL;
-		    mysql_query("update songs set artist = $artist, title = $song, volume = $volume, file = $file, format = '$FORMAT', difvol = $refvol, trackno = $trackno where id = $OLDID");
-	        } else {
+		    mysql_query("update songs set artist = $artist, title = $song, volume = $volume, file = $file, format = '$FORMAT', difvol = $refvol, trackno = $trackno, year = $year, genre = $genre, comment = $comment where id = $OLDID");
+	            }
+		else { # Since we don't have an oldid we're adding a song
 		    $location="addform.php?ARTIST=".urlencode($ARTIST)."&FILE=".urlencode($FILE);
-		    if (ereg("://",$file)) {
-		        mysql_query("insert into ripqueue values (0,0,'url','$format',$artist,$song,$volume,$file,0,'$MUSICUSER',$trackno,NULL)");
+		    if (ereg("://",$file)) { #if it's a url then we need to download the actual file (and ripd takes care of us)
+		        mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) values (0,0,'url','$format',$artist,$song,$volume,$file,0,'$MUSICUSER',$trackno,NULL,$genre,$year,$comment)");
 		    } else {
-  	 	        mysql_query("insert into songs (artist,title,volume,file,played,voted,toplist,lastplayed,entered,format,user,trackno) values ($artist,$song,$volume,$file,".
-			  	    "0,0,0,now(),now(),'$FORMAT','$MUSICUSER',$trackno)");
+  	 	        mysql_query("insert into songs (artist,title,volume,file,played,voted,toplist,lastplayed,entered,format,user,trackno,genre,year,comment) values ($artist,$song,$volume,$file,".
+			  	    "0,0,0,now(),now(),'$FORMAT','$MUSICUSER',$trackno,$genre,$year,$comment)");
 			$id=mysql_insert_id();
 			if ($alsogroup=fetchSetting('AUTOADD')) {
 			    list($gid)=mysql_fetch_array(mysql_query("select id from groups where name = ".prepareDB($alsogroup)));
 			    mysql_query("insert into groupmember values ($gid,$id)");
 			}
-			mysql_query("insert into ripqueue values (0,$id,'mp3','analyse',$artist,$song,$volume,$file,0,'$MUSICUSER',$trackno,NULL)");
+			mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) values (0,$id,'mp3','analyse',$artist,$song,$volume,$file,0,'$MUSICUSER',$trackno,NULL)");
 		        inserttune($id,$unauthpri);
 		    }
 		}
 	    }
-	} elseif ($ACTION=="upload"&&$UPLOAD&&$ID) {
+	} elseif ($ACTION=="upload"&&$UPLOAD&&$ID) { # I think this is used to upload to another jukebox (not really sure someone who knows should update this comment)
 	    $res=mysql_query("select hostname,user,pass from remotehosts where id = $UPLOAD");
 	    list($url,$user,$pass)=mysql_fetch_array($res);
 	    $url=ereg_replace("^http://","http://$user:$pass@",$url);
-	    $res=mysql_query("select artist,title,volume,trackno,format from songs where id = $ID");
-	    list($artist,$title,$album,$trackno,$format)=mysql_fetch_array($res);
+	    $res=mysql_query("select artist,title,volume,trackno,format,genre,year,comment from songs where id = $ID");
+	    list($artist,$title,$album,$trackno,$format,$genre,$year,$comment)=mysql_fetch_array($res);
 	    $artist=prepareDB($artist);
 	    $title=prepareDB($title);
 	    $album=prepareDB($album);
 	    $format=prepareDB($format);
+	    $genre=(INT)$genre;
+	    $year=prepareDB($year);
+	    $comment=prepareDB($comment);
 	    $url=prepareDB($url);
 	    $user=prepareDB($user);
 	    if ($trackno<=0)
 		$trackno="NULL";
-	    mysql_query("insert into ripqueue values (0,$ID,$format,'upload',".
-			"$artist,$title,$album,$url,0,$user,$trackno,NULL)");
+	    mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) values (0,$ID,$format,'upload',$artist,$title,$album,$url,0,$user,$trackno,NULL,$genre,$year,$comment)");
 	    $location="left.php";
-	} elseif ($NEWGRP||$DELGRP) {
+	} elseif ($NEWGRP||$DELGRP) { #Add or remove a group
 	    if ($NEWGRP) {
 		$NEWGRP=prepareDB($NEWGRP);
 		if (substr($TYPE,0,1)=="C") {
@@ -490,7 +508,7 @@
 	    else
                 mysql_query("delete from queue where played = 0 and queueid > 0");
             $location="group.php";
-        } elseif (strlen($REMOVE)>0) {
+        } elseif (strlen($REMOVE)>0) { # Delete from the playqueue and update the toplist count apropriatly
 	    $result=mysql_query("SELECT id, played, toplist FROM queue WHERE queueid = $REMOVE");
             if (list($id,$played,$toplist)=mysql_fetch_array($result)) {
                 if ($REMOVE)
@@ -534,7 +552,7 @@
             fputs($vs,"$MUSICUSER $SEND\n");
             fclose($vs);
             $location="left.php";
-	} elseif ($VOTING) {
+	} elseif ($VOTING) { #Added for specific voting, i.e. I really like it-I really hate it.
 	    $votingvalue=toplist();
 	    $votingcount=1;
 	    if ($VOTING=="verygood") {
@@ -571,7 +589,7 @@
                     mysql_query("insert into groupmember (groupid,songid) values ($val,$id)");
             }
             $location="right.php?EXTRA=$EXTRA&GROUP=$GROUP&SORT=$SORT&DISP=$DISP&LIMIT=$LIMIT&CRITERIA=$CRITERIA&ONLY=$ONLY";
-        } elseif ($SELPRG) {
+        } elseif ($SELPRG) { 
             $res=mysql_query("select songid from programmember where programid = $SELPRG order by id");
             while(list($id)=mysql_fetch_array($res))
 	        inserttune($id,$MUSICPRI+1,0.5);
@@ -606,20 +624,23 @@
 	} elseif ($DELSUPP) {
 	    mysql_query("delete from formats where id = '$DELSUPP'");
 	    $location=$HTTP_REFERER;
-	} elseif ($CONV) {
-	    $res=mysql_query("select format,file,artist,title,volume,trackno from songs where id = ".((int)$CONV));
-	    list($fromid,$file,$artist,$title,$album,$trackno)=mysql_fetch_array($res);
+	} elseif ($CONV) { # Generic Convert section convert song to something
+	    $res=mysql_query("select format,file,artist,title,volume,trackno,genre,year,comment from songs where id = ".((int)$CONV));
+	    list($fromid,$file,$artist,$title,$album,$trackno,$genreid,$year,$comment)=mysql_fetch_array($res);
 	    $toid=prepareDB($TOID);
 	    $fromid=prepareDB($fromid);
 	    $file=prepareDB($file);
 	    $artist=prepareDB($artist);
 	    $title=prepareDB($title);
 	    $album=prepareDB($album);
+	    $genreid=(INT)$genreid;
+	    $year=prepareDB($year);
+	    $comment=prepareDB($comment);
 	    if (!$trackno)
 		$trackno="NULL";
-	    mysql_query("insert into ripqueue values (0,".((int)$CONV).",$fromid,$toid,$artist,$title,$album,$file,0,'$MUSICUSER',$trackno,NULL)");
+	    mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,log,genre,year,comment) values (0,".((int)$CONV).",$fromid,$toid,$artist,$title,$album,$file,0,'$MUSICUSER',$trackno,NULL,$genreid,$year,$comment)");
 	    $location=$HTTP_REFERER;
-	} elseif ($CONVERT) {
+	} elseif ($CONVERT) { #Change the table that stores the possible conversions
 	    for ($i=reset($CONVERT);$i;$i=next($CONVERT)) {
 		$otoid=${"CONVOTO".$i};
 		$ofromid=${"CONVOFROM".$i};
@@ -638,7 +659,7 @@
 		    mysql_query("update transformations set fromid = '$fromid', toid = '$toid', description=$dsc, program = $prg, priority=$pri where fromid = '$ofromid' and toid = '$otoid'");
 	    }
 	    $location=$HTTP_REFERER;
-	} elseif ($DELCONV||$DELCONVTO) {
+	} elseif ($DELCONV||$DELCONVTO) { # Remove an entry from the possible conversions
 	    mysql_query("delete from transformations where fromid = '$DELCONV' and toid = '$DELCONVTO'");
 	    $location=$HTTP_REFERER;
 	} elseif ($DELTIMER) {
@@ -647,7 +668,7 @@
 	    system("$atrm $DELTIMER");
 	    ?>Redirected to <A HREF=admin.php?PART=timer >here</A>.<?
 	    exit;
-	} elseif ($SETTINGS) {
+	} elseif ($SETTINGS) { #Change a settings value
 	    $res=mysql_query("select name,type,value from settings where type != 'special'");
 	    while(list($id,$type,$oldval)=mysql_fetch_array($res)) {
 		$val=prepareDB($value=${$id});
diff -Naur 092402/gjukebox/www/addform.php genremod.offof092402/gjukebox/www/addform.php
--- 092402/gjukebox/www/addform.php	Tue Aug 20 13:53:54 2002
+++ genremod.offof092402/gjukebox/www/addform.php	Sat Sep  7 00:27:12 2002
@@ -77,15 +77,15 @@
 }
 
 if ($OLDID) {
-    list($OLDID,$ARTIST,$SONG,$VOLUME,$FILE,$PLAYED,$VOTED,$TOPLIST,$LASTPLAYED,$ENTERED,$REFVOL,$FORMAT,$TRACKNO,$INFO)=
-	mysql_fetch_array(mysql_query("select id,artist,title,volume,file,played,voted,toplist,lastplayed,entered,difvol,format,trackno,info from songs where id = $OLDID"));
+    list($OLDID,$ARTIST,$SONG,$VOLUME,$FILE,$PLAYED,$VOTED,$TOPLIST,$LASTPLAYED,$ENTERED,$REFVOL,$FORMAT,$TRACKNO,$INFO,$YEAR,$COMMENT,$GENREID)=
+	mysql_fetch_array(mysql_query("select id,artist,title,volume,file,played,voted,toplist,lastplayed,entered,difvol,format,trackno,info,year,comment,genre from songs where id = $OLDID"));
     if ($INFO) {
 	$extinfo="<TR><TD><B>".$INFO."</TD></TR>";
 	$extinfo=ereg_replace("\n","</TD></TR>\n<TR><TD><B>",$extinfo);
 	$extinfo=ereg_replace(":","</B></TD><TD>",$extinfo);
     }
-} else
-    $FORMAT="mp3";
+}
+ else $FORMAT="mp3";
 ?>
 <HTML>
 <HEAD>
@@ -111,15 +111,40 @@
     print "<INPUT TYPE=hidden NAME=OLDID VALUE=$OLDID>";
 ?>
 <P><INPUT TYPE=hidden NAME=ACTION VALUE=add>
-Artist<BR>
-<INPUT TYPE=text NAME=ARTIST VALUE="<? print htmlspecialchars($ARTIST); ?>" ><P>
-Song<BR>
-<INPUT TYPE=text NAME=SONG VALUE="<? print htmlspecialchars($SONG); ?>" ><P>
-Album<BR>
-<INPUT TYPE=text NAME=VOLUME VALUE="<? print htmlspecialchars($VOLUME); ?>" ><P>
-Track number<BR>
-<INPUT TYPE=text NAME=TRACKNO VALUE="<? print htmlspecialchars($TRACKNO); ?>" ><P>
-Format<BR>
+<TABLE><TR><TD>Artist</TD><TD>
+<INPUT TYPE=text NAME=ARTIST VALUE="<? print htmlspecialchars($ARTIST); ?>" >
+</TD></TR><TR><TD>
+Song</TD><TD>
+<INPUT TYPE=text NAME=SONG VALUE="<? print htmlspecialchars($SONG); ?>" >
+</TD></TR><TR><TD>
+Album</TD><TD>
+<INPUT TYPE=text NAME=VOLUME VALUE="<? print htmlspecialchars($VOLUME); ?>" >
+</TD></TR><TR><TD>
+Track number</TD><TD>
+<INPUT TYPE=text NAME=TRACKNO VALUE="<? print htmlspecialchars($TRACKNO); ?>" >
+</TD></TR><TR><TD>
+Comment</TD><TD>
+<INPUT TYPE=text NAME=COMMENT VALUE="<? print htmlspecialchars($COMMENT); ?>" MAXLENGTH=50 >
+</TD></TR><TR><TD>
+Year</TD><TD>
+<INPUT TYPE=text NAME=YEAR VALUE="<? print htmlspecialchars($YEAR); ?>" MAXLENGTH=4 >
+</TD></TR><TR><TD>
+Genre</TD><TD>
+<SELECT NAME=GENREID>
+<?
+
+$res=mysql_query("select id,name from genre");
+while(list($gid,$gname)=mysql_fetch_array($res)){
+	if($GENREID==$gid){
+		print "<OPTION VALUE=$gid SELECTED>$gname\n";
+		}
+	else {
+		print "<OPTION VALUE=$gid>$gname\n";
+		}
+	}
+?></SELECT></TD></TR>
+<TR><TD>
+Format:</TD><TD>
 <SELECT NAME=FORMAT>
 <?
 $res=mysql_query("select id,description,program,flags from formats order by description");
@@ -129,14 +154,17 @@
     } else
 	print "<OPTION VALUE=$id>$description\n";
 }
-?></SELECT><P>
-File<BR>
-<INPUT TYPE=text NAME=FILE VALUE="<? print htmlspecialchars($FILE); ?>" ><P>
+?></SELECT></TD></TR>
+<TR><TD>
+File</TD><TD>
+<INPUT TYPE=text NAME=FILE VALUE="<? print htmlspecialchars($FILE); ?>" ></TD></TR>
 <?
 if($OLDID) {
 ?>
-Reference volume<BR>
-<INPUT TYPE=text NAME=REFVOL VALUE="<? print htmlspecialchars($REFVOL); ?>" ><P>
+<TR><TD>
+Reference volume</TD><TD>
+<INPUT TYPE=text NAME=REFVOL VALUE="<? print htmlspecialchars($REFVOL); ?>" ></TD></TR>
+</TABLE>
 <TABLE>
 <TR><TD VALIGN=top><B>Conversions</B></TD><TD><?
 $res=mysql_query("select toid,description from transformations where priority >= 0 and fromid = '$FORMAT' order by description");
@@ -157,10 +185,11 @@
 <?
 } else {
 ?>
+
 <INPUT TYPE=hidden NAME=MAX_FILE_SIZE VALUE=1000000000>
 <? if (is_writeable($incomingdir)) { ?>
-Upload file<BR>
-<INPUT TYPE=file NAME=UPLOAD><P>
+<TR><TD>Upload file</TD><TD>
+<INPUT TYPE=file NAME=UPLOAD></TD></TR></TABLE>
 <? } ?>
 <INPUT TYPE=submit VALUE=Add>
 <? } ?>
diff -Naur 092402/gjukebox/www/admin.php genremod.offof092402/gjukebox/www/admin.php
--- 092402/gjukebox/www/admin.php	Sun Sep  1 08:41:39 2002
+++ genremod.offof092402/gjukebox/www/admin.php	Tue Sep 24 15:27:19 2002
@@ -217,7 +217,15 @@
 	        print "<OPTION>200\n";
 	    print "</SELECT>";
 	    break;
-	}
+	} elseif ($id=="OGGQUALITY"){
+		print "<SELECT NAME=$id style='width:170'>\n";
+		for($i=0;$i<=10;$i++){
+			if($i==$value){print "<OPTION SELECTED>$i\n";}
+			else{print "<OPTION>$i\n";}
+			}
+		print "</SELECT>";
+		break;	
+		}
       default:
         print "<INPUT NAME=$id VALUE=\"".htmlspecialchars($value)."\" style='width:170'>";
     }
diff -Naur 092402/gjukebox/www/info.php genremod.offof092402/gjukebox/www/info.php
--- 092402/gjukebox/www/info.php	Sun Sep  1 10:14:39 2002
+++ genremod.offof092402/gjukebox/www/info.php	Tue Sep 24 15:10:23 2002
@@ -87,10 +87,11 @@
 <LI>The default user is "<B>anonymous</B>" without any password. Make sure to add another user and delete this one when
 you are done. Make sure the new user also has priority 1 even though 11 is the default, otherwise you can not delete the first
 user.<P>
+<LI>If you can't upload via the Add Section, make sure that MAX_FILE_SIZE in php.ini is larger than the file your uploading.<P>
 If this was an upgrade, don't worry. Users aren't changed.<P>
 <LI>Make sure to at least glance through the <B>Administrate</B>, <B>Global settings</B>.<P>
 <LI>The Jukebox won't start playing until you first start the play daemon with the script <B>jukebox start</B>.<P>
-<LI>The easiest way to add songs is using the script <B>addmp3id3.pl</B> which requires the songs to have ID3 tags. If
+<LI>The easiest way to add songs is using the script <B>import.pl</B> which requires the songs to have comment tags. If
 they are missing these, but are organized in a strict directory hierarchy I recommend the utility
 <A HREF=http://easytag.sourceforge.net/><b>easytag</b></A>.<P>
 <LI>Also check out the utility organizemp3.pl which is a great way to keep your files in order in the filesystem, for more
@@ -182,4 +183,4 @@
 <? include "NEWS" ?>
 </PRE>
 </BODY>
-</HTML>
\ No newline at end of file
+</HTML>
diff -Naur 092402/gjukebox/www/program.php genremod.offof092402/gjukebox/www/program.php
--- 092402/gjukebox/www/program.php	Sun Sep  8 11:49:42 2002
+++ genremod.offof092402/gjukebox/www/program.php	Tue Sep 24 14:05:45 2002
@@ -365,13 +365,14 @@
     if ($NAME) {
 	$name=prepareDB($NAME);
 	$artist=prepareDB($ARTIST);
-        $prepri=fetchSetting("PRESELPRI");
+        $genreid=prepareDB($GENREID);
+	$prepri=fetchSetting("PRESELPRI");
 	if ($OLDID) {
-	    mysql_query("update programs set artist = $artist, name = $name where id = $OLDID");
+	    mysql_query("update programs set artist = $artist, name = $name,genre = $genreid where id = $OLDID");
 	    $group=$OLDID;
 	} else {
 	    if (!mysql_fetch_array(mysql_query("select id from programs where name = $name"))) {
-	        mysql_query("insert into programs values (0,$name,NULL,$artist,NULL,NULL)");
+	        mysql_query("insert into programs (id,name,cover,artist,cddbid,genre) values (0,$name,NULL,$artist,NULL,$genreid)");
 	    	$group=mysql_insert_id();
 	    }
 	}
@@ -467,27 +468,27 @@
 	$googlestring=prepareDB($GOOGLESEARCH);
 	$res = mysql_query("insert into ripqueue values (0,NULL,'program','$TOID',$artist,$googlestring,$program,$VIEW,0,'$MUSICUSER',NULL,NULL)");
     }
-    if ($UPLOAD) {
+    if ($UPLOAD) { #Add a song to an album
         list($program,$artist)=mysql_fetch_array(mysql_query("select name,artist from programs where id = $UPLOAD"));
 	$artist=prepareDB($artist);
 	$program=prepareDB($program);
-	mysql_query("insert into ripqueue values (0,NULL,'program','$TOID',$artist,'',$program,$UPLOAD,0,'$MUSICUSER',NULL,NULL)");
+	mysql_query("insert into ripqueue (id,fromid,toid,artist,title,album,file,status,user) values (0,'program','$TOID',$artist,'',$program,$UPLOAD,0,'$MUSICUSER')");
     }
-    if ($DEL) {
+    if ($DEL) { #Delete an Entire Album
         list($program,$artist)=mysql_fetch_array(mysql_query("select name,artist from programs where id = $DEL"));
 	$program=prepareDB($program);
 	$artist=prepareDB($artist);
-        mysql_query("insert into ripqueue values (0,NULL,'program','del',$artist,'',$program,$DEL,0,'$MUSICUSER',NULL,NULL)");
+        mysql_query("insert into ripqueue (id,fromid,toid,artist,title,album,file,status,user) values (0,'program','del',$artist,'',$program,$DEL,0,'$MUSICUSER')");
 	$HTTP_REFERER="program.php";
     }
-    if ($DELMEM) {
+    if ($DELMEM) { # delete a song from an Album
 	mysql_query("delete from programmember where id = $DELMEM");
 	list($num)=mysql_fetch_array(mysql_query("select count(*) from programmember where programid = $VIEW"));
 	if (!$num) {
 	    list($program,$artist)=mysql_fetch_array(mysql_query("select name,artist from programs where id = $VIEW"));
 	    $program=prepareDB($program);
 	    $artist=prepareDB($artist);
-            mysql_query("insert into ripqueue values (0,NULL,'program','del',$artist,'',$program,$VIEW,0,'$MUSICUSER',NULL,NULL)");
+            mysql_query("insert into ripqueue (id,fromid,toid,artist,title,album,file,status,user) values (0,'program','del',$artist,'',$program,$VIEW,0,'$MUSICUSER')");
 	}
     }
     if ($MOVE&&$TO) {
@@ -707,7 +708,7 @@
 
     if ($MUSICUSER&&!$onlydown) {
         if ($ADMIN) {
-	    list($name,$artist,$cover)=mysql_fetch_array(mysql_query("select name,artist,cover from programs where id = $ADMIN"));
+	    list($name,$artist,$cover,$genreid)=mysql_fetch_array(mysql_query("select name,artist,cover,genre from programs where id = $ADMIN"));
 	}
 
 	print "<TABLE>\n";
@@ -717,7 +718,18 @@
 
 	print "<INPUT TYPE=hidden NAME=OLDID VALUE=\"".$ADMIN."\">\nName:<BR>\n";
 	print "<INPUT TYPE=text NAME=NAME VALUE=\"".htmlspecialchars($name)."\"><P>Artist:<BR>\n";
-	print "<INPUT TYPE=text NAME=ARTIST VALUE=\"".htmlspecialchars($artist)."\"><P>\n";
+	print "<INPUT TYPE=text NAME=ARTIST VALUE=\"".htmlspecialchars($artist)."\"><P>Genre:<BR>\n";
+	print "<SELECT NAME=GENREID>";
+	$res=mysql_query("select id,name from genre");
+	while(list($gid,$gname)=mysql_fetch_array($res)){
+        	if($genreid==$gid){
+                	print "<OPTION VALUE=$gid SELECTED>$gname\n";
+                	}
+	        else {  
+        	        print "<OPTION VALUE=$gid>$gname\n";
+                	}
+	        }
+	print "</SELECT>";
 	print "<TABLE><TR><TD>";
 
 	if (!$ADMIN) {
diff -Naur 092402/gjukebox/www/right.php genremod.offof092402/gjukebox/www/right.php
--- 092402/gjukebox/www/right.php	Sat Aug 31 17:26:24 2002
+++ genremod.offof092402/gjukebox/www/right.php	Mon Sep 16 00:52:16 2002
@@ -114,6 +114,8 @@
 $sort[]="info";
 $sort[]="size";
 $sort[]="format";
+$sort[]="year";
+$sort[]="genre";
 
 if ($MUSICUSER&&!$URL) {
     $sort[]="volid";
@@ -155,6 +157,8 @@
 $sortname["info"]="Information";
 $sortname["size"]="Filesize";
 $sortname["format"]="Format";
+$sortname["year"]="Year";
+$sortname["genre"]="Genre";
 
 if ($DISP)
     $SEARCH="";
@@ -233,6 +237,12 @@
 	$formatDsc[$id]=$dsc;
 }
 
+if ($EXTRA=="genre"){
+    $res=mysql_query("select id,name from genre");
+    while(list($id,$name)=mysql_fetch_array($res))
+    	$genreNames[$id]=$name;
+    }
+
 if ($volids) {
     $volids="or volid in (".implode(",",$volids).")";
 }
@@ -899,7 +909,7 @@
 	    }
 	}
 	for($line=0;$line<count($qres);$line++) {
-	    list($id,$artist,$title,$extra,$url,$album,$format,$trackno)=$qres[$line];
+	    list($id,$artist,$title,$extra,$url,$album,$format,$trackno,$genreid,$year,$comment)=$qres[$line];
 	    if ($url) {
 		$artist=prepareDB($artist);
 		$title=prepareDB($title);
@@ -943,7 +953,7 @@
 		print "4.0\n";
 	    }
 	    for($line=0;$line<count($qres);$line++) {
-		list($id,$artist,$title,$extra,$sel,$volume,$format,$trackno)=$qres[$line];
+		list($id,$artist,$title,$extra,$sel,$volume,$format,$trackno,$genreid,$year,$comment)=$qres[$line];
 		if (!$sel||($volflags[$sel]&6)==2) {
 		    if (!$format)
 			print "$artist\001$title\001$extra\001action.php?$streamname=$id\n";
@@ -958,7 +968,7 @@
 		print "No songs found\n";
 	} else {
 	    for($line=0;$line<count($qres);$line++) {
-		list($id,$artist,$title,$extra,$sel,$album,$format,$trackno)=$qres[$line];
+		list($id,$artist,$title,$extra,$sel,$album,$format,$trackno,$genreid,$year,$comment)=$qres[$line];
 		if (!$sel)
 		    $sel=0;
 		if ($MUSICUSER&&!$onlydown) {
@@ -1008,12 +1018,15 @@
 		    if ($URL) {
 			$num=$line+1;
 			$form.="<INPUT TYPE=checkbox NAME=RIPLOTS[] VALUE=$num> ".
-			    "<INPUT TYPE=hidden NAME=URL$num VALUE=\"".htmlspecialchars($sel)."\">".
+				"<INPUT TYPE=hidden NAME=URL$num VALUE=\"".htmlspecialchars($sel)."\">".
 				"<INPUT TYPE=hidden NAME=ARTIST$num VALUE=\"".htmlspecialchars($artist)."\">".
-				    "<INPUT TYPE=hidden NAME=TITLE$num VALUE=\"".htmlspecialchars($title)."\">".
-					"<INPUT TYPE=hidden NAME=ALBUM$num VALUE=\"".htmlspecialchars($album)."\">".
-					    "<INPUT TYPE=hidden NAME=FORMAT$num VALUE=\"".htmlspecialchars($format)."\">".
-						"<INPUT TYPE=hidden NAME=TRACKNO$num VALUE=\"".htmlspecialchars($trackno)."\">";
+				"<INPUT TYPE=hidden NAME=TITLE$num VALUE=\"".htmlspecialchars($title)."\">".
+				"<INPUT TYPE=hidden NAME=ALBUM$num VALUE=\"".htmlspecialchars($album)."\">".
+				"<INPUT TYPE=hidden NAME=FORMAT$num VALUE=\"".htmlspecialchars($format)."\">".
+				"<INPUT TYPE=hidden NAME=TRACKNO$num VALUE=\"".htmlspecialchars($trackno)."\">".
+				"<INPUT TYPE=hidden NAME=GENREID$num VALUE=\"".htmlspecialchars($genreid)."\">".
+				"<INPUT TYPE=hidden NAME=YEAR$num VALUE=\"".htmlspecialchars($year)."\">".
+				"<INPUT TYPE=hidden NAME=COMMENT$num VALUE=\"".htmlspecialchars($comment)."\">";
 		    }
 		}
 		$xtit=ereg_replace("'","\\x27","$artist - $title");
@@ -1055,17 +1068,23 @@
 		    else
 			$href.="<A ".controlTarget();
 		    $href.=" HREF=action.php?RIPIT=".urlencode($sel)."&ARTIST=".urlencode($artist)."&TITLE=".urlencode($title).
-			"&VOLUME=".urlencode($album)."&FORMAT=$format&TRACKNO=$trackno".
-			    $addrow." onMouseOver=\"self.status='Fetch $xtit';return true\">";
+			"&VOLUME=".urlencode($album)."&FORMAT=$format&TRACKNO=$trackno&GENREID=genreid".
+			"&YEAR=$year&COMMENT=".urlencode($comment).
+			$addrow." onMouseOver=\"self.status='Fetch $xtit';return true\">";
 		} elseif ($GROUP||!$sel||($volmount[$sel]&&($volflags[$sel]&2)==2)) {
 		    $href="<A ".controlTarget()." HREF=action.php?SEL=$id onMouseOver=\"self.status='$xtit';return true\">";
 		} else {
 		    $href="";
 		}
-		if ($EXTRA=="format") {
+		if ($EXTRA=="format"&&$extra) {
 		    if ($formatDsc[$extra])
 			$extra=$formatDsc[$extra];
-		} if ($EXTRA=="length"&&$extra)
+		    } 
+		elseif ($EXTRA=="genre"&&$extra) {
+		    if ($genreNames[$extra])
+			$extra=$genreNames[$extra];
+		    }
+		elseif ($EXTRA=="length"&&$extra)
 		    $extra=sprintf("%d:%02d",$extra/60,$extra%60);
 		elseif ($EXTRA=="size"&&$extra)
 		    $extra=sprintf("%d Kb",($extra+1023)/1024);
diff -Naur 092402/gjukebox/www/tracks.php genremod.offof092402/gjukebox/www/tracks.php
--- 092402/gjukebox/www/tracks.php	Tue Aug 20 13:53:54 2002
+++ genremod.offof092402/gjukebox/www/tracks.php	Tue Sep 24 14:22:52 2002
@@ -52,31 +52,19 @@
     include "connect.php";
 }
 
-function insertPopupItem($selected, $namevalue)
-{
-    print "<OPTION VALUE=$namevalue";
-    if($namevalue==$selected)
-	print " SELECTED";
-
-    print ">$namevalue\n";
-}
-
 function insertGenres($mygenre)
 {
-
-    print "<SELECT NAME=GENRE>\n";
-    insertPopupItem($mygenre, "blues");
-    insertPopupItem($mygenre, "classical");
-    insertPopupItem($mygenre, "country");
-    insertPopupItem($mygenre, "data");
-    insertPopupItem($mygenre, "folk");
-    insertPopupItem($mygenre, "jazz");
-    insertPopupItem($mygenre, "misc");
-    insertPopupItem($mygenre, "newage");
-    insertPopupItem($mygenre, "reggae");
-    insertPopupItem($mygenre, "rock");
-    insertPopupItem($mygenre, "soundtrack");
-    print "</SELECT>\n";
+print "<SELECT NAME=GENREID>";
+$res=mysql_query("select id,name from genre");
+while(list($gid,$gname)=mysql_fetch_array($res)){
+        if($mygenre==$gid){
+                print "<OPTION VALUE=$gid SELECTED>$gname\n";
+                }
+        else {
+                print "<OPTION VALUE=$gid>$gname\n";
+                }
+        }
+print "</SELECT>";
 }
 
 $albumcovers=fetchsetting("COVERART");
@@ -164,8 +152,12 @@
 		print "</TR>\n<TR><TD><INPUT NAME=VOLUME VALUE=\"".htmlspecialchars($record)."\" SIZE = 40></TD>\n";
 		print "<TD>";
 
-		if($usecddb)
-		    insertGenres($genre);
+		if($usecddb){
+			if($genre == "newage"){$genre = "New Age";}
+			if($genre == "misc"){$genre = "Other";}
+			list($genreid)=mysql_fetch_array(mysql_query("select id from genre where name like '$genre'"));
+		    	insertGenres($genreid);
+			}
 
 		print "</TD>";
 
@@ -260,17 +252,18 @@
 		$lartist=$artist;
 	    }
 	    $cddbid = prepareDB($CDDBID);
-	    $genre = prepareDB($GENRE);
+	    $genreid = (INT)$GENREID;
+	    list($genre) = mysql_fetch_array(mysql_query("select name from genre where id = $GENREID"));
 	    $res=mysql_query("select id from programs where name = $volume and artist = $artist");
 	    if (!(list($songid)=mysql_fetch_array($res))) {
-	        mysql_query("insert into programs values (0,$volume,NULL,$artist,$cddbid,$genre)");
+	        mysql_query("insert into programs values (0,$volume,NULL,$artist,$cddbid,$genreid)");
 	        $songid=-mysql_insert_id();
 	    } else
 		$songid=-$songid;
 	    
 	    $progid = -$songid;
 	    if($COVER) {
-	      mysql_query("insert into ripqueue values (0,NULL,'program','cover_art',$artist,'--cdnow',$volume,$progid,0,'$MUSICUSER',NULL,NULL)");
+	      mysql_query("insert into ripqueue (id,fromid,toid,artist,title,album,file,status,user) values (0,'program','cover_art',$artist,'--cdnow',$volume,$progid,0,'$MUSICUSER')");
 	    }
 
 	} else
@@ -302,7 +295,7 @@
 	    $buffer = sprintf("%d\n", $numtracks);
 	    $num = fwrite($fs, $buffer);
 
-	    $buffer = sprintf( "%s\n%s\n%d\n", $VOLUME, $GENRE, $REVISION+1);
+	    $buffer = sprintf( "%s\n%s\n%d\n", $VOLUME, $genre, $REVISION+1);
 	    $num = fwrite($fs, $buffer);
 
 	    if($CDDBMULTIARTIST) {
@@ -321,10 +314,12 @@
 	}
 
 	if($usecddb) {
-
-	    print "Disc ID : ".$CDDBID." Genre : ".$GENRE."<BR>";
+	    print "Disc ID : ".$CDDBID." Genre : ".$genre."<BR>";
 
 	}
+	
+	if($YEAR){$year=prepareDB($YEAR);}
+	else{$year=0;}	
 
 	for($i=reset($INCLUDE);$i;$i=next($INCLUDE)) {
 	    $artist=prepareDB($art=${"ARTIST".$i});
@@ -333,7 +328,7 @@
             list($num)=mysql_fetch_array($res);
             if ($num==0) {
 		print "$art - $tit ($i)<BR>\n";
-		mysql_query("insert into ripqueue values(0,$songid,'cd','wav',$artist,$title,$volume,'$i',0,'$MUSICUSER',$i,NULL)");
+		mysql_query("insert into ripqueue (id,songid,fromid,toid,artist,title,album,file,status,user,trackno,genre,year) values (0,$songid,'cd','wav',$artist,$title,$volume,'$i',0,'$MUSICUSER',$i,$genreid,$year)");
 	    } else {
 		print "$art - $tit ($i) Already in jukebox<BR>\n";
 	    }
