Currently, I have an empty genres table that looks like this:
My thought when I created it was I’d just use booleans for each column (except artistID, of course). I was going to use these as a short list of categories to create charts with but I’m now thinking I want to use all of the genres Spotify may provide.
Their console gave me the following genres for Alice Cooper:
"genres": [ "album rock", "classic rock", "comic", "glam metal", "glam rock", "hard rock", "metal", "protopunk", "rock" ]
I’m fine with that. I wrote about Spotify genres once before, wondering how artists were assigned genres. Were tracks and albums assigned genres and the artist was then assigned all of those? That makes the most sense to me, but I don’t think that’s how Spotify does it.
I wanted to test and dig around but despite the fact that Alice Cooper has tracks that might not fit any of those genres, I couldn’t think of an Alice Cooper album that would go beyond those listed above. So I did Iggy Pop:
"genres": [ "alternative rock", "classic rock", "dance rock", "garage rock", "glam rock", "new wave", "permanent wave", "protopunk", "punk", "rock" ]
The first thing I notice is Alice didn’t get “punk” despite being voted “Punk of the Year” in 1973 by Cream magazine readers. I don’t even know what “permanent wave” is. Anyway, I chose Iggy because I wondered what genre his two French language jazz albums might fall under.
One version of Preliminaires has a genres property but no values.
Same. No surprise.
As a “control group,” I also tried:
- Raw Power – nope, no genres
- Lust for Life – no genres
Anyway … what I’m wondering is — can I use Spotify’s genres in the way that I want to? If I want a list of punk bands, will One Bad Pig appear or not? If they don’t, I can add the genres myself … the question really is, I guess … how do I design the table(s)? Maybe just a two-column table (artistID, genre) with an index for each. And … create a function that
- gets an artist
- gets the genres array
- for each genre in genre, insert a row with the artistID and the genre
Man, I hope the spelling for their genres is standardized … like … no “Funk” and “Phunk” or some such nonsense.
Yeah, that’s what I’ll do.
One Bad Pig, by the way, gets:
"genres": [ "christian metal", "christian punk", "deep christian rock" ]
See, this is why I didn’t want to use Spotify’s genres. I have to write extra code to make sure a “punk” chart includes “punk” but also “protopunk” as well as “christian punk” and … whatever else. Seriously — ew.
The silver lining is, it will all make for a killer relationship chart.