Stability | alpha |
---|---|
Maintainer | Joachim Fasting <joachim.fasting@gmail.com> |
- class (Monad m, MonadError MPDError m) => MonadMPD m where
- data MPD a
- data MPDError
- data ACKType
- = InvalidArgument
- | InvalidPassword
- | Auth
- | UnknownCommand
- | FileNotFound
- | PlaylistMax
- | System
- | PlaylistLoad
- | Busy
- | NotPlaying
- | FileExists
- | UnknownACK
- 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 ()
Classes
class (Monad m, MonadError MPDError m) => MonadMPD m whereSource
A typeclass to allow for multiple implementations of a connection to an MPD server.
Data types
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.
Represents various MPD errors (aka. ACKs).
InvalidArgument | Invalid argument passed (ACK 2) |
InvalidPassword | Invalid password supplied (ACK 3) |
Auth | Authentication required (ACK 4) |
UnknownCommand | Unknown command (ACK 5) |
FileNotFound | File or directory not found ACK 50) |
PlaylistMax | Playlist at maximum size (ACK 51) |
System | A system error (ACK 52) |
PlaylistLoad | Playlist loading failed (ACK 53) |
Busy | Update already running (ACK 54) |
NotPlaying | An operation requiring playback got interrupted (ACK 55) |
FileExists | File already exists (ACK 56) |
UnknownACK | An unknown ACK (aka. bug) |
Running
withMPDEx :: Host -> Port -> Password -> MPD a -> IO (Response a)Source
The most configurable API for running an MPD action.
Interacting
getResponse :: MonadMPD m => String -> m [String]Source
Send a command to the MPD server and return the result.