User:Kuno/ws/js/tracklist: Difference between revisions

From MusicBrainz Wiki
Jump to navigationJump to search
(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...)
 
No edit summary
Line 5: Line 5:
/ws/js/tracklist/<tracklist-row-id>
/ws/js/tracklist/<tracklist-row-id>


And the response should be something like this:
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):


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





Revision as of 06:48, 18 October 2010

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 (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.