|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cutunes.client.ClientCommunicator
Client communicator defines the main point of communication between the client (through either a Java app or web-based applet) and the server. This class:
Method Summary | |
void |
addPlaylistToQueue(java.util.Hashtable playlistHash)
Adds a single playlistHash object to a Vector of playlistHashes. |
void |
addSongToQueue(java.util.Hashtable songHash)
Adds a single songHash object to a Vector of songHashes. |
int |
countForArtist(java.lang.String query)
Returns the number of playcounts for all users for a given artist. |
java.util.Vector |
getArtistsLike(java.lang.String artist)
For playlist Generation. |
java.util.Vector |
getArtistsOfUser(int userID,
int myUserID,
int limit)
Get the top N artists of a user that the current user also has. |
static ClientCommunicator |
getInstance()
Java singleton getInstance() method insures only a single instance of the ClientCommunicator is ever instantiated. |
java.sql.Timestamp |
getLastSync(int userID)
Queries server to the get the Timestamp of a given user's last sync. |
java.util.Vector |
getSongsForArtist(java.lang.String artist,
int userID,
int numItems)
Get a N songs that a user has of a given artist. |
int |
getUserID(java.lang.String username,
java.lang.String password)
Queries the server to get the userID integer based on that users username/password pair. |
java.util.Vector |
getUserIDFor(java.lang.String query)
|
void |
logPlaylist(java.lang.String query,
int userID)
Logs a user creating a playlist from a query |
static void |
main(java.lang.String[] args)
Simple main method will parse and sync current user's information based on command line parameters. |
static boolean |
parseAndSyncData(java.lang.String username,
java.lang.String password,
boolean usingApplet)
Instanitates ItunesXMLParser and parses the current user's iTunes XML file. |
void |
sendPlaylistGroup(int userID,
java.lang.String user,
java.util.Vector playlists)
Sends the current group of SongHashes in songs Vector to the server using XML-RPC. |
void |
sendPlaylistQueueNow()
Sends all playlistHash objects queued in playlistGroup Vector to the server immediately using XML-RPC. |
void |
sendSongGroup(int userID,
java.lang.String user,
java.util.Vector songs)
Sends the current group of SongHashes in songs Vector to the server using XML-RPC. |
void |
sendSongQueueNow()
Sends any songHash objects queued in songGroup Vector to the server immediately using XML-RPC. |
void |
setLastSync(int userID)
Queries the server to set the last sync time for the giving user to the current time. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static ClientCommunicator getInstance()
public int getUserID(java.lang.String username, java.lang.String password)
username
- String usernamepassword
- String password
public java.sql.Timestamp getLastSync(int userID)
userID
- UserID to get last sync for
public void setLastSync(int userID)
userID
- UserID to set last sync time forpublic void addSongToQueue(java.util.Hashtable songHash)
songHash
- SongHash object to add the queuepublic void sendSongQueueNow()
public void addPlaylistToQueue(java.util.Hashtable playlistHash)
playlistHash
- playlistHash object to add the queuepublic void sendPlaylistQueueNow()
public void sendPlaylistGroup(int userID, java.lang.String user, java.util.Vector playlists)
userID
- UserID of current useruser
- Username of current userpublic void sendSongGroup(int userID, java.lang.String user, java.util.Vector songs)
userID
- UserID of current useruser
- Username of current usersongs
- Vector of songHash objects to sendpublic static boolean parseAndSyncData(java.lang.String username, java.lang.String password, boolean usingApplet)
If the user has never synced before, all songs will be sent to the server. Otherwise, only songs that have been played since the last sync will be sent. At the end of parsing/sending songs, the users last sync time will be updated to the current time.
If an applet is used to run this method (the usingApplet boolean is true) the applet status box will be updated.
username
- Username of current userpassword
- Password of current userusingApplet
- Whether an applet is called this method or not
public java.util.Vector getArtistsLike(java.lang.String artist)
artist
- the specified artist
public java.util.Vector getSongsForArtist(java.lang.String artist, int userID, int numItems)
artist
- the artistuserID
- current user IDnumItems
- number of songs to retrieve
public java.util.Vector getArtistsOfUser(int userID, int myUserID, int limit)
userID
- the other usermyUserID
- the current userlimit
- the number of artists to retrieve
public java.util.Vector getUserIDFor(java.lang.String query)
public int countForArtist(java.lang.String query)
query
- the possible artist
public void logPlaylist(java.lang.String query, int userID)
query
- userID
- public static void main(java.lang.String[] args)
args
- Requires USERNAME PASSWORD parameters
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |