com.ldodds.musicbrainz
Class MusicBrainzImpl

java.lang.Object
  |
  +--com.ldodds.musicbrainz.MusicBrainzImpl
All Implemented Interfaces:
MusicBrainz

public class MusicBrainzImpl
extends java.lang.Object
implements MusicBrainz

Author:
ldodds

Field Summary
static java.lang.String CGI_PATH
           
static java.lang.String DEFAULT_SERVER
           
 
Fields inherited from interface com.ldodds.musicbrainz.MusicBrainz
CD_INDEX_ID_LENGTH, MB_ID_LENGTH, VARIOUS_ARTISTS
 
Constructor Summary
MusicBrainzImpl()
           
MusicBrainzImpl(java.lang.String server)
           
 
Method Summary
 Model findAlbumByName(java.lang.String albumName, int depth, int maxItems)
          Use this query to find albums by name.
 Model findArtistByName(java.lang.String artistName, int depth, int maxItems)
          Use this query to find artists by name.
 Model findDistinctTRMId(java.lang.String artistName, java.lang.String trackName, int depth)
          Use this function to find TRM Ids that match a given artistName and trackName, This query returns a trmidList.
 Model findTrackByName(java.lang.String trackName, int depth, int maxItems)
          Use this query to find tracks by name.
 Model getAlbumById(java.lang.String albumid, int depth)
          Retrieve an albumList from a given Album id
 Model getArtistById(java.lang.String artistid, int depth)
          Retrieve an artistList from a given Artist id
 Model getCDInfoFromCDIndexId(java.lang.String cdindexid, int depth)
          Use this query to return an albumList for the given CD Index Id
 Model getQuickTrackInfoFromTrackId(java.lang.String trackid, java.lang.String albumid)
          Use this query to return the basic metadata information (artistname, albumname, trackname, tracknumber) for a given track mb id
 Model getTrackById(java.lang.String trackid, int depth)
          Retrieve a trackList from a given Track id
 Model getTrackByTRMId(java.lang.String trmid, int depth)
          Retrieve a trackList from a given TRM id
 Model getTrackInfoFromTRMId(java.lang.String trmid, java.lang.String artistName, java.lang.String albumName, java.lang.String trackName, java.lang.String trackNum, java.lang.String duration)
          Use this query to return the metadata information (artistname, albumname, trackname, tracknumber) for a given trm id.
 void setServer(java.lang.String server)
          Configure the MusicBrainz server to use for the queries
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SERVER

public static final java.lang.String DEFAULT_SERVER
See Also:
Constant Field Values

CGI_PATH

public static final java.lang.String CGI_PATH
See Also:
Constant Field Values
Constructor Detail

MusicBrainzImpl

public MusicBrainzImpl()

MusicBrainzImpl

public MusicBrainzImpl(java.lang.String server)
Method Detail

findAlbumByName

public Model findAlbumByName(java.lang.String albumName,
                             int depth,
                             int maxItems)
                      throws java.io.IOException
Description copied from interface: MusicBrainz
Use this query to find albums by name. This function returns an albumList for the given album name.

Specified by:
findAlbumByName in interface MusicBrainz
Parameters:
albumName - The name of the album to find.
depth - level of detail in response. Set depth to be 4 to get details of artist and all tracks
maxItems - maximum number of items to return
java.io.IOException

findArtistByName

public Model findArtistByName(java.lang.String artistName,
                              int depth,
                              int maxItems)
                       throws java.io.IOException
Description copied from interface: MusicBrainz
Use this query to find artists by name. This function returns an artistList for the given artist name.

Specified by:
findArtistByName in interface MusicBrainz
Parameters:
artistName - The name of the artist to find.
depth - level of detail in response
maxItems - maximum number of items to return
java.io.IOException

findDistinctTRMId

public Model findDistinctTRMId(java.lang.String artistName,
                               java.lang.String trackName,
                               int depth)
                        throws java.io.IOException
Description copied from interface: MusicBrainz
Use this function to find TRM Ids that match a given artistName and trackName, This query returns a trmidList. TODO resolve the expected behaviour of this: even for known tracks I get no useful results. This appears to be a bug in the MusicBrainz server code.

