<?php

include "gdweb.php";
include "gdwebdef.php";

print_header ("genre translation");

#phpinfo();
### constants
$id3g[  0] = "Blues";
$id3g[  1] = "Classic Rock";
$id3g[  2] = "Country";
$id3g[  3] = "Dance";
$id3g[  4] = "Disco";
$id3g[  5] = "Funk";
$id3g[  6] = "Grunge";
$id3g[  7] = "Hip-Hop";
$id3g[  8] = "Jazz";
$id3g[  9] = "Metal";
$id3g[ 10] = "New Age";
$id3g[ 11] = "Oldies";
$id3g[ 12] = "Other";
$id3g[ 13] = "Pop";
$id3g[ 14] = "R&B";
$id3g[ 15] = "Rap";
$id3g[ 16] = "Reggae";
$id3g[ 17] = "Rock";
$id3g[ 18] = "Techno";
$id3g[ 19] = "Industrial";
$id3g[ 20] = "Alternative";
$id3g[ 21] = "Ska";
$id3g[ 22] = "Death Metal";
$id3g[ 23] = "Pranks";
$id3g[ 24] = "Soundtrack";
$id3g[ 25] = "Euro-Techno";
$id3g[ 26] = "Ambient";
$id3g[ 27] = "Trip-Hop";
$id3g[ 28] = "Vocal";
$id3g[ 29] = "Jazz+Funk";
$id3g[ 30] = "Fusion";
$id3g[ 31] = "Trance";
$id3g[ 32] = "Classical";
$id3g[ 33] = "Instrumental";
$id3g[ 34] = "Acid";
$id3g[ 35] = "House";
$id3g[ 36] = "Game";
$id3g[ 37] = "Sound Clip";
$id3g[ 38] = "Gospel";
$id3g[ 39] = "Noise";
$id3g[ 40] = "Alt. Rock";
$id3g[ 41] = "Bass";
$id3g[ 42] = "Soul";
$id3g[ 43] = "Punk";
$id3g[ 44] = "Space";
$id3g[ 45] = "Meditative";
$id3g[ 46] = "Instrumental Pop";
$id3g[ 47] = "Instrumental Rock";
$id3g[ 48] = "Ethnic";
$id3g[ 49] = "Gothic";
$id3g[ 50] = "Darkwave";
$id3g[ 51] = "Techno-Industrial";
$id3g[ 52] = "Electronic";
$id3g[ 53] = "Pop-Folk";
$id3g[ 54] = "Eurodance";
$id3g[ 55] = "Dream";
$id3g[ 56] = "Southern Rock";
$id3g[ 57] = "Comedy";
$id3g[ 58] = "Cult";
$id3g[ 59] = "Gangsta Rap";
$id3g[ 60] = "Top 40";
$id3g[ 61] = "Christian Rap";
$id3g[ 62] = "Pop/Funk";
$id3g[ 63] = "Jungle";
$id3g[ 64] = "Native American";
$id3g[ 65] = "Cabaret";
$id3g[ 66] = "New Wave";
$id3g[ 67] = "Psychedelic";
$id3g[ 68] = "Rave";
$id3g[ 69] = "Showtunes";
$id3g[ 70] = "Trailer";
$id3g[ 71] = "Lo-Fi";
$id3g[ 72] = "Tribal";
$id3g[ 73] = "Acid Punk";
$id3g[ 74] = "Acid Jazz";
$id3g[ 75] = "Polka";
$id3g[ 76] = "Retro";
$id3g[ 77] = "Musical";
$id3g[ 78] = "Rock & Roll";
$id3g[ 79] = "Hard Rock";
$id3g[ 80] = "Folk";
$id3g[ 81] = "Folk/Rock";
$id3g[ 82] = "National Folk";
$id3g[ 83] = "Swing";
$id3g[ 84] = "Fast-Fusion";
$id3g[ 85] = "Bebob";
$id3g[ 86] = "Latin";
$id3g[ 87] = "Revival";
$id3g[ 88] = "Celtic";
$id3g[ 89] = "Bluegrass";
$id3g[ 90] = "Avantgarde";
$id3g[ 91] = "Gothic Rock";
$id3g[ 92] = "Progressive Rock";
$id3g[ 93] = "Psychedelic Rock";
$id3g[ 94] = "Symphonic Rock";
$id3g[ 95] = "Slow Rock";
$id3g[ 96] = "Big Band";
$id3g[ 97] = "Chorus";
$id3g[ 98] = "Easy Listening";
$id3g[ 99] = "Acoustic";
$id3g[100] = "Humour";
$id3g[101] = "Speech";
$id3g[102] = "Chanson";
$id3g[103] = "Opera";
$id3g[104] = "Chamber Music";
$id3g[105] = "Sonata";
$id3g[106] = "Symphony";
$id3g[107] = "Booty Bass";
$id3g[108] = "Primus";
$id3g[109] = "Porn Groove";
$id3g[110] = "Satire";
$id3g[111] = "Slow Jam";
$id3g[112] = "Club";
$id3g[113] = "Tango";
$id3g[114] = "Samba";
$id3g[115] = "Folklore";
$id3g[116] = "Ballad";
$id3g[117] = "Power Ballad";
$id3g[118] = "Rhythmic Soul";
$id3g[119] = "Freestyle";
$id3g[120] = "Duet";
$id3g[121] = "Punk Rock";
$id3g[122] = "Drum Solo";
$id3g[123] = "A Cappella";
$id3g[124] = "Euro-House";
$id3g[125] = "Dance Hall";
$id3g[126] = "Goa";
$id3g[127] = "Drum & Bass";
$id3g[128] = "Club-House";
$id3g[129] = "Hardcore";
$id3g[130] = "Terror";
$id3g[131] = "Indie";
$id3g[132] = "BritPop";
$id3g[133] = "Negerpunk";
$id3g[134] = "Polsk Punk";
$id3g[135] = "Beat";
$id3g[136] = "Christian Gangsta Rap";
$id3g[137] = "Heavy Metal";
$id3g[138] = "Black Metal";
$id3g[139] = "Crossover";
$id3g[140] = "Contemporary Christian";
$id3g[141] = "Christian Rock";
$id3g[142] = "Merengue";
$id3g[143] = "Salsa";
$id3g[144] = "Thrash Metal";
$id3g[145] = "Anime";
$id3g[146] = "JPop";
$id3g[147] = "Synthpop";

