User:Kuno/ws/js/tracklist

From MusicBrainz Wiki
< User:Kuno‎ | ws/js
Revision as of 14:10, 13 October 2010 by Kuno (talk | contribs) (New page: Hello Oliver! I think I want to render disc format and title as part of the collapsed discs, so they don't need to be included in a /ws/js call for the tracklist tab. If I also include t...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Hello Oliver!

I think I want to render disc format and title as part of the collapsed discs, so they don't need to be included in a /ws/js call for the tracklist tab. If I also include the tracklist id when rendering the collapsed discs, I can just call:

 /ws/js/tracklist/<tracklist-row-id>

And the response should be something like this:

{
    "format": 1,                          # format id
    "title": "",                          # disc title, if any.
    "tracks": [
        {
            "length": "4:03",             # track length, preferably already formatted.
            "title":  "the Love Bug",     # track title.
            "artist": {
                "preview": "m-flo♥BoA",
                "names": [
                    {
                        "gid": "22dd2db3-88ea-4428-a7a8-5cd3acf23175",
                        "name": "m-flo",    
                        "credit": "m-flo",
                        "join": "♥",        
                    },
                    {
                        "gid": "a16d1433-ba89-4f72-a47b-a370add0bb55",
                        "name": "BoA",
                        "credit": "BoA",
                        "join": null,
                    }                                       
                ]
            }
        }
    ]   
} 


further notes:

  • the artist/recording lookups may use the external search, which uses GIDs instead of row ids, so for consistency it seems better to not use row ids in these json responses.
  • including the artist credit preview isn't technically neccesary, we have code in javascript anyway to render artist credits, so you can leave it off if you prefer.
  • if you want to name certain keys differently because of consistency with the database or the perl code, be my guest.