|Maintainer||Joachim Fasting <firstname.lastname@example.org>|
- class (Monad m, MonadError MPDError m) => MonadMPD m where
- data MPD a
- data MPDError
- data ACKType
- type Response = Either MPDError
- type Host = String
- type Port = Integer
- type Password = String
- withMPDEx :: Host -> Port -> Password -> MPD a -> IO (Response a)
- getResponse :: MonadMPD m => String -> m [String]
- kill :: MonadMPD m => m ()
A typeclass to allow for multiple implementations of a connection to an MPD server.
Open (or re-open) a connection to the MPD server.
Close the connection.
Send a string to the server and return its response.
Get underlying Handle (or Nothing, if no connection is estabilished)
Produce a password to send to the server should it ask for one.
Alters password to be sent to the server.
Get MPD protocol version
The main implementation of an MPD client. It actually connects to a server and interacts with it.
To use the error throwing/catching capabilities:
import Control.Monad.Error (throwError, catchError)
To run IO actions within the MPD monad:
import Control.Monad.Trans (liftIO)
The MPDError type is used to signal errors, both from the MPD and otherwise.
MPD not responding
The connection timed out
MPD returned an unexpected response. This is a bug, either in the library or in MPD itself.
Used for misc. errors
|ACK ACKType String|
ACK type and a message from the server
Represents various MPD errors (aka. ACKs).
Invalid argument passed (ACK 2)
Invalid password supplied (ACK 3)
Authentication required (ACK 4)
Unknown command (ACK 5)
File or directory not found ACK 50)
Playlist at maximum size (ACK 51)
A system error (ACK 52)
Playlist loading failed (ACK 53)
Update already running (ACK 54)
An operation requiring playback got interrupted (ACK 55)
File already exists (ACK 56)
An unknown ACK (aka. bug)
The most configurable API for running an MPD action.
Send a command to the MPD server and return the result.