|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.baka.ambient.commons.AbstractFileStorage sk.baka.ambient.lrc.LRCStorage
public final class LRCStorage
Storage for downloaded LRC files.
Field Summary |
---|
Fields inherited from class sk.baka.ambient.commons.AbstractFileStorage |
---|
maxStorageSize, theCache |
Constructor Summary | |
---|---|
LRCStorage()
Creates new LRC storage. |
Method Summary | |
---|---|
void |
deleteLyrics(TrackMetadataBean track)
Deletes lyrics for given track. |
protected String[] |
getFilenameAndExt(URL url,
Object fetchInfo)
Retrieves target file name. |
LRCLyrics |
getLyrics(TrackMetadataBean track)
Fetches the lyrics for a track and returns it. |
protected void |
onFileDownloaded(URL url,
Object fetchInfo,
boolean success)
The file was downloaded and is already registered in the storage. |
void |
setLyricsForTrack(TrackMetadataBean track,
LyrdbTrack lyrics)
Sets preferred lyrics for given track. |
protected URL |
toURL(Object fetchInfo)
Converts given fetch info to an URL object. |
Methods inherited from class sk.baka.ambient.commons.AbstractFileStorage |
---|
cleanup, close, createFile, fetchFileAsync, getCacheFile, getCacheFileNull, getFile, getNames, isFull, isProceedWithDownload, purge, registerFile, removeFile, setMaxStorageSize, supportsExtension |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LRCStorage()
Method Detail |
---|
protected String[] getFilenameAndExt(URL url, Object fetchInfo)
AbstractFileStorage
UnsupportedOperationException
. Must be thread-safe as it is not
invoked from a Handler thread.
getFilenameAndExt
in class AbstractFileStorage
url
- the source URL. May be null
- in this case the
extension is not needed and returned extension may be
null
or the result may contain only the name.fetchInfo
- the fetch info object
null
is returned
then the object is not downloadable nor storable into the
storage.protected void onFileDownloaded(URL url, Object fetchInfo, boolean success)
AbstractFileStorage
onFileDownloaded
in class AbstractFileStorage
url
- the source URLfetchInfo
- the fetch info objectsuccess
- if true
then the file is available in the cache.
If false
then the download process was aborted (
AbstractFileStorage.toURL(Object)
returned null
).protected URL toURL(Object fetchInfo) throws IOException
AbstractFileStorage
UnsupportedOperationException
. Must be thread-safe as it is not
invoked from a Handler thread.
toURL
in class AbstractFileStorage
fetchInfo
- the fetch info object, never null
.
null
then this download is aborted.
IOException
- if i/o error occurspublic void setLyricsForTrack(TrackMetadataBean track, LyrdbTrack lyrics)
track
- the track, must not be null
.lyrics
- preferred lyrics, must not be null
.public void deleteLyrics(TrackMetadataBean track)
track
- the track to delete the lyrics for.public LRCLyrics getLyrics(TrackMetadataBean track) throws IOException, ParseException
ILibraryListener.lyricsLoaded(TrackMetadataBean, List)
is
emitted.
track
- the track.
null
if the lyrics are not yet
available.
ParseException
- if lyrics parsing failed
IOException
- if i/o exception occurred.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |