Entity Framework and Charts

Entity Framework allows automatic setup of a database - including SQL. This intrigued me, and I also wished to refresh my Linq skills as they have gotten a bit rusty.

The first step was to get some real world relational data to use, and my music library needed some maintenance after being neglected for many years. I wrote a quick C# app based on MediaInfo.Wrapper.Core to extract the meta data from all files in my library, and then add some of the meta data to a database. I then programmatically iterated over all this data to make sure the meta data matched my file naming and wrote any inconsistencies to a log. I used the log to manually fix up the meta data with dbPoweramp (a recommended tool) and the album thumbnails with PerfectTUNES (also recommended).

The class that generates the database. MusicDatabase.cs (GitHub link)

The only issue I had was it seems a little too automatic. I set up the class and then wondered how to create the PKs and FKs. However, this had already been done - seemingly by magic. However, after further research it was all based on using a specific naming convention (details in the code comments).

The Linq queries used to extract the data. MusicVisualizer.cs (GitHub link)

The database could be created on this website, but as the data is static there is no need. Also, it could potentially start costing money, which I'm not keen on for a learning project.

Then I started some data mining and charting to see how my musical taste fares. The queries don't have any deep meaning, just examples of what can be done easily. Right mouse click and view in new tab to view in their full glory.

Tracks by year of release

Tracks by genre

Tracks per artist

Bands by EBM genre

Bands by Pop genre

Bands by Punk genre

Bands by Synthpop genre

Some takeaways

  • David Bowie is more prolific than I realized.
  • Genres seem pretty arbitrary - what is the difference between electronic, dance, and techno?
  • Rock is a very overused genre and seems to be a catch-all. How is classic rock different? What defines metal?
  • I seem to like Goth, Industrial, and EBM. The Classic rock segment is skewed due to the number of David Bowie tracks. Artists by genre would seem a better metric.
  • After a couple of minutes - band count by genre