2
* Copyright (C) 2011 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by Alex Launi <alex.launi@canonical.com>
22
namespace Unity.MusicLens {
24
public class Genre : GLib.Object
26
public static const string BLUES_ID = "blues";
27
public static const string CLASSIC_ID = "classic";
28
public static const string COUNTRY_ID = "country";
29
public static const string DISCO_ID = "disco";
30
public static const string FUNK_ID = "funk";
31
public static const string ROCK_ID = "rock";
32
public static const string METAL_ID = "metal";
33
public static const string HIPHOP_ID = "hip-hop";
34
public static const string HOUSE_ID = "house";
35
public static const string NEWWAVE_ID = "new-wave";
36
public static const string RANDB_ID = "r-and-b";
37
public static const string PUNK_ID = "punk";
38
public static const string JAZZ_ID = "jazz";
39
public static const string POP_ID = "pop";
40
public static const string REGGAE_ID = "reggae";
41
public static const string SOUL_ID = "soul";
42
public static const string TECHNO_ID = "techno";
43
public static const string OTHER_ID = "other";
45
private static TreeMultiMap<string, string> map;
46
private static Map<string, string> inverted_map;
50
map = new TreeMultiMap<string, string> ();
53
map.set (BLUES_ID, "blues");
56
map.set (CLASSIC_ID, "classic");
57
map.set (CLASSIC_ID, "classical");
58
map.set (CLASSIC_ID, "opera");
61
map.set (COUNTRY_ID, "country");
64
map.set (DISCO_ID, "disco");
67
map.set (FUNK_ID, "funk");
70
map.set (ROCK_ID, "rock");
71
map.set (ROCK_ID, "heavy");
72
map.set (ROCK_ID, "hard");
73
map.set (ROCK_ID, "rock and roll");
76
map.set (METAL_ID, "metal");
77
map.set (METAL_ID, "heavy");
78
map.set (METAL_ID, "heavy metal");
81
map.set (HIPHOP_ID, "hip-hop");
82
map.set (HIPHOP_ID, "rap");
83
map.set (HIPHOP_ID, "rap & hip hop");
86
map.set (HOUSE_ID, "house");
87
map.set (HOUSE_ID, "chillout");
88
map.set (HOUSE_ID, "minimal");
89
map.set (HOUSE_ID, "hard");
90
map.set (HOUSE_ID, "electronic");
91
map.set (HOUSE_ID, "dance");
94
map.set (NEWWAVE_ID, "new-wave");
97
map.set (RANDB_ID, "r-and-b");
98
map.set (RANDB_ID, "r&b");
101
map.set (PUNK_ID, "punk");
102
map.set (PUNK_ID, "punk rock");
103
map.set (PUNK_ID, "hardcore");
104
map.set (PUNK_ID, "heavy");
107
map.set (JAZZ_ID, "jazz");
110
map.set (POP_ID, "pop");
113
map.set (REGGAE_ID, "reggae");
116
map.set (SOUL_ID, "soul");
117
map.set (SOUL_ID, "gospel");
120
map.set (TECHNO_ID, "techno");
121
map.set (TECHNO_ID, "minimal");
122
map.set (TECHNO_ID, "trance");
123
map.set (TECHNO_ID, "chillout");
124
map.set (TECHNO_ID, "electronic");
125
map.set (TECHNO_ID, "electronica");
126
map.set (TECHNO_ID, "dance");
129
map.set (OTHER_ID, "other");
130
map.set (OTHER_ID, "african");
131
map.set (OTHER_ID, "alternative");
132
map.set (OTHER_ID, "ambient");
133
map.set (OTHER_ID, "asian");
134
map.set (OTHER_ID, "brazilian");
135
map.set (OTHER_ID, "celtic");
136
map.set (OTHER_ID, "christmas");
137
map.set (OTHER_ID, "folk");
138
map.set (OTHER_ID, "latin");
139
map.set (OTHER_ID, "oldies");
140
map.set (OTHER_ID, "soundtrack");
141
map.set (OTHER_ID, "traditional");
142
map.set (OTHER_ID, "world");
144
inverted_map = new HashMap<string, string> ();
145
foreach (var key in map.get_keys ())
147
var values_collection = map[key];
148
foreach (var val in values_collection)
150
inverted_map[val] = key;
155
public Collection<string> get_genre_synonyms (string genre_id)
157
if (map.contains (genre_id))
158
return map.get (genre_id);
160
return new LinkedList<string> ();
163
public string get_id_for_genre (string genre)
165
return inverted_map[genre] ?? OTHER_ID;