TNL.net is designed for modern browsers but the content is still readable in older ones. If you want to ensure the best experience, please install a browser that was developed after 2009.

tnl.net

Apple, XML, and the Music Store

Thanks to Tim Bray, we now know that there is an XML inter­face to the Apple Music Store. In the search for more infor­ma­tion to under­stand what was pro­vided to us and what they were get­ting from users buy­ing infor­ma­tion, I checked inside the actual track XML. In this case, I picked an XML sam­ple file from their site and dis­sected it. This is all very geeky so if you’re not inter­ested in the Apple store or in XML, no need to read on.

The fol­low­ing basi­cally tells us that we are deal­ing with an XML document.


It’s encoded in UTF-8, a for­mat that allows to show the largest pos­si­ble set of char­ac­ters. This clearly shows that Apple intends the store to be some­thing that they will use beyond the US as they might plan to use for­eign char­ac­ters in their XML definition.

Also of inter­est here is the note about stand­alone being no. This means that there is no inter­est in the doc­u­ment not being part of an appli­ca­tion (ie. the store).

Next up is the page definition:


Of inter­est here is the fact that they dif­fer­en­ti­ate the dif­fer­ent pages. This one is the result of a search so the pageType is set to search. I haven’t yet fid­dled with other pages but I sus­pect that they have other poten­tial use for this.

Once you’ve got your doc­u­ment defined, they break it down into three ele­ments:
Path, Scrol­lView and Track­List. Let’s look at those now.

The Path Element

The Path ele­ment basi­cally pro­vides infor­ma­tion as to where the doc­u­ment resides. Under the tag, you find a sub-element called PathEle­ment. It shows up as follows:


 /WebObjects/MZSearch.woa/21/wa/advancedSearchResults?songTerm=Morritz%20Discovers%20the%20Red%20Violin

Now what we have here is a page called “Search Results for: Mor­ritz Dis­cov­ers the Red Vio­lin” which is located at http://phobos.apple.com/WebObjects/MZSearch.woa/21/wa/advancedSearchResults?songTerm=Morritz%20Discovers%20the%20Red%20Violin

Basi­cally, what it gives is the loca­tion of the doc­u­ment. Noth­ing to find here.

The Scrol­lView Element

This one is a mon­ster of infor­ma­tion related to how to dis­play things on the screen. Of inter­est here is the fact that they posi­tion every­thing using a new form of XML and using out­side pointer files for font han­dling. It looks like Apple is using some WebOb­ject syn­tax to posi­tion their ele­ments on a page. Why they decided to do so is obvi­ous when you real­ize the NeXT used to be Steve Jobs com­pany and the Apple store is run­ning WebObject.

How­ever, it would have been much nicer if they were to do this as plain XHTML + CSS or XML + XSL. The syn­tax used in their file is bulky at best and, unfor­tu­nately, can only be parsed by using one of their tools right now.

The Track­List Element

This ele­ment describes meta­data about the par­tic­u­lar track (or tracks) you’re look­ing for. It’s using Apple’s Prop­erty List.

This is a great throve of data for any­one who might, in the future, want to develop a ser­vice that inte­grates with the Apple store. Let’s look at it in more details.

The first thing it does is tell you what type of list you’re deal­ing with:

list­Type
search

Basi­cally, all it’s doing here is telling you that this is a list that was the result of a search.

price­For­mat
$%0.2f

This tells you that the price for­mat is in tenth of a cent. An inter­est­ing thing as it seems to open up the poten­tial for micro­trans­ac­tion in the future. Based on the model they seem to be adopt­ing, you could tech­ni­cally go much lower than that, which shows some poten­tial for a future where you might end up pay­ing less than a cent per track. Interesting.

The next key is items. This can list sev­eral item. For the pur­pose of this exam­ple, I actu­ally looked for a search result that would return a sin­gle item but the same logic applies here whether you have one or many items. The string looks as follows:

Items

… and it is fol­lowed by an array that list each item.

So what info do we get about an item in the Apple store?

So here’s the real meat: What makes a track spe­cial. Every­thing here seems to be based on a key-value pair. I’m now build­ing up a table that will show how each relates:

