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 void
addPropertyChangeListener(PropertyChangeListener listener)
void
addPropertyChangeListener(String property, PropertyChangeListener listener)
void
authorize()
Initiate authorization procedure.void
deauthorize()
De-authorize this account.AudioArtist
getArtist(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.String
getName()
Name of this chart provider.List<AudioSong>
getNewReleases(Long genreId)
Get new releases (last month) for a given genre.List<PlayList>
getNewReleases(Locale market)
AudioSong
getTrack(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.boolean
isAuthorized()
Determine, whether we are authorized to perform Beatport requests.String
localize(String key, Object... objects)
List<AudioSong>
lookup(AudioSong song)
Looks up metadata for a song.void
removePropertyChangeListener(PropertyChangeListener listener)
void
removePropertyChangeListener(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:Charts
Name of this chart provider.
-
lookup
public List<AudioSong> lookup(AudioSong song) throws IOException
Description copied from interface:UberMusic
Looks up metadata for a song.- Specified by:
lookup
in 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:Charts
Fetch charts in the form ofPlayList
s for the givenLocale
. These lists may be specific to genre or other properties.- Specified by:
getCharts
in 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:NewReleases
Fetch new releases in the form ofPlayList
s for the givenLocale
. These lists may be specific to genre or other properties.- Specified by:
getNewReleases
in 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:UberMusic
Lookup artists for a song. The default implementation returns an empty list.- Specified by:
getArtists
in 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 aPropertyChangeListener
viaaddPropertyChangeListener(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 theauthorized
property.- 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)
-
-