Question

I am writing my own little (web based) music player at the moment. But I am failing because of some albums. I store all the information about songs, albums, and artists in a NoSQL database, like this:

{
    "artist" : "Some artist",
    "albums" :
    [
        {
            "name": "Some album",
            "info" :
            {
                "id" : ObjectId("534a7d66f1053d665015825b"),
                "released" : "2013"
            },
            "songs" :
            [
                {
                    "name" : "Some song",
                    "file" : "music.mp3",
                    "time" : 219,
                    "id" : ObjectId("534a7d66f1053d665015825c")
                }
            ]
        }
    ],
    "_id" : ObjectId("534a7d66f1053d665015825d")
}

Now I want to show the user all the albums he owns. No problem. Loop through all artists, select all albums, show them to the user. This would work great weren't there no compilations. When I show all albums like descriped above, the user sees the compilation multiple times, once per artist.

Now I looked at my current music player - Banshee - and saw that it shows all compilations as albums from "Various". But how does it know? It's not in the ID3 tags. The only thing I could think of would be somethink like: If more than half of the songs are from different artists -> "Various". Is this the solution? Or do you guys know something else?

Was it helpful?

Solution

Things to consider:

  • I think the best solution would be to use an ID3Tag which most players understand. ID3 does not really contains a tag which accomplishes this, but there are several tags that can be used for this. See this answer for explanation.
  • The algorithm you propose will work most in the time, but there are two corner cases.
    1. an album from artist but mixed with many "feat.", e.g. Featuring Luciana
    2. an album containing only two or three artists but still it is a compilation
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top