public class TunesHelper extends Object
Constructor and Description |
---|
TunesHelper()
Constructor for the TunesHelper object.
|
TunesHelper(String webappRootPath,
String tunesSubPath,
String webappHomeURL)
Constructor for the TunesHelper object to allow custom root path, but uses the default context = 'tunes'.
|
Modifier and Type | Method and Description |
---|---|
private String |
cleanJSON(StringBuilder sb) |
String[] |
getArtistNames() |
String[] |
getArtistNames(boolean removeSpaces) |
Vector<Artist> |
getArtists() |
Vector<Artist> |
getArtists(boolean sorted) |
Vector<String> |
getlastFmLovedTrackNames() |
Vector<String> |
getLastFmLovedTrackNames()
Returns the class var lastFmLovedTrackNames_ directly without retrieving from this classes already defined LastFM user.
|
Vector<String> |
getLastFmLovedTrackNames(boolean retrieve)
Returns the class var lastFmLovedTrackNames_ with the option to retrieve them from this classes already defined LastFM user.
|
Vector<String> |
getLastFmLovedTrackNamesForUser(String lastFmUsername)
retrieves loved trackNames for the specified LastFM user.
|
String |
getLastFmPassword()
Get Method for class field 'lastFmPassword_'.
|
Session |
getLastFmSession() |
User |
getLastFmUser() |
String |
getLastFmUserID()
Get Method for class field 'lastFmUserID_'.
|
int |
getNumberOfAlbums() |
int |
getNumberOfAlbums(String artist) |
int |
getNumberOfArtists() |
int |
getNumberOfSongs() |
String |
getTunesDirPath()
Gets the full file path to the tunes dir.
|
static String |
getTunesSubPath()
Get Method for class field 'tunesSubPath_'.
|
static String |
getWebAppContext()
Get Method for class field 'webAppContext_'.
|
String |
getWebappHomePath()
Get Method for class field 'webappHomePath_'.
|
static String |
getWebappHomeURL()
Get Method for class field 'webappHomeURL_'.
|
static String |
getWebappImagesURL()
Get the URL for the Images dir.
|
String |
getWebappRootPath()
Get Method for class field 'webappRootPath_'.
|
static String |
getWebappTunesURL()
Get the URL for the Tunes dir.
|
boolean |
initLastFm() |
boolean |
initLastFm(boolean reInit) |
boolean |
initLastFmUserSession()
Session keys have an infinite lifetime by default. so store it as a cookie to be re-used.
|
boolean |
initLastFmUserSession(boolean reInit)
Session keys have an infinite lifetime by default. so store it as a cookie to be re-used.
|
boolean |
initLastFmUserSession(boolean reInit,
String u,
String p)
Session keys have an infinite lifetime by default. so store it as a cookie to be re-used.
|
String |
loveTrack(String artist,
String title) |
static void |
main(String[] args) |
void |
nowPlaying(String artist,
String title) |
void |
nowPlaying(String artist,
String title,
int playTime,
int duration,
String album,
String albumArtist,
int trackNum) |
void |
parseTunesDir()
Parses the tunes dir and reads in all the artists_.
|
boolean |
restoreLastFmUserSession(String sessionKey)
Restores an existing Session instance with the given session key.
|
static Album |
retrieveLastFmAlbum(String art,
String albumName)
Returns a wrapper for the LastFM Album or null if not valid name.
|
static String |
retrieveLastFmAlbumUrl(String art,
String albumName)
Returns a wrapper for the LastFM Album or null if not valid name.
|
String |
retrieveLastFmAPIKey() |
Vector<String> |
retrieveLastFmLovedTrackNames()
Queries this classes already defined LastFM user's Loved Tracks, and returns a Vector of their names AND assigns it to class var lastFmLovedTrackNames_.
|
Track[] |
retrieveLastFmRecentSongs() |
Track[] |
retrieveLastFmRecentSongs(String uid) |
String |
retrieveLastFmSessionKey() |
User |
retrieveLastFmSessionUser() |
String |
retrieveLastFmSessionUsername() |
int |
retrieveLastfmTrackPlayCount(Track trk)
Queries Last.fm and retrieves the number of time this track has been played by the logged in user.
|
String |
retrieveLastFmUserId() |
String |
retrieveLastFmUserImageURL() |
String |
retrieveLastFmUserUrl() |
void |
scrobble(String artist,
String title) |
void |
scrobble(String artist,
String album,
String title) |
void |
scrobble(String artist,
String albumArtist,
String album,
String title) |
void |
setLastFmPassword(String lastFmPassword)
Set Method for class field 'lastFmPassword_'.
|
void |
setLastFmUserID(String lastFmUserID)
Set Method for class field 'lastFmUserID_'.
|
static void |
setTunesSubPath(String tunesSubPath)
Set Method for class field 'tunesSubPath_'.
|
void |
setWebAppContext(String webAppContext)
Set Method for class field 'webAppContext_'.
|
void |
setWebappHomePath()
Reset Method for class field 'webappHomePath_' to its root + context path.
|
private void |
setWebappHomePath(String webappHomePath)
DEPRECATED - Directly Set Method for class field 'webappHomePath_' which over-rides the root and contect settings (bad).
|
void |
setWebappHomeURL(String webappHomeURL)
Set Method for class field 'webappHomeURL'.
|
void |
setWebappRootPath(String webappRootPath)
Set Method for class field 'webappRootPath_'.
|
String |
toJsonString()
lists all songs in all artist's albums in a JSON string.
/**
[
{
url: "http://warp4.webarts.bc.ca/tunes/mythTunes/3DoorsDown/3DoorsDown/3DoorsDown03-It'sNotMyTime.ogg",
file: "3DoorsDown03-It'sNotMyTime.ogg",
title: "It'sNotMyTime",
album: "3DoorsDown",
artist: "3DoorsDown",
number: "03",
index: "26"
},
{
url: "http://warp4.webarts.bc.ca/tunes/mythTunes/3DoorsDown/3DoorsDown/3DoorsDown04-LetMeBeMyself.ogg",
file: "3DoorsDown04-LetMeBeMyself.ogg",
title: "LetMeBeMyself",
album: "3DoorsDown",
artist: "3DoorsDown",
number: "04",
index: "27"
},
{
url: "http://warp4.webarts.bc.ca/tunes/mythTunes/3DoorsDown/3DoorsDown/3DoorsDown05-Pages.ogg",
file: "3DoorsDown05-Pages.ogg",
title: "Pages",
album: "3DoorsDown",
artist: "3DoorsDown",
number: "05",
index: "28"
}
]
|
public static final String SYSTEM_FILE_SEPERATOR
public static final String SYSTEM_LINE_SEPERATOR
public static final String DEFAULT_COLUMN_DELIMITOR
public static final String LASTFM_USER_AGENT
public static final String LASTFM_API_KEY
public static final String LASTFM_API_KEY_SECRET
protected static final String LASTFM_DEFAULT_USERNAME
protected static final String LASTFM_DEFAULT_PASSWORD
private String columnDelimitor
private String webappRootPath_
private static String webAppContext_
private String webappHomePath_
public static String webappHomeURLTLS_
public static String webappHomeURL_
private static String tunesSubPath_
private static String imagesSubPath_
private String lastFmUserID_
private String lastFmPassword_
private boolean lastFmIsInit_
private Session lastFmSession_
private User lastFmUser_
private PaginatedResult<Track> lastFmLovedTracks_
private Vector<String> lastFmLovedTrackNames_
private Vector<String> lastFmRecentSongs_
long randLong
public TunesHelper()
public TunesHelper(String webappRootPath, String tunesSubPath, String webappHomeURL)
public void parseTunesDir()
public Vector<String> getlastFmLovedTrackNames()
public void setLastFmUserID(String lastFmUserID)
lastFmUserID
- is the value to set this class field to.public String getLastFmUserID()
public void setLastFmPassword(String lastFmPassword)
lastFmPassword
- is the value to set this class field to.public String getLastFmPassword()
public boolean initLastFm()
public boolean initLastFm(boolean reInit)
public boolean initLastFmUserSession()
public boolean initLastFmUserSession(boolean reInit)
reInit
- true flags to re-inititalize a new session, false trys to restore an existing session 1st.public boolean initLastFmUserSession(boolean reInit, String u, String p)
reInit
- true flags to re-inititalize a new session, false trys to restore an existing session 1st.u
- is the userID to login withp
- is the password to login withpublic boolean restoreLastFmUserSession(String sessionKey)
public Vector<String> retrieveLastFmLovedTrackNames()
public Vector<String> getLastFmLovedTrackNames()
public Vector<String> getLastFmLovedTrackNames(boolean retrieve)
public Vector<String> getLastFmLovedTrackNamesForUser(String lastFmUsername)
public Session getLastFmSession()
public String retrieveLastFmAPIKey()
public String retrieveLastFmSessionKey()
public String retrieveLastFmSessionUsername()
public User getLastFmUser()
public User retrieveLastFmSessionUser()
public String retrieveLastFmUserId()
public String retrieveLastFmUserImageURL()
public String retrieveLastFmUserUrl()
public void nowPlaying(String artist, String title, int playTime, int duration, String album, String albumArtist, int trackNum)
public void nowPlaying(String artist, String title)
public int retrieveLastfmTrackPlayCount(Track trk)
public static Album retrieveLastFmAlbum(String art, String albumName)
public static String retrieveLastFmAlbumUrl(String art, String albumName)
public Track[] retrieveLastFmRecentSongs()
public Track[] retrieveLastFmRecentSongs(String uid)
public Vector<Artist> getArtists()
public Vector<Artist> getArtists(boolean sorted)
public String[] getArtistNames()
public String[] getArtistNames(boolean removeSpaces)
public int getNumberOfArtists()
public int getNumberOfAlbums()
public int getNumberOfAlbums(String artist)
public int getNumberOfSongs()
public void setWebAppContext(String webAppContext)
webAppContext
- is the value to set this class field to.public static String getWebAppContext()
public void setWebappHomeURL(String webappHomeURL)
webappHomeURL
- is the value to set this class field to.public static String getWebappHomeURL()
public static String getWebappImagesURL()
public static String getWebappTunesURL()
public static void setTunesSubPath(String tunesSubPath)
tunesSubPath
- is the value to set this class field to.public static String getTunesSubPath()
public void setWebappRootPath(String webappRootPath)
webappRootPath
- is the value to set this class field to.public String getWebappRootPath()
public void setWebappHomePath()
webappHomePath
- is the value to set this class field to.private void setWebappHomePath(String webappHomePath)
webappHomePath
- is the value to set this class field to.public String getWebappHomePath()
public String getTunesDirPath()
private String cleanJSON(StringBuilder sb)
public String toJsonString()
[ { url: "http://warp4.webarts.bc.ca/tunes/mythTunes/3DoorsDown/3DoorsDown/3DoorsDown03-It'sNotMyTime.ogg", file: "3DoorsDown03-It'sNotMyTime.ogg", title: "It'sNotMyTime", album: "3DoorsDown", artist: "3DoorsDown", number: "03", index: "26" }, { url: "http://warp4.webarts.bc.ca/tunes/mythTunes/3DoorsDown/3DoorsDown/3DoorsDown04-LetMeBeMyself.ogg", file: "3DoorsDown04-LetMeBeMyself.ogg", title: "LetMeBeMyself", album: "3DoorsDown", artist: "3DoorsDown", number: "04", index: "27" }, { url: "http://warp4.webarts.bc.ca/tunes/mythTunes/3DoorsDown/3DoorsDown/3DoorsDown05-Pages.ogg", file: "3DoorsDown05-Pages.ogg", title: "Pages", album: "3DoorsDown", artist: "3DoorsDown", number: "05", index: "28" } ]
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses