net.sourceforge.atunes.kernel.handlers
Class ContextInformationServiceHandler

java.lang.Object
  extended by net.sourceforge.atunes.kernel.handlers.ContextInformationServiceHandler
All Implemented Interfaces:
ApplicationFinishListener, ContextInformationListener

public class ContextInformationServiceHandler
extends java.lang.Object
implements ContextInformationListener, ApplicationFinishListener

The Class ContextInformationServiceHandler.


Method Summary
 void applicationFinish()
          Finish context information
 void clear()
          Clear.
 void clearCaches()
           Clears the caches (Last.fm & lyrics cache) Deletes as many files in the cache directories as possible.
 AlbumInfo getAlbum()
          Gets the album.
 java.awt.Image getAlbumCover(AudioFile file)
          Gets the album cover.
 java.util.List<AlbumInfo> getAlbums()
          Gets the albums.
 java.util.Map<AudioFile,java.lang.String> getGenresForFiles(java.util.List<AudioFile> files)
          Gets the genres for files.
static ContextInformationServiceHandler getInstance()
          Gets the single instance of AudioScrobblerServiceHandler.
 java.lang.String getLastAlbumRetrieved()
          Gets the last album retrieved.
 java.lang.String getLastArtistRetrieved()
          Gets the last artist retrieved.
 java.util.Map<AudioFile,java.lang.String> getTitlesForFiles(java.util.List<AudioFile> files)
          Returns a hash of files with its songs titles.
 java.util.List<java.lang.String> getTrackNamesForAlbum(java.lang.String artistName, java.lang.String albumName)
          Gets the track names for album.
 java.util.Map<java.lang.String,java.lang.String> getUrlsForAddingLyrics(java.lang.String artist, java.lang.String title)
          Returns the url for adding new lyrics to a lyric provider
 void notifyAlbumRetrieved(AudioObject file, long id)
          Notify album retrieved.
 void notifyArtistImage(java.awt.Image img, long id)
          Notify artist image.
 void notifyCoverRetrieved(AlbumInfo alb, java.awt.Image cover, long id)
          Notify cover retrieved.
 void notifyFinishGetSimilarArtist(ArtistInfo a, java.awt.Image img, long id)
          Notify finish get similar artist.
 void notifyLyricsRetrieved(AudioObject audioObject, Lyrics lyrics, long id)
          Notify lyrics retrieved.
 void notifyPodcast(PodcastFeedEntry podcast, long id)
          Notify podcast.
 void notifyRadio(Radio radio, long id)
          Notify radio.
 void notifyStartRetrievingArtistImages(long id)
          Notify start retrieving artist images.
 void notifyStartRetrievingCovers(long id)
          Notify start retrieving covers.
 void notifyWikiInfoRetrieved(java.lang.String wikiText, java.lang.String wikiURL, long id)
          Notify wiki info retrieved.
 void retrieveInfoAndShowInPanel(AudioObject ao)
          Updates panel with audio object information.
 void setAlbum(AlbumInfo album, long id)
          Sets the album.
 void setAlbums(java.util.List<? extends AlbumInfo> albums, long id)
          Sets the albums.
 void setImage(java.awt.Image image, AudioObject ao, long id)
          Sets the image.
 void setLastAlbumRetrieved(java.lang.String lastAlbumRetrieved, long id)
          Sets the last album retrieved.
 void setLastArtistRetrieved(java.lang.String lastArtistRetrieved, long id)
          Sets the last artist retrieved.
 void submitNowPlayingInfoToLastFm(AudioFile audioFile)
          Submit now playing info to Last.fm
 void submitToLastFm(AudioFile audioFile, long secondsPlayed)
          Submit song to Last.fm
 void updateService(ProxyBean proxy, java.lang.String user, java.lang.String password)
          Update service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ContextInformationServiceHandler getInstance()
Gets the single instance of AudioScrobblerServiceHandler.

Returns:
single instance of AudioScrobblerServiceHandler

clear

public void clear()
Clear.


clearCaches

public void clearCaches()

Clears the caches (Last.fm & lyrics cache)

Deletes as many files in the cache directories as possible. Files that are currently used by aTunes won't be deleted.


getAlbum

public AlbumInfo getAlbum()
Gets the album.

Returns:
the album

getAlbumCover

public java.awt.Image getAlbumCover(AudioFile file)
Gets the album cover.

Parameters:
file - the file
Returns:
the album cover

getAlbums

public java.util.List<AlbumInfo> getAlbums()
Description copied from interface: ContextInformationListener
Gets the albums.

Specified by:
getAlbums in interface ContextInformationListener
Returns:
the albums

getGenresForFiles

public java.util.Map<AudioFile,java.lang.String> getGenresForFiles(java.util.List<AudioFile> files)
Gets the genres for files.

Parameters:
files - the files
Returns:
the genres for files

getLastAlbumRetrieved

public java.lang.String getLastAlbumRetrieved()
Gets the last album retrieved.

Returns:
the last album retrieved

getLastArtistRetrieved

public java.lang.String getLastArtistRetrieved()
Gets the last artist retrieved.

Returns:
the last artist retrieved

getTitlesForFiles

public java.util.Map<AudioFile,java.lang.String> getTitlesForFiles(java.util.List<AudioFile> files)
Returns a hash of files with its songs titles.

Parameters:
files - the files
Returns:
the titles for files

getTrackNamesForAlbum

public java.util.List<java.lang.String> getTrackNamesForAlbum(java.lang.String artistName,
                                                              java.lang.String albumName)
Gets the track names for album.

Parameters:
artistName - the artist name
albumName - the album name
Returns:
the track names for album