#######################################################################################
### Functions

function single_genre_association($id3genreid, $id3genrename, $gdgenreid){

  print "<tr>";
  print "<td>$id3genreid</td>";
  print "<td>&nbsp;$id3genrename</td>";
  print "<td>--&gt;</td>";
  print "<td>&nbsp;&nbsp;&nbsp;</td>";
  print "<td>";
  print "<select name=\"genre$id3genreid\">";
  print_genre_options($gdgenreid);
  print "</select>";
  print "</td>";
  #print "<td>(id=$gdgenreid)</td>";
  print "</tr>";
  
}

#######################################################################################

?>

<h3>Genre Translation Table</h3>
<p>
This table defines, how all the predefined id3-genres will 
be translated to 
GiantDisc genres. This is used when mp3 tracks are imported from the command line or from the inbox.

<p>
<form action="settings.php" method="get">

<input type="submit" value="save settings"></td></tr>
<input type="hidden" name="savegenretrans" value="1">
<table border="0">
<tr><td></td><td><b>id3 Genre</b></td><td></td><td></td><td><b>GiantDisc Genre</b></td></tr>

<?php 

  # open data source
  $dbh = mysql_connect();	


  foreach ($id3g as $index => $id3value){
    $recset = mysql_db_query ("GiantDisc", "SELECT * FROM genre WHERE id3genre=$index");

    if($row = mysql_fetch_array($recset)) {
	  # id3-genre already has a GD-genre association
      single_genre_association($index, $id3value, $row["id"]);
    }
	else{
	  # id3-genre does have no GD-genre association yet
      single_genre_association($index, $id3value, "");
	}
  mysql_free_result($recset);
  }
?>
</table>
<input type="submit" value="save settings"></td></tr>
<hr noshade>

</form>

<?php 
print_footer ("genre translation");

?>
