001 package helliker.id3;
002
003 /**
004 * Copyright (C) 2001,2002 Jonathan Hilliker This library is free software; you
005 * can redistribute it and/or modify it under the terms of the GNU Lesser
006 * General Public License as published by the Free Software Foundation; either
007 * version 2.1 of the License, or (at your option) any later version. This
008 * library is distributed in the hope that it will be useful, but WITHOUT ANY
009 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
010 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
011 * details. You should have received a copy of the GNU Lesser General Public
012 * License along with this library; if not, write to the Free Software
013 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
014 */
015 /**
016 * This class keeps track of all the genre numbers and their corresponding
017 * Strings based on the ID3 and Nullsoft standards.
018 */
019
020
021 public final class NullsoftID3GenreTable {
022
023 /**
024 * Description of the Field
025 */
026 private static final String[] genres = {
027 "Blues"
028 , "Classic Rock"
029 , "Country"
030 , "Dance"
031 , "Disco"
032 , "Funk"
033 , "Grunge"
034 , "Hip-Hop"
035 , "Jazz"
036 , "Metal"
037 , "New Age"
038 , "Oldies"
039 , "Other"
040 , "Pop"
041 , "R&B"
042 , "Rap"
043 , "Reggae"
044 , "Rock"
045 , "Techno"
046 , "Industrial"
047 , "Alternative"
048 , "Ska"
049 , "Death Metal"
050 , "Pranks"
051 , "Soundtrack"
052 , "Euro-Techno"
053 , "Ambient"
054 , "Trip-Hop"
055 , "Vocal"
056 , "Jazz+Funk"
057 , "Fusion"
058 , "Trance"
059 , "Classical"
060 , "Instrumental"
061 , "Acid"
062 , "House"
063 , "Game"
064 , "Sound Clip"
065 , "Gospel"
066 , "Noise"
067 , "AlternRock"
068 , "Bass"
069 , "Soul"
070 , "Punk"
071 , "Space"
072 , "Meditative"
073 , "Instrumental Pop"
074 , "Instrumental Rock"
075 , "Ethnic"
076 , "Gothic"
077 , "Darkwave"
078 , "Techno-Industrial"
079 , "Electronic"
080 , "Pop-Folk"
081 , "Eurodance"
082 , "Dream"
083 , "Southern Rock"
084 , "Comedy"
085 , "Cult"
086 , "Gangsta"
087 , "Top 40"
088 , "Christian Rap"
089 , "Pop/Funk"
090 , "Jungle"
091 , "Native American"
092 , "Cabaret"
093 , "New Wave"
094 , "Psychadelic"
095 , "Rave"
096 , "Showtunes"
097 , "Trailer"
098 , "Lo-Fi"
099 , "Tribal"
100 , "Acid Punk"
101 , "Acid Jazz"
102 , "Polka"
103 , "Retro"
104 , "Musical"
105 , "Rock & Roll"
106 , "Hard Rock"
107 , "Folk"
108 , "Folk-Rock"
109 , "National Folk"
110 , "Swing"
111 , "Fast Fusion"
112 , "Bebob"
113 , "Latin"
114 , "Revival"
115 , "Celtic"
116 , "Bluegrass"
117 , "Avantgarde"
118 , "Gothic Rock"
119 , "Progressive Rock"
120 , "Psychedelic Rock"
121 , "Symphonic Rock"
122 , "Slow Rock"
123 , "Big Band"
124 , "Chorus"
125 , "Easy Listening"
126 , "Acoustic"
127 , "Humour"
128 , "Speech"
129 , "Chanson"
130 , "Opera"
131 , "Chamber Music"
132 , "Sonata"
133 , "Symphony"
134 , "Booty Brass"
135 , "Primus"
136 , "Porn Groove"
137 , "Satire"
138 , "Slow Jam"
139 , "Club"
140 , "Tango"
141 , "Samba"
142 , "Folklore"
143 , "Ballad"
144 , "Power Ballad"
145 , "Rhythmic Soul"
146 , "Freestyle"
147 , "Duet"
148 , "Punk Rock"
149 , "Drum Solo"
150 , "A Capela"
151 , "Euro-House"
152 , "Dance Hall"
153 , "Goa"
154 , "Drum & Bass"
155 , "Club-House"
156 , "Hardcore"
157 , "Terror"
158 , "Indie"
159 , "BritPop"
160 , "Negerpunk"
161 , "Polsk Punk"
162 , "Beat"
163 , "Christian Gangsta Rap"
164 , "Heavy Metal"
165 , "Black Metal"
166 , "Crossover"
167 , "Contemporary Christian"
168 , "Christian Rock"
169 , "Merengue"
170 , "Salsa"
171 , "Thrash Metal"
172 , "Anime"
173 , "JPop"
174 , "SynthPop"
175 };
176
177
178 /**
179 * Return the corresponding String for the integer coded provided. Returns
180 * empty String if the code returned is invalid (less than 0 or greater than
181 * 125).
182 *
183 *@param i the genre code
184 *@return the genre String or null if the genre code is invalid
185 */
186 public static String getGenre(int i) {
187 String str = new String();
188
189 if ((i < genres.length) && (i >= 0)) {
190 str = genres[i];
191 }
192
193 return str;
194 }
195
196
197 /**
198 * Tries to find the string provided in the table and returns the
199 * corresponding int code if successful. Returns -1 if the genres is not found
200 * in the table.
201 *
202 *@param str the genre to search for
203 *@return the integer code for the genre or -1 if the genre is not found
204 */
205 public static int getGenre(String str) {
206 int retval = -1;
207
208 for (int i = 0; (i < genres.length) && (retval == -1); i++) {
209 if (genres[i].equalsIgnoreCase(str)) {
210 retval = i;
211 }
212 }
213
214 return retval;
215 }
216
217
218 /**
219 * Returns an array of all the genres which can be used to put into an
220 * OptionPane or some other component for easy display.
221 *
222 *@return an array of genres
223 */
224 public static String[] getGenres() {
225 return genres;
226 }
227
228 }
229