getUrlsForAddingLyrics

public java.util.Map<java.lang.String,java.lang.String> getUrlsForAddingLyrics(java.lang.String artist,
                                                                               java.lang.String title)
Returns the url for adding new lyrics to a lyric provider

Parameters:
artist - artist
title - title
Returns:
the url for adding new lyrics to a lyric provider

notifyAlbumRetrieved

public void notifyAlbumRetrieved(AudioObject file,
                                 long id)
Description copied from interface: ContextInformationListener
Notify album retrieved.

Specified by:
notifyAlbumRetrieved in interface ContextInformationListener
Parameters:
file - the file
id - the id

notifyArtistImage

public void notifyArtistImage(java.awt.Image img,
                              long id)
Description copied from interface: ContextInformationListener
Notify artist image.

Specified by:
notifyArtistImage in interface ContextInformationListener
Parameters:
img - the img
id - the id

notifyCoverRetrieved

public void notifyCoverRetrieved(AlbumInfo alb,
                                 java.awt.Image cover,
                                 long id)
Description copied from interface: ContextInformationListener
Notify cover retrieved.

Specified by:
notifyCoverRetrieved in interface ContextInformationListener
Parameters:
alb - the album
cover - the cover
id - the id

notifyFinishGetSimilarArtist

public void notifyFinishGetSimilarArtist(ArtistInfo a,
                                         java.awt.Image img,
                                         long id)
Description copied from interface: ContextInformationListener
Notify finish get similar artist.

Specified by:
notifyFinishGetSimilarArtist in interface ContextInformationListener
Parameters:
a - the a
img - the img
id - the id

notifyLyricsRetrieved

public void notifyLyricsRetrieved(AudioObject audioObject,
                                  Lyrics lyrics,
                                  long id)
Notify lyrics retrieved.

Specified by:
notifyLyricsRetrieved in interface ContextInformationListener
Parameters:
audioObject - the audio object
lyrics - the lyrics
id - the id

notifyPodcast

public void notifyPodcast(PodcastFeedEntry podcast,
                          long id)
Notify podcast.

Parameters:
podcast - the podcast
id - the id

notifyRadio

public void notifyRadio(Radio radio,
                        long id)
Notify radio.

Parameters:
radio - the radio
id - the id

notifyStartRetrievingArtistImages

public void notifyStartRetrievingArtistImages(long id)
Description copied from interface: ContextInformationListener
Notify start retrieving artist images.

Specified by:
notifyStartRetrievingArtistImages in interface ContextInformationListener
Parameters:
id - the id

notifyStartRetrievingCovers

public void notifyStartRetrievingCovers(long id)
Description copied from interface: ContextInformationListener
Notify start retrieving covers.

Specified by:
notifyStartRetrievingCovers in interface ContextInformationListener
Parameters:
id - the id

notifyWikiInfoRetrieved

public void notifyWikiInfoRetrieved(java.lang.String wikiText,
                                    java.lang.String wikiURL,
                                    long id)
Description copied from interface: ContextInformationListener
Notify wiki info retrieved.

Specified by:
notifyWikiInfoRetrieved in interface ContextInformationListener
Parameters:
wikiText - the wiki text
wikiURL - the wiki url
id - the id

retrieveInfoAndShowInPanel

public void retrieveInfoAndShowInPanel(AudioObject ao)
Updates panel with audio object information.

Parameters:
ao - the audio object

setAlbum

public void setAlbum(AlbumInfo album,
                     long id)
Description copied from interface: ContextInformationListener
Sets the album.

Specified by:
setAlbum in interface ContextInformationListener
Parameters:
album - the album
id - the id

setAlbums

public void setAlbums(java.util.List<? extends AlbumInfo> albums,
                      long id)
Description copied from interface: ContextInformationListener
Sets the albums.

Specified by:
setAlbums in interface ContextInformationListener
Parameters:
albums - the album
id - the id

setImage

public void setImage(java.awt.Image image,
                     AudioObject ao,
                     long id)
Description copied from interface: ContextInformationListener
Sets the image.

Specified by:
setImage in interface ContextInformationListener
Parameters:
image - the img
ao - audio object
id - the id

setLastAlbumRetrieved

public void setLastAlbumRetrieved(java.lang.String lastAlbumRetrieved,
                                  long id)
Description copied from interface: ContextInformationListener
Sets the last album retrieved.

Specified by:
setLastAlbumRetrieved in interface ContextInformationListener
Parameters:
lastAlbumRetrieved - the album
id - the id

setLastArtistRetrieved

public void setLastArtistRetrieved(java.lang.String lastArtistRetrieved,
                                   long id)
Description copied from interface: ContextInformationListener
Sets the last artist retrieved.

Specified by:
setLastArtistRetrieved in interface ContextInformationListener
Parameters:
lastArtistRetrieved - the artist
id - the id

submitToLastFm

public void submitToLastFm(AudioFile audioFile,
                           long secondsPlayed)
Submit song to Last.fm

Parameters:
audioFile - the file
secondsPlayed - the seconds played

submitNowPlayingInfoToLastFm

public void submitNowPlayingInfoToLastFm(AudioFile audioFile)
Submit now playing info to Last.fm

Parameters:
audioFile - the file

updateService

public void updateService(ProxyBean proxy,
                          java.lang.String user,
                          java.lang.String password)
Update service.

Parameters:
proxy - the proxy
user - the user
password - the password

applicationFinish

public void applicationFinish()
Finish context information

Specified by:
applicationFinish in interface ApplicationFinishListener


Copyright © 2006-2008 The aTunes Team. All Rights Reserved.