Added TagLib (with AUTORS and COPYING files)
[someplayer] / src / taglib / mpeg / id3v1 / id3v1genres.cpp
1 /***************************************************************************
2     copyright            : (C) 2002 - 2008 by Scott Wheeler
3     email                : wheeler@kde.org
4 ***************************************************************************/
5
6 /***************************************************************************
7  *   This library is free software; you can redistribute it and/or modify  *
8  *   it under the terms of the GNU Lesser General Public License version   *
9  *   2.1 as published by the Free Software Foundation.                     *
10  *                                                                         *
11  *   This library is distributed in the hope that it will be useful, but   *
12  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
14  *   Lesser General Public License for more details.                       *
15  *                                                                         *
16  *   You should have received a copy of the GNU Lesser General Public      *
17  *   License along with this library; if not, write to the Free Software   *
18  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
19  *   USA                                                                   *
20  *                                                                         *
21  *   Alternatively, this file is available under the Mozilla Public        *
22  *   License Version 1.1.  You may obtain a copy of the License at         *
23  *   http://www.mozilla.org/MPL/                                           *
24  ***************************************************************************/
25
26 #include "id3v1genres.h"
27
28 using namespace TagLib;
29
30 namespace TagLib {
31   namespace ID3v1 {
32
33     static const int genresSize = 148;
34     static const String genres[] = {
35       "Blues",
36       "Classic Rock",
37       "Country",
38       "Dance",
39       "Disco",
40       "Funk",
41       "Grunge",
42       "Hip-Hop",
43       "Jazz",
44       "Metal",
45       "New Age",
46       "Oldies",
47       "Other",
48       "Pop",
49       "R&B",
50       "Rap",
51       "Reggae",
52       "Rock",
53       "Techno",
54       "Industrial",
55       "Alternative",
56       "Ska",
57       "Death Metal",
58       "Pranks",
59       "Soundtrack",
60       "Euro-Techno",
61       "Ambient",
62       "Trip-Hop",
63       "Vocal",
64       "Jazz+Funk",
65       "Fusion",
66       "Trance",
67       "Classical",
68       "Instrumental",
69       "Acid",
70       "House",
71       "Game",
72       "Sound Clip",
73       "Gospel",
74       "Noise",
75       "Alternative Rock",
76       "Bass",
77       "Soul",
78       "Punk",
79       "Space",
80       "Meditative",
81       "Instrumental Pop",
82       "Instrumental Rock",
83       "Ethnic",
84       "Gothic",
85       "Darkwave",
86       "Techno-Industrial",
87       "Electronic",
88       "Pop-Folk",
89       "Eurodance",
90       "Dream",
91       "Southern Rock",
92       "Comedy",
93       "Cult",
94       "Gangsta",
95       "Top 40",
96       "Christian Rap",
97       "Pop/Funk",
98       "Jungle",
99       "Native American",
100       "Cabaret",
101       "New Wave",
102       "Psychedelic",
103       "Rave",
104       "Showtunes",
105       "Trailer",
106       "Lo-Fi",
107       "Tribal",
108       "Acid Punk",
109       "Acid Jazz",
110       "Polka",
111       "Retro",
112       "Musical",
113       "Rock & Roll",
114       "Hard Rock",
115       "Folk",
116       "Folk/Rock",
117       "National Folk",
118       "Swing",
119       "Fusion",
120       "Bebob",
121       "Latin",
122       "Revival",
123       "Celtic",
124       "Bluegrass",
125       "Avantgarde",
126       "Gothic Rock",
127       "Progressive Rock",
128       "Psychedelic Rock",
129       "Symphonic Rock",
130       "Slow Rock",
131       "Big Band",
132       "Chorus",
133       "Easy Listening",
134       "Acoustic",
135       "Humour",
136       "Speech",
137       "Chanson",
138       "Opera",
139       "Chamber Music",
140       "Sonata",
141       "Symphony",
142       "Booty Bass",
143       "Primus",
144       "Porn Groove",
145       "Satire",
146       "Slow Jam",
147       "Club",
148       "Tango",
149       "Samba",
150       "Folklore",
151       "Ballad",
152       "Power Ballad",
153       "Rhythmic Soul",
154       "Freestyle",
155       "Duet",
156       "Punk Rock",
157       "Drum Solo",
158       "A Cappella",
159       "Euro-House",
160       "Dance Hall",
161       "Goa",
162       "Drum & Bass",
163       "Club-House",
164       "Hardcore",
165       "Terror",
166       "Indie",
167       "BritPop",
168       "Negerpunk",
169       "Polsk Punk",
170       "Beat",
171       "Christian Gangsta Rap",
172       "Heavy Metal",
173       "Black Metal",
174       "Crossover",
175       "Contemporary Christian",
176       "Christian Rock",
177       "Merengue",
178       "Salsa",
179       "Thrash Metal",
180       "Anime",
181       "Jpop",
182       "Synthpop"
183     };
184   }
185 }
186
187 StringList ID3v1::genreList()
188 {
189   static StringList l;
190   if(l.isEmpty()) {
191     for(int i = 0; i < genresSize; i++)
192       l.append(genres[i]);
193   }
194   return l;
195 }
196
197 ID3v1::GenreMap ID3v1::genreMap()
198 {
199   static GenreMap m;
200   if(m.isEmpty()) {
201     for(int i = 0; i < genresSize; i++)
202       m.insert(genres[i], i);
203   }
204   return m;
205 }
206
207 String ID3v1::genre(int i)
208 {
209   if(i >= 0 && i < genresSize)
210     return genres[i];
211   return String::null;
212 }
213
214 int ID3v1::genreIndex(const String &name)
215 {
216   if(genreMap().contains(name))
217     return genreMap()[name];
218   return 255;
219 }