kind string track This seems to show whether an item is a track or an album. I would assume that this could even­tu­ally expand to video, or other media format
artist­Name string Joshua Bell, Phil­har­mo­nia Orches­tra, Esa-Pekka Salonen This is basi­cally, the name of the artist
artis­tId string 462760 An inter­nal id. Why didn’t they use an inte­ger here?
bitRate Inte­ger 128 The bitrate at which the track is recorded. I would assume that they might plan to offer dif­fer­ent bitrates at dif­fer­ent prices in the future.
buy­Params string productType=S&salableAdamId=477149&price=990 Looks like a buy­ing para­me­ter. I sus­pect this is used to con­struct the URL. It seems a lit­tle odd to have that embed­ded when the other infor­ma­tion is already in the file. Hav­ing the price show up in two loca­tions seems to gen­er­ate extra over­head that is unec­es­sary, unless they are look­ing to sell items at dif­fer­ent prices to dif­fer­ent peo­ple. But the, why would it be in the XML fields?
price inte­ger 990 Inter­est­ing. This is in tenth of a cent. Could we see an even­tual sale of tracks for less than one cent?
com­poser­Name string JOHN CORIGLIANO (b.1938) Prob­a­bly more sort­ing meta­data but also use­ful for them in terms of track­ing which com­poser to remu­ner­ate. Why is the composer’s birth year in there?
com­poserId string 462764 Why is this value a string and not an inte­ger? Either way, it’s use­ful for apple as it allows them to track which com­poser they need to pay.
copy­right string 1999 SONY CLASSICAL This is the copy­right info for that track.
date­Mod­i­fied date 2003–04-25T02:17:02Z I sus­pect this is the date when the entry was mod­i­fied. This allows them to refresh data and keep track of when it was last updated
dis­c­Count inte­ger 1 I won­der if that’s the num­ber of disc on which the track appears.
dis­c­Num­ber inte­ger 1 Related to the field above?
dura­tion inte­ger 220000 Dura­tion of the track in milliseconds?
explicit inte­ger 0 This, I sus­pect, is to track whether a song has explicit lyrics or not. My sus­pi­cion is that the value is set to 0 if it does not and one if it does. I could fore­see Apple com­ing out with a “clean” ver­sion of the store that would be con­trolled through some parent-driven filter.
file­Ex­ten­sion string m4p This would allow Apple to sell dif­fer­ent media types in their store. If, for some rea­son, they had to move beyond the exist­ing for­mat, they would do it here. It also points to the pos­si­bil­ity of their sell­ing other media types from the store.
genre string Sound­track This is a basic clas­si­fi­ca­tion field.
gen­reId inte­ger 16 An ID linked to the clas­si­fi­ca­tion seen above.
playlist­Name string The Red Vio­lin (Sound­track from the
Motion Picture)
I sus­pect this is the name of the album on which the track appears.
playlis­tArtist­Name string Joshua Bell, Phil­har­mo­nia Orches­tra,
Esa-Pekka Salo­nen & The Red Violin
And, as above, this would be the artist for the whole album.
playlis­tArtis­tId inte­ger 462760 This is a unique num­ber to iden­tify the artist for the whole album.
playlis­tId string 462767 This seems to be an inter­nal id for the album. How­ever, I don’t know why they would use a string here instead of an integer.
pre­viewURL string http://a1328.phobos.apple.com
/Music/
y2003/m04/d11/h02/
s03.vyadggbi.p.m4p
This, I believe, is where the 30 sec­ond pre­view for the track resides. Of inter­est here is the clas­si­fi­ca­tion. Notice that there is a Music direc­tory in that URL. This seems to point to the fact that Apple is envi­sion­ing even­tu­ally sell­ing videos or other media types. The URL is then bro­ken down into year, month, day, hour, and… min­utes? This might be a mech­a­nism to rotate things and track when things are played, I suspect.
rel­e­vance string 1.0 I sus­pect that this is a rel­e­vance rank­ing based on how rel­e­vant the track is to your search.
release­Date string 1999–05-18T07:00:00Z When the album was released? Why is this a string instead of a date?
sam­pleR­ate inte­ger 44100 This gives infor­ma­tion as to what the sam­ple rate of the track is. This could point to Apple even­tu­ally intend­ing to sell tracks at dif­fer­ent sam­ple rates.
songId inte­ger 477149 A unique ref­er­ence ID for that song
com­ments string cur­rently empty Does that mean that we will see reviews from Apple here? Or maybe a user-based rat­ing sys­tem sim­i­lar to Amazon?
track­Count inte­ger 20 Num­ber of songs on the album
track­Num­ber inte­ger 16 Num­ber of that par­tic­u­lar song on the album. In this case, it’s the 16th song in a group of 20.
song­Name string Mor­ritz Dis­cov­ers the Red Violin The title of the song
year inte­ger 1999 The year the song was published

So Apple pro­vides a lot of infor­ma­tion in this. For starters, I’d like to com­pli­ment them on the breadth of meta­data they pro­vide on each track. This is clearly a great value add to any­one who wants prop­erly tagged music. How­ever, it seems that they could offer the tracks in other for­mats (MP3, or Ogg Vor­bis, maybe? ).

The other inter­est­ing thing when read­ing this file is what it reveals as to future poten­tial. It is pretty clear that they plan to offer the sys­tem world­wide. It is also inter­est­ing that they clas­sify things like media types as it could open up the poten­tial for the Apple movie store in the future. Also of inter­est was the choice in terms of how small the cur­rency incre­ments are as it could point to Apple even­tu­ally look­ing to sell things for less than a cent. Could we be look­ing at a rental sys­tem in the future? How­ever, there is no infor­ma­tion here yet as to what they get from us in terms of data. I’d still like to know that and, if any­one has point­ers, would be inter­ested in read­ing more about it.

Last but not least is why is it that Apple decided to cre­ate their own meta­data when other solu­tions (such as the ID3 sys­tem used in MP3s) seem to pro­vide sim­i­lar info? Some of it points to the poten­tial for a pro­pri­etary closed sys­tem but, by pub­lish­ing this data in the open, it seems that Apple is will­ing to take a step in the right direc­tion, that of openness.

My guess is that they will soon offer a web ser­vice inter­face to the store, sim­i­lar to the one offered by Ama­zon. It makes sense as it would allow a whole new com­mu­nity of devel­op­ers to cre­ate appli­ca­tions that would drive more money into Apple. How­ever, with­out a clear under­stand­ing as to the DRM setup, it is dif­fi­cult to esti­mate what ben­e­fit oth­ers might get from this.

Originally published on May 5, 2003 in Technology . You may find related thoughts pieces under the following terms: , ,