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 void
flushSubmittalQueue()
BeaTunes
getApplication()
Returns the main application component.String
getId()
Unique id for each instance of this object.void
init()
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.void
queueLibraryForSubmittal()
void
queueSongIdForSubmittal(long songId)
void
queueSongIdsForSubmittal(Collection<Long> songIds)
void
queueSongsForSubmittal(Iterable<? extends AudioSong> songs)
void
setApplication(BeaTunes application)
Sets the main application component.void
shutdown()
Shuts down this component and its sub-components.void
submitFingerprint(AudioSong song)
void
submitLibrary(boolean chunk, ItemProcessor... songProcessors)
void
submitWithIds(Collection<Long> persistentSongIDs, ItemProcessor... songProcessors)
void
submitWithSongs(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:ApplicationComponent
Sets the main application component.- Specified by:
setApplication
in interfaceApplicationComponent<BeaTunes>
- Parameters:
application
- main application component
-
getApplication
public BeaTunes getApplication()
Description copied from interface:ApplicationComponent
Returns the main application component.- Specified by:
getApplication
in interfaceApplicationComponent<BeaTunes>
- Returns:
- application object
-
getId
public String getId()
Description copied from interface:ApplicationComponent
Unique id for each instance of this object.- Specified by:
getId
in interfaceApplicationComponent<BeaTunes>
- Returns:
- id
-
init
public void init()
Description copied from interface:ApplicationComponent
Initializes this component and its sub-components.- Specified by:
init
in interfaceApplicationComponent<BeaTunes>
-
shutdown
public void shutdown()
Description copied from interface:ApplicationComponent
Shuts down this component and its sub-components.- Specified by:
shutdown
in interfaceApplicationComponent<BeaTunes>
-
lookup
public List<AudioSong> lookup(AudioSong audioSong) throws IOException
Description copied from interface:UberMusic
Looks up metadata for a song.- Specified by:
lookup
in 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:UberMusic
Looks up metadata for a file.- Specified by:
lookup
in 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
-
-