com.ldodds.musicbrainz
Interface MusicBrainz

All Known Implementing Classes:
MusicBrainzImpl

public interface MusicBrainz

MusicBrainz query interface.

This interface is basically a Java port of the queries defined in queries.h file included in the libmusicbrainz source distribution. That file also defines a several methods for navigating through an RDF response from a query. These methods aren't included here, see MusicBrainzSelectors for some helper methods for navigating through the Model created by the query methods in this interface Doesn't support submission and authentication. i.e. read-only. Also doesn't support FileInfoLookup yet.

Author:
ldodds

Field Summary
static int CD_INDEX_ID_LENGTH
          Length of a MusicBrainz CD Index Id
static int MB_ID_LENGTH
          Length of a MusicBrain Artist/Album/Track Id
static java.lang.String VARIOUS_ARTISTS
          The MusicBrainz ID used to indicate that an album is a "various artists" album (i.e.
 
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
 

Field Detail

VARIOUS_ARTISTS

public static final java.lang.String VARIOUS_ARTISTS
The MusicBrainz ID used to indicate that an album is a "various artists" album (i.e. a compilation).

See Also:
Constant Field Values

CD_INDEX_ID_LENGTH

public static final int CD_INDEX_ID_LENGTH
Length of a MusicBrainz CD Index Id

See Also:
Constant Field Values

MB_ID_LENGTH

public static final int MB_ID_LENGTH
Length of a MusicBrain Artist/Album/Track Id

See Also:
Constant Field Values
Method Detail

setServer

public void setServer(java.lang.String server)
Configure the MusicBrainz server to use for the queries

Parameters:
server - MB server to use for queries

getCDInfoFromCDIndexId

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

Parameters:
cdindexid - The cdindex id to look up at the remote server.
depth - level of detail in query response
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
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.

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

getQuickTrackInfoFromTrackId

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

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

findArtistByName

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

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

findAlbumByName

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

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

findTrackByName

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

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

findDistinctTRMId

public Model findDistinctTRMId(java.lang.String artistName,
                               java.lang.String trackName,
                               int depth)
                        throws java.io.IOException
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.

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

getArtistById

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

Parameters:
artistid - MB id of the artist
depth - level of detail in the result
java.io.IOException

getAlbumById

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

Parameters:
albumid - MB id of the album
depth - level of detail in the result
java.io.IOException

getTrackById

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

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
Retrieve a trackList from a given TRM id

Parameters:
depth - level of detail in the result
java.io.IOException