Development/ws/js

From MusicBrainz Wiki
< Development
Revision as of 13:02, 20 October 2010 by Kuno (talk | contribs) (New page: =Tracklist= 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 th...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Tracklist

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 (this example contains just one track, a typical tracklist will obviously have more tracks as part of the top-level array):

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


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.