Class AcousticBrainz
- java.lang.Object
-
- com.tagtraum.core.WebService
-
- com.tagtraum.ubermusic.acousticbrainz.AcousticBrainz
-
- All Implemented Interfaces:
UberMusic
public class AcousticBrainz extends WebService implements UberMusic
Web service implementing the
UberMusicinterface to download high level data from AcousticBrainz.The service may use a secondary
UberMusicservice to look up the necessary track MBID (seeaddMbidLookupService(UberMusic)).- Author:
- Hendrik Schreiber
-
-
Field Summary
-
Fields inherited from class com.tagtraum.core.WebService
HTTP_METHOD_GET, HTTP_METHOD_POST, HTTP_METHOD_PUT
-
-
Constructor Summary
Constructors Constructor Description AcousticBrainz()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMbidLookupService(UberMusic mbidLookupService)Adds anUberMusicservice that is used to look up missing mbids.List<UberMusic>getMbidLookupServices()Service used to look up mbids.protected voidhandleStatusCode(HttpURLConnection httpURLConnection, int statusCode)Handles standard responses to status codes.List<AudioSong>lookup(AudioSong song)Looks up metadata for a song.List<AudioSong>lookup(String mbid)-
Methods inherited from class com.tagtraum.core.WebService
cacheResource, clearCache, getCache, getConnectTimeOut, getDomFactory, getJSONArray, getJSONArray, getJSONObject, getJSONObject, getJSONObjectWithPayload, getMaxAge, getReadTimeOut, getRequestDelay, getSSLSocketFactory, getUserAgent, getXmlDocument, getXmlObject, isAcceptGzipContentEncoding, openConnection, openConnection, openInputStream, readURL, setAcceptGzipContentEncoding, setCache, setConnectTimeOut, setDomFactory, setMaxAge, setNextAllowedConnection, setReadTimeOut, setRequestDelay, setSSLSocketFactory, setUserAgent, toParameterString, useCacheOnly, waitForTurn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.tagtraum.ubermusic.UberMusic
getArtists, getSimilarArtists, lookup, lookup
-
-
-
-
Method Detail
-
getMbidLookupServices
public List<UberMusic> getMbidLookupServices()
Service used to look up mbids.- Returns:
- service
-
addMbidLookupService
public void addMbidLookupService(UberMusic mbidLookupService)
Adds anUberMusicservice that is used to look up missing mbids.- Parameters:
mbidLookupService- mbid lookup service
-
lookup
public List<AudioSong> lookup(AudioSong song) throws IOException
Description copied from interface:UberMusicLooks up metadata for a song.- Specified by:
lookupin interfaceUberMusic- Parameters:
song- song (query by example)- Returns:
- reference songs, empty list, if the metadata is unavailable
- Throws:
IOException- IOException
-
lookup
public List<AudioSong> lookup(String mbid) throws IOException
- Throws:
IOException
-
handleStatusCode
protected void handleStatusCode(HttpURLConnection httpURLConnection, int statusCode) throws IOException
Description copied from class:WebServiceHandles standard responses to status codes.- Overrides:
handleStatusCodein classWebService- Parameters:
httpURLConnection- http url connectionstatusCode- status code- Throws:
IOException
-
-