Simple wrapper for the Gracenote Music API using the WEB API.
It can be downloaded from Github, or you can download it through RiaForge.
You will need a Gracenote Client ID which you can get from https://developer.gracenote.com/
Each Application needs to have a User ID. You can obtain a User ID by registering your client ID with the Gracenote API. This can be achieved with the register() method of this component.
The WEB API only deals with sending and recieving XML. You can specify in the Gracenote component if you would like to return JSON instead of XML. There are two ways to do this. One is to set the returnType argument in the init() method to either JSON or XML(default). The other way is to call setReturnType('json|xml') before doing a search. The Gracenote component converts the XML to a JSON string before returning it to the user.
If/When JSON is supported from the WEB API, I'll update this component to use their JSON returned.
<!--- pass in clientID, userID (if available) and returnType (XML or JSON) --->
<cfset gracenote = new lib.Gracenote('XXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX','',"xml|json")>
<!---
Registering Client ID with the API
You should cache the userID returned from the register() function as you should only call this once.
If you store the Gracenote.cfc in a persistent scope, register() should ignore multiple calls.
--->
<cfset user = gracenote.register()>
<!---search by Album--->
<cfset search = gracenote.albumSearch('Moby','Play','Porcelin')>
<cfdump var="#search#">
<hr/>
<!---search by Album Table of Contents--->
<cfset search = gracenote.albumTOC("150 20512 30837 50912 64107 78357 90537 110742 126817 144657 153490 160700 175270 186830 201800 218010 237282 244062 262600 272929")>
<cfdump var="#search#">
<hr/>
<!---Fetch Album by using the Gracenote Identifier (GNID)--->
<cfset search = gracenote.fetchByGNID("97474325-8C600076B380712C6D1C5DC5DC5674F1")>
<cfdump var="#search#">