Package com.tagtraum.beatunes.onlinedb
Class OnlineDB
- java.lang.Object
-
- com.tagtraum.core.WebService
-
- com.tagtraum.beatunes.onlinedb.OnlineDB
-
- All Implemented Interfaces:
ApplicationComponent<BeaTunes>,UberMusic
public class OnlineDB extends WebService implements UberMusic, ApplicationComponent<BeaTunes>
WebService that lets you access the beaTunes online database.- 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 OnlineDB()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflushSubmittalQueue()BeaTunesgetApplication()Returns the main application component.StringgetId()Unique id for each instance of this object.voidinit()Initializes this component and its sub-components.List<AudioSong>lookup(byte[] fingerprint)List<AudioSong>lookup(AudioSong audioSong)Looks up metadata for a song.List<AudioSong>lookup(String resource, String resourceId)List<AudioSong>lookup(Path file)Looks up metadata for a file.voidqueueLibraryForSubmittal()voidqueueSongIdForSubmittal(long songId)voidqueueSongIdsForSubmittal(Collection<Long> songIds)voidqueueSongsForSubmittal(Iterable<? extends AudioSong> songs)voidsetApplication(BeaTunes application)Sets the main application component.voidshutdown()Shuts down this component and its sub-components.voidsubmitFingerprint(AudioSong song)voidsubmitLibrary(boolean chunk, ItemProcessor... songProcessors)voidsubmitWithIds(Collection<Long> persistentSongIDs, ItemProcessor... songProcessors)voidsubmitWithSongs(Iterable<AudioSong> songs, ItemProcessor... songProcessors)-
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
getArtists, getSimilarArtists, lookup
-
-
-
-
Method Detail
-
setApplication
public void setApplication(BeaTunes application)
Description copied from interface:ApplicationComponentSets the main application component.- Specified by:
setApplicationin interfaceApplicationComponent<BeaTunes>- Parameters:
application- main application component
-
getApplication
public BeaTunes getApplication()
Description copied from interface:ApplicationComponentReturns the main application component.- Specified by:
getApplicationin interfaceApplicationComponent<BeaTunes>- Returns:
- application object
-
getId
public String getId()
Description copied from interface:ApplicationComponentUnique id for each instance of this object.- Specified by:
getIdin interfaceApplicationComponent<BeaTunes>- Returns:
- id
-
init
public void init()
Description copied from interface:ApplicationComponentInitializes this component and its sub-components.- Specified by:
initin interfaceApplicationComponent<BeaTunes>
-
shutdown
public void shutdown()
Description copied from interface:ApplicationComponentShuts down this component and its sub-components.- Specified by:
shutdownin interfaceApplicationComponent<BeaTunes>
-
lookup
public List<AudioSong> lookup(AudioSong audioSong) throws IOException
Description copied from interface:UberMusicLooks up metadata for a song.- Specified by:
lookupin interfaceUberMusic- Parameters:
audioSong- song (query by example)- Returns:
- reference songs, empty list, if the metadata is unavailable
- Throws:
IOException- IOException
-
submitFingerprint
public void submitFingerprint(AudioSong song) throws IOException
- Throws:
IOException
-
lookup
public List<AudioSong> lookup(Path file) throws IOException
Description copied from interface:UberMusicLooks up metadata for a file.- Specified by:
lookupin interfaceUberMusic- Parameters:
file- audio file- Returns:
- reference songs, empty list, if the metadata is unavailable
- Throws:
IOException- IOException
-
lookup
public List<AudioSong> lookup(byte[] fingerprint) throws IOException
- Throws:
IOException
-
lookup
public List<AudioSong> lookup(String resource, String resourceId) throws IOException
- Throws:
IOException
-
queueLibraryForSubmittal
public void queueLibraryForSubmittal()
-
queueSongIdForSubmittal
public void queueSongIdForSubmittal(long songId)
-
queueSongIdsForSubmittal
public void queueSongIdsForSubmittal(Collection<Long> songIds)
-
flushSubmittalQueue
public void flushSubmittalQueue()
-
submitLibrary
public void submitLibrary(boolean chunk, ItemProcessor... songProcessors) throws IOException- Throws:
IOException
-
submitWithIds
public void submitWithIds(Collection<Long> persistentSongIDs, ItemProcessor... songProcessors) throws IOException
- Throws:
IOException
-
submitWithSongs
public void submitWithSongs(Iterable<AudioSong> songs, ItemProcessor... songProcessors) throws IOException
- Throws:
IOException
-
-