Specified by:
findDistinctTRMId in interface MusicBrainz
Parameters:
artistName - The name of the artist to find.
trackName - The name of the track to find.
depth - level of detail in response
java.io.IOException

findTrackByName

public Model findTrackByName(java.lang.String trackName,
                             int depth,
                             int maxItems)
                      throws java.io.IOException
Description copied from interface: MusicBrainz
Use this query to find tracks by name. This function returns a trackList for the given track name.

Specified by:
findTrackByName in interface MusicBrainz
Parameters:
trackName - The name of the track to find.
depth - level of detail in response
maxItems - maximum number of items to return
java.io.IOException

getAlbumById

public Model getAlbumById(java.lang.String albumid,
                          int depth)
                   throws java.io.IOException
Description copied from interface: MusicBrainz
Retrieve an albumList from a given Album id

Specified by:
getAlbumById in interface MusicBrainz
Parameters:
albumid - MB id of the album
depth - level of detail in the result
java.io.IOException

getArtistById

public Model getArtistById(java.lang.String artistid,
                           int depth)
                    throws java.io.IOException
Description copied from interface: MusicBrainz
Retrieve an artistList from a given Artist id

Specified by:
getArtistById in interface MusicBrainz
Parameters:
artistid - MB id of the artist
depth - level of detail in the result
java.io.IOException

getCDInfoFromCDIndexId

public Model getCDInfoFromCDIndexId(java.lang.String cdindexid,
                                    int depth)
                             throws java.io.IOException
Description copied from interface: MusicBrainz
Use this query to return an albumList for the given CD Index Id

Specified by:
getCDInfoFromCDIndexId in interface MusicBrainz
Parameters:
cdindexid - The cdindex id to look up at the remote server.
depth - level of detail in query response
java.io.IOException

getQuickTrackInfoFromTrackId

public Model getQuickTrackInfoFromTrackId(java.lang.String trackid,
                                          java.lang.String albumid)
                                   throws java.io.IOException
Description copied from interface: MusicBrainz
Use this query to return the basic metadata information (artistname, albumname, trackname, tracknumber) for a given track mb id

Specified by:
getQuickTrackInfoFromTrackId in interface MusicBrainz
Parameters:
trackid - The MB track id for the track to be looked up
albumid - The MB album id for the track to be looked up
java.io.IOException

getTrackById

public Model getTrackById(java.lang.String trackid,
                          int depth)
                   throws java.io.IOException
Description copied from interface: MusicBrainz
Retrieve a trackList from a given Track id

Specified by:
getTrackById in interface MusicBrainz
Parameters:
trackid - MB id of the album
depth - level of detail in the result
java.io.IOException

getTrackByTRMId

public Model getTrackByTRMId(java.lang.String trmid,
                             int depth)
                      throws java.io.IOException
Description copied from interface: MusicBrainz
Retrieve a trackList from a given TRM id

Specified by:
getTrackByTRMId in interface MusicBrainz
Parameters:
depth - level of detail in the result
java.io.IOException

getTrackInfoFromTRMId

public Model getTrackInfoFromTRMId(java.lang.String trmid,
                                   java.lang.String artistName,
                                   java.lang.String albumName,
                                   java.lang.String trackName,
                                   java.lang.String trackNum,
                                   java.lang.String duration)
                            throws java.io.IOException
Description copied from interface: MusicBrainz
Use this query to return the metadata information (artistname, albumname, trackname, tracknumber) for a given trm id. Optionally, you can also specifiy the basic artist metadata, so that if the server cannot match on the TRM id, it will attempt to match based on the basic metadata. In case of a TRM collision (where one TRM may point to more than one track) this function will return more than on track. The user (or tagging app) must decide which track information is correct.

Specified by:
getTrackInfoFromTRMId in interface MusicBrainz
Parameters:
trmid - The TRM id for the track to be looked up
artistName - The name of the artist
albumName - The name of the album
trackName - The name of the track
trackNum - The number of the track
java.io.IOException

setServer

public void setServer(java.lang.String server)
Description copied from interface: MusicBrainz
Configure the MusicBrainz server to use for the queries

Specified by:
setServer in interface MusicBrainz
Parameters:
server - MB server to use for queries