Package com.tagtraum.ubermusic.beatport
Class Beatport
- java.lang.Object
-
- com.tagtraum.core.WebService
-
- com.tagtraum.ubermusic.beatport.Beatport
-
- All Implemented Interfaces:
Charts,NewReleases,UberMusic
public class Beatport extends WebService implements UberMusic, Charts, NewReleases
Beatport.- Author:
- Hendrik Schreiber
-
-
Field Summary
-
Fields inherited from class com.tagtraum.core.WebService
HTTP_METHOD_GET, HTTP_METHOD_POST, HTTP_METHOD_PUT, LOG
-
-
Constructor Summary
Constructors Constructor Description Beatport()Beatport webservice.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(PropertyChangeListener listener)voidaddPropertyChangeListener(String property, PropertyChangeListener listener)voidauthorize()Initiate authorization procedure.voiddeauthorize()De-authorize this account.AudioArtistgetArtist(long artistId)Get artist with Beatport id.List<AudioArtist>getArtists(AudioSong song)Lookup artists for a song.List<AudioArtist>getArtists(String artist)Get list of artists with a given name.List<PlayList>getCharts(Locale market)List<BeatportGenre>getGenres()Get genre hierarchy.List<AudioSong>getMostPopular(Long genreId, String country)Get most popular tracks for a given genre and country/market.StringgetName()Name of this chart provider.List<AudioSong>getNewReleases(Long genreId)Get new releases (last month) for a given genre.List<PlayList>getNewReleases(Locale market)AudioSonggetTrack(long id)Get track for a given Beatport id.List<AudioSong>getTracks(String name, String artist, String album)Get list of tracks matching the given criteria.booleanisAuthorized()Determine, whether we are authorized to perform Beatport requests.Stringlocalize(String key, Object... objects)List<AudioSong>lookup(AudioSong song)Looks up metadata for a song.voidremovePropertyChangeListener(PropertyChangeListener listener)voidremovePropertyChangeListener(String property, PropertyChangeListener listener)-
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, handleStatusCode, 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
getSimilarArtists, lookup, lookup
-
-
-
-
Constructor Detail
-
Beatport
public Beatport()
Beatport webservice. Authorization is repeatedly attempted on initialization and on each use after authorization expired or access was denied.- See Also:
authorize(),isAuthorized()
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:ChartsName of this chart provider.
-
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
-
getCharts
public List<PlayList> getCharts(Locale market) throws IOException
Description copied from interface:ChartsFetch charts in the form ofPlayLists for the givenLocale. These lists may be specific to genre or other properties.- Specified by:
getChartsin interfaceCharts- Parameters:
market- locale market to use for lookup, if the implementation supports localization- Returns:
- list of charts
- Throws:
IOException
-
getNewReleases
public List<PlayList> getNewReleases(Locale market) throws IOException
Description copied from interface:NewReleasesFetch new releases in the form ofPlayLists for the givenLocale. These lists may be specific to genre or other properties.- Specified by:
getNewReleasesin interfaceNewReleases- Parameters:
market- locale market to use for lookup, if the implementation supports localization- Returns:
- list of new releases
- Throws:
IOException
-
getArtists
public List<AudioArtist> getArtists(AudioSong song) throws IOException
Description copied from interface:UberMusicLookup artists for a song. The default implementation returns an empty list.- Specified by:
getArtistsin interfaceUberMusic- Parameters:
song- song- Returns:
- list of similar artists that seem to match the given song
- Throws:
IOException- IOException
-
getArtists
public List<AudioArtist> getArtists(String artist) throws IOException
Get list of artists with a given name.- Parameters:
artist- artist name- Returns:
- list of artists, or empty list of none are found
- Throws:
IOException
-
getArtist
public AudioArtist getArtist(long artistId) throws IOException
Get artist with Beatport id.- Parameters:
artistId- id- Returns:
- an artist object or null, if not found.
- Throws:
IOException
-
getTracks
public List<AudioSong> getTracks(String name, String artist, String album) throws IOException
Get list of tracks matching the given criteria. Any of the parameters may be null. If all parameters are null, an empty list is returned.- Parameters:
name- titleartist- artist namealbum- release name- Returns:
- a list of matching tracks.
- Throws:
IOException
-
getTrack
public AudioSong getTrack(long id) throws IOException
Get track for a given Beatport id.- Parameters:
id- id- Returns:
- track or null of not found
- Throws:
IOException
-
getGenres
public List<BeatportGenre> getGenres() throws IOException
Get genre hierarchy.- Returns:
- list of genres (with subgenres)
- Throws:
IOException
-
getMostPopular
public List<AudioSong> getMostPopular(Long genreId, String country) throws IOException
Get most popular tracks for a given genre and country/market.- Parameters:
genreId- genre idcountry- two char country code- Returns:
- ordered list of tracks
- Throws:
IOException- See Also:
getGenres()
-
getNewReleases
public List<AudioSong> getNewReleases(Long genreId) throws IOException
Get new releases (last month) for a given genre.- Parameters:
genreId- genre id- Returns:
- ordered list of tracks
- Throws:
IOException- See Also:
getGenres()
-
isAuthorized
public boolean isAuthorized()
Determine, whether we are authorized to perform Beatport requests. You can watch this property by adding aPropertyChangeListenerviaaddPropertyChangeListener(String, PropertyChangeListener).- Returns:
- true or false
- See Also:
authorize()
-
deauthorize
public void deauthorize()
De-authorize this account.- See Also:
isAuthorized()
-
authorize
public void authorize()
Initiate authorization procedure. This method is asynchronous. You must not assume that authorization happened, once this method returns. Instead, register a listener for theauthorizedproperty.- See Also:
isAuthorized()
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
-
addPropertyChangeListener
public void addPropertyChangeListener(String property, PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(String property, PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
-
-