|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.bff.javampd.MPD
public class MPD
MPD represents a connection to a MPD server. The commands are maintained in a properties file called mpd.properties.
| Field Summary | |
|---|---|
protected static java.lang.String |
SONGPREFIXALBUM
the MPD prefix for the album |
protected static java.lang.String |
SONGPREFIXARTIST
the MPD prefix for the artist |
protected static java.lang.String |
SONGPREFIXDATE
the MPD prefix for the title |
protected static java.lang.String |
SONGPREFIXFILE
the MPD prefix for the filename |
protected static java.lang.String |
SONGPREFIXGENRE
the MPD prefix for the title |
protected static java.lang.String |
SONGPREFIXID
the MPD prefix for the song id |
protected static java.lang.String |
SONGPREFIXPOS
the MPD prefix for the playlist position |
protected static java.lang.String |
SONGPREFIXTIME
the MPD prefix for the time |
protected static java.lang.String |
SONGPREFIXTITLE
the MPD prefix for the title |
protected static java.lang.String |
SONGPREFIXTRACK
the MPD prefix for the track number |
protected static java.lang.String |
STATUS_PAUSED
status of paused |
protected static java.lang.String |
STATUS_PLAYING
status of playing |
protected static java.lang.String |
STATUS_STOPPED
status of stopped |
| Constructor Summary | |
|---|---|
MPD(java.lang.String server)
Creates a new instance of MPD without authentication using the default MPD port of 6600 |
|
MPD(java.lang.String server,
int port)
Creates a new instance of MPD without authentication |
|
MPD(java.lang.String server,
int port,
java.lang.String password)
Creates a new instance of MPD with authentication. |
|
| Method Summary | |
|---|---|
void |
clearerror()
Clears the current error message in the MPD status |
void |
close()
Closes the connection to the MPD server. |
protected java.util.Collection<MPDSong> |
convertResponseToSong(java.util.List<java.lang.String> list)
Converts the response from the MPD server into a MPDSong object. |
protected java.lang.String |
getLastError()
Returns the last error generated by isResponseOK. |
MPDAdmin |
getMPDAdmin()
Returns a MPDAdmin using this class as the connection
for the administrator. |
MPDDatabase |
getMPDDatabase()
Returns a MPDDatabase using this class as the connection
for the database. |
MPDEventRelayer |
getMPDEventRelayer()
Returns a MPDEventRelayer using this class as the connection. |
MPDPlayer |
getMPDPlayer()
Returns a MPDPlayer using this class as the connection
for the player. |
MPDPlaylist |
getMPDPlaylist()
Returns a MPDPlaylist using this class as the connection
for the playlist. |
long |
getPlaytime()
Returns the time length of the music played since the server was started. |
protected java.lang.String |
getServerStat(org.bff.javampd.MPD.StatList stat)
Returns the statistics of the requested statistics element. |
java.util.Collection<java.lang.String> |
getStatus()
Returns the full status of the MPD server as a Collection
of Strings. |
protected java.lang.String |
getStatus(org.bff.javampd.MPD.StatusList status)
Returns the current status of the requested status element. |
long |
getUptime()
Returns the MPD server daemon uptime in seconds. |
java.lang.String |
getVersion()
Returns the MPD version running on the server. |
boolean |
isConnected()
Determines if there is a connection to the MPD server. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String SONGPREFIXFILE
protected static final java.lang.String SONGPREFIXARTIST
protected static final java.lang.String SONGPREFIXALBUM
protected static final java.lang.String SONGPREFIXTRACK
protected static final java.lang.String SONGPREFIXTITLE
protected static final java.lang.String SONGPREFIXDATE
protected static final java.lang.String SONGPREFIXGENRE
protected static final java.lang.String SONGPREFIXTIME
protected static final java.lang.String SONGPREFIXPOS
protected static final java.lang.String SONGPREFIXID
protected static final java.lang.String STATUS_PLAYING
protected static final java.lang.String STATUS_PAUSED
protected static final java.lang.String STATUS_STOPPED
| Constructor Detail |
|---|
public MPD(java.lang.String server)
throws java.net.UnknownHostException,
MPDConnectionException
server - the MPD Server
MPDConnectionException - if there is a problem sending the command to the server
java.net.UnknownHostException - If the host name used for the server is unknown to dns
public MPD(java.lang.String server,
int port)
throws java.net.UnknownHostException,
MPDConnectionException
server - the MPD Serverport - the port MPD is listening on
MPDConnectionException - if there is a problem sending the command to the server
java.net.UnknownHostException - If the host name used for the server is unknown to dns
public MPD(java.lang.String server,
int port,
java.lang.String password)
throws java.net.UnknownHostException,
MPDConnectionException
server - the MPD serverport - the port MPD is listening onpassword - the password to authenticate with
MPDConnectionException - if there is a problem sending the command to the server
java.net.UnknownHostException - If the host name used for the server is unknown to dns| Method Detail |
|---|
public void clearerror()
throws MPDConnectionException,
MPDResponseException
MPDResponseException - if the MPD response generates an error
MPDConnectionException - if there is a problem sending the command to the server
public void close()
throws MPDConnectionException,
MPDResponseException
MPDResponseException - if the MPD response generates an error
MPDConnectionException - if there is a problem sending the command to the server
public long getPlaytime()
throws MPDConnectionException,
MPDResponseException
MPDResponseException - if the MPD response generates an error
MPDConnectionException - if there is a problem sending the command to the server
public long getUptime()
throws MPDConnectionException,
MPDResponseException
MPDResponseException - if the MPD response generates an error
MPDConnectionException - if there is a problem sending the command to the serverpublic java.lang.String getVersion()
public MPDPlayer getMPDPlayer()
MPDPlayer using this class as the connection
for the player. Multiple calls to this method will return
the same MPDPlayer class.
public MPDPlaylist getMPDPlaylist()
MPDPlaylist using this class as the connection
for the playlist. Multiple calls to this method will return
the same MPDPlaylist class.
public MPDDatabase getMPDDatabase()
MPDDatabase using this class as the connection
for the database. Multiple calls to this method will return
the same MPDDatabase class.
public MPDAdmin getMPDAdmin()
MPDAdmin using this class as the connection
for the administrator. Multiple calls to this method will return
the same MPDAdmin class.
public MPDEventRelayer getMPDEventRelayer()
MPDEventRelayer using this class as the connection.
Multiple calls to this method will return
the same MPDEventRelayer class.
public boolean isConnected()
public java.util.Collection<java.lang.String> getStatus()
throws MPDConnectionException,
MPDResponseException
Collection
of Strings. To query specific statuses use getStatus(StatusList status).
MPDResponseException - if the MPD response generates an error
MPDConnectionException - if there is a problem sending the command to the server
protected java.lang.String getStatus(org.bff.javampd.MPD.StatusList status)
throws MPDConnectionException,
MPDResponseException
StatusList for a list of possible items returned
by getStatus.
status - the status desired
MPDResponseException - if the MPD response generates an error
MPDConnectionException - if there is a problem sending the command to the server
protected java.lang.String getServerStat(org.bff.javampd.MPD.StatList stat)
throws MPDConnectionException,
MPDResponseException
StatList for a list of possible items returned
by getServerStat.
stat - the statistic desired
MPDResponseException - if the MPD response generates an error
MPDConnectionException - if there is a problem sending the command to the serverprotected java.util.Collection<MPDSong> convertResponseToSong(java.util.List<java.lang.String> list)
MPDSong object.
list - the response from the MPD server
protected java.lang.String getLastError()
isResponseOK.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||