001: /*
002: * This file is part of DrFTPD, Distributed FTP Daemon.
003: *
004: * DrFTPD is free software; you can redistribute it and/or modify
005: * it under the terms of the GNU General Public License as published by
006: * the Free Software Foundation; either version 2 of the License, or
007: * (at your option) any later version.
008: *
009: * DrFTPD is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU General Public License for more details.
013: *
014: * You should have received a copy of the GNU General Public License
015: * along with DrFTPD; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */
018: package org.drftpd.id3;
019:
020: import org.apache.log4j.Logger;
021:
022: /**
023: * @author Jamal
024: * @version $Id: ID3GenreList.java 1192 2005-06-15 21:38:30Z zubov $
025: */
026: public class ID3GenreList {
027: public static final String[] genres = { "Blues", "Classic Rock",
028: "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop",
029: "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop",
030: "R&B", "Rap", "Reggae", "Rock", "Techno", "Industrial",
031: "Alternative", "Ska", "Death Metal", "Pranks",
032: "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop",
033: "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical",
034: "Instrumental", "Acid", "House", "Game", "Sound Clip",
035: "Gospel", "Noise", "Alternative Rock", "Bass", "Soul",
036: "Punk", "Space", "Meditative", "Instrumental Pop",
037: "Instrumental Rock", "Ethnic", "Gothic", "Darkwave",
038: "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance",
039: "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta",
040: "Top 40", "Christian Rap", "Pop/Funk", "Jungle",
041: "Native US", "Cabaret", "New Wave", "Psychadelic", "Rave",
042: "Showtunes", "Trailer", "Lo-Fi", "Tribal", "Acid Punk",
043: "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll",
044: "Hard Rock", "Folk", "Folk-Rock", "National Folk", "Swing",
045: "Fast Fusion", "Bebob", "Latin", "Revival", "Celtic",
046: "Bluegrass", "Avantgarde", "Gothic Rock",
047: "Progressive Rock", "Psychedelic Rock", "Symphonic Rock",
048: "Slow Rock", "Big Band", "Chorus", "Easy Listening",
049: "Acoustic", "Humour", "Speech", "Chanson", "Opera",
050: "Chamber Music", "Sonata", "Symphony", "Booty Bass",
051: "Primus", "Porn Groove", "Satire", "Slow Jam", "Club",
052: "Tango", "Samba", "Folklore", "Ballad", "Power Ballad",
053: "Rhytmic Soul", "Freestyle", "Duet", "Punk Rock",
054: "Drum Solo", "Acapella", "Euro-House", "Dance Hall", "Goa",
055: "Drum & Bass", "Club-House", "Hardcore", "Terror", "Indie",
056: "BritPop", "Negerpunk", "Polsk Punk", "Beat",
057: "Christian Gangsta", "Heavy Metal", "Black Metal",
058: "Crossover", "Contemporary C", "Christian Rock",
059: "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop",
060: "SynthPop" };
061:
062: private static final Logger logger = Logger
063: .getLogger(ID3GenreList.class);
064:
065: /** Returns the Genre for given number
066: * @return Genre as String
067: */
068: public static String getGenre(int number) {
069: int index = number & 0xff;
070: try {
071: return genres[index];
072: } catch (ArrayIndexOutOfBoundsException e) {
073: logger.warn("Unknown genre number: " + index);
074: return "";
075: }
076: }
077:
078: /** Checks, if the given genre is a valid one
079: * @return boolean
080: */
081: public static boolean validateGenre(String genre) {
082: if (getGenreIndex(genre) != -1) {
083: return true;
084: }
085:
086: return false;
087: }
088:
089: /** Returns the array index of this genre, or -1 if it is an invalid one.
090: * @return int array index
091: */
092: public static int getGenreIndex(String genre) {
093: int index = -1;
094:
095: for (int i = 0; i < genres.length; i++) {
096: if (genre.equals(genres[i])) {
097: index = i;
098: }
099: }
100:
101: return index;
102: }
103: }
|