|
| Network.MPD | | Portability | Haskell 98 | | Stability | alpha | | Maintainer | bsinclai@turing.une.edu.au |
|
|
|
|
|
| Description |
| An MPD client library. MPD is a daemon for playing music that is
controlled over a network socket. Its site is at http://www.musicpd.org/.
|
|
| Synopsis |
|
|
|
|
| Basic data types
|
|
|
The MPD monad is basically a reader and error monad
combined.
To use the error throwing/catching capabilities:
import Control.Monad.Error
To run IO actions within the MPD monad:
import Control.Monad.Trans
| Instances | |
|
|
|
| The MPDError type is used to signal errors, both from the MPD and
otherwise.
| | Constructors | | NoMPD | MPD not responding
| | TimedOut | The connection timed out
| | Unexpected String | MPD returned an unexpected response.
This is a bug, either in the library or
in MPD itself.
| | Custom String | Used for misc. errors
| | ACK ACKType String | ACK type and a message from the
server
|
| Instances | |
|
|
|
| Represents various MPD errors (aka. ACKs).
| | Constructors | | 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)
|
| Instances | |
|
|
|
| A response is either an MPDError or some result.
|
|
| Connections
|
|
|
A wrapper for withMPDEx that uses localhost:6600 as the default
host:port, or whatever is found in the environment variables MPD_HOST and
MPD_PORT. If MPD_HOST is of the form "password@host" the password
will be supplied as well.
Examples:
withMPD $ play Nothing
withMPD $ add_ "" "tool" >> play Nothing >> currentSong
|
|
|
|
|
| Command related data types
|
|
|
| Represents the different playback states.
| | Constructors | | Instances | |
|
|
|
| Container for MPD status.
| | Constructors | | Status | | | stState :: State | | | stVolume :: Int | A percentage (0-100)
| | stRepeat :: Bool | | | stRandom :: Bool | | | stPlaylistVersion :: Integer | A value that is incremented by the server every time the
playlist changes.
| | stPlaylistLength :: Integer | The number of items in the current playlist.
| | stSongPos :: Maybe PLIndex | Current song's position in the playlist.
| | stSongID :: Maybe PLIndex | Current song's playlist ID.
| | stTime :: (Seconds, Seconds) | Time elapsed/total time.
| | stBitrate :: Int | Bitrate (in kilobytes per second) of playing song (if any).
| | stXFadeWidth :: Seconds | Crossfade time.
| | stAudio :: (Int, Int, Int) | Samplerate/bits/channels for the chosen output device
(see mpd.conf).
| | stUpdatingDb :: Integer | Job ID of currently running update (if any).
| | stError :: String | Last error message (if any).
|
|
| Instances | |
|
|
|
| Container for database statistics.
| | Constructors | | Stats | | | stsArtists :: Integer | Number of artists.
| | stsAlbums :: Integer | Number of albums.
| | stsSongs :: Integer | Number of songs.
| | stsUptime :: Seconds | Daemon uptime in seconds.
| | stsPlaytime :: Seconds | Total playing time.
| | stsDbPlaytime :: Seconds | Total play time of all the songs in
the database.
| | stsDbUpdate :: Integer | Last database update in UNIX time.
|
|
| Instances | |
|
|
|
| Represents an output device.
| | Constructors | | Device | | | dOutputID :: Int | Output's ID number
| | dOutputName :: String | Output's name as defined in the MPD
configuration file
| | dOutputEnabled :: Bool | |
|
| Instances | |
|
|
|
A query is composed of a scope modifier and a query string.
To match entries where album equals "Foo", use:
Query Album "Foo"
To match entries where album equals "Foo" and artist equals "Bar", use:
MultiQuery [Query Album "Foo", Query Artist "Bar"]
| | Constructors | | Query Meta String | Simple query.
| | MultiQuery [Query] | Query with multiple conditions.
|
| Instances | |
|
|
|
| Available metadata types/scope modifiers, used for searching the
database for entries with certain metadata values.
| | Constructors | | Artist | | | Album | | | Title | | | Track | | | Name | | | Genre | | | Date | | | Composer | | | Performer | | | Disc | | | Any | | | Filename | |
| Instances | |
|
|
|
|
|
|
|
|
|
|
|
| Used for commands which require a playlist name.
If empty, the current playlist is used.
|
|
|
| Used for commands which require a path within the database.
If empty, the root path is used.
|
|
|
| Represents a song's playlist index.
| | Constructors | | Pos Integer | A playlist position index (starting from 0)
| | ID Integer | A playlist ID number that more robustly
identifies a song.
|
| Instances | |
|
|
|
| Represents a single song item.
| | Constructors | | Instances | |
|
|
|
| Represents the result of running count.
| | Constructors | | Count | | | cSongs :: Integer | Number of songs matching the query
| | cPlaytime :: Seconds | Total play time of matching songs
|
|
| Instances | |
|
|
| Admin commands
|
|
|
| Turn off an output device.
|
|
|
| Turn on an output device.
|
|
|
| Kill the server. Obviously, the connection is then invalid.
|
|
|
| Retrieve information for all output devices.
|
|
|
| Update the server's database.
If no paths are given, all paths will be scanned.
Unreadable or non-existent paths are silently ignored.
|
|
| Database commands
|
|
|
| Search the database for entries exactly matching a query.
|
|
|
|
|
|
| List the songs (without metadata) in a database directory recursively.
|
|
|
| Recursive lsInfo.
|
|
|
| Non-recursively list the contents of a database directory.
|
|
|
| Search the database using case insensitive matching.
|
|
|
| Count the number of entries matching a query.
|
|
| Playlist commands
|
|
| Unless otherwise noted all playlist commands operate on the current
playlist.
|
|
|
| Like add_ but returns a list of the files added.
|
|
|
| Add a song (or a whole directory) to a playlist.
Adds to current if no playlist is specified.
Will create a new playlist if the one specified does not already exist.
|
|
|
| Like add, but returns a playlist id.
|
|
|
| Clear a playlist. Clears current playlist if no playlist is specified.
If the specified playlist does not exist, it will be created.
|
|
|
| Get the currently playing song.
|
|
|
| Remove a song from a playlist.
If no playlist is specified, current playlist is used.
Note that a playlist position (Pos) is required when operating on
playlists other than the current.
|
|
|
| Load an existing playlist.
|
|
|
| Move a song to a given position.
Note that a playlist position (Pos) is required when operating on
playlists other than the current.
|
|
|
| Retrieve metadata for songs in the current playlist.
|
|
|
| Retrieve a list of files in a given playlist.
|
|
|
| Retrieve metadata for files in a given playlist.
|
|
|
| Retrieve file paths and positions of songs in the current playlist.
Note that this command is only included for completeness sake; it's
deprecated and likely to disappear at any time, please use playlistInfo
instead.
|
|
|
| Retrieve a list of changed songs currently in the playlist since
a given playlist version.
|
|
|
| Like plChanges but only returns positions and ids.
|
|
|
| Search for songs in the current playlist with strict matching.
|
|
|
| Search case-insensitively with partial matches for songs in the
current playlist.
|
|
|
| Delete existing playlist.
|
|
|
|
|
|
| Save the current playlist.
|
|
|
| Shuffle the playlist.
|
|
|
| Swap the positions of two songs.
Note that the positions must be of the same type, i.e. mixing Pos and ID
will result in a no-op.
|
|
| Playback commands
|
|
|
| Set crossfading between songs.
|
|
|
| Play the next song.
|
|
|
| Pause playing.
|
|
|
| Begin/continue playing.
|
|
|
| Play the previous song.
|
|
|
| Set random playing.
|
|
|
| Set repeating.
|
|
|
| Seek to some point in a song.
Seeks in current song if no position is given.
|
|
|
| Set the volume (0-100 percent).
|
|
|
| Increase or decrease volume by a given percent, e.g.
'volume 10' will increase the volume by 10 percent, while
'volume (-10)' will decrease it by the same amount.
Note that this command is only included for completeness sake ; it's
deprecated and may disappear at any time, please use setVolume instead.
|
|
|
| Stop playing.
|
|
| Miscellaneous commands
|
|
|
| Clear the current error message in status.
|
|
|
| Close an MPD connection.
|
|
|
| Retrieve a list of available commands.
|
|
|
| Retrieve a list of unavailable (due to access restrictions) commands.
|
|
|
| Send password to server to authenticate session.
Password is sent as plain text.
|
|
|
| Check that the server is still responding.
|
|
|
| Refresh a connection.
|
|
|
| Get server statistics.
|
|
|
| Get the server's status.
|
|
|
| Retrieve a list of available song metadata.
|
|
|
| Retrieve a list of supported urlhandlers.
|
|
| Extensions/shortcuts
|
|
|
| Add a list of songs/folders to a playlist.
Should be more efficient than running add many times.
|
|
|
| Delete a list of songs from a playlist.
If there is a duplicate then no further songs will be deleted, so
take care to avoid them (see prune for this).
|
|
|
| Returns all songs and directories that match the given partial
path name.
|
|
|
| Crop playlist.
The bounds are inclusive.
If Nothing or ID is passed the cropping will leave your playlist alone
on that side.
|
|
|
| Remove duplicate playlist entries.
|
|
|
| List directories non-recursively.
|
|
|
| List files non-recursively.
|
|
|
| List all playlists.
|
|
|
| Search the database for songs relating to an artist.
|
|
|
| Search the database for songs relating to an album.
|
|
|
| Search the database for songs relating to a song title.
|
|
|
| List the artists in the database.
|
|
|
| List the albums in the database, optionally matching a given
artist.
|
|
|
| List the songs in an album of some artist.
|
|
|
| Search the database for songs relating to an artist using search.
|
|
|
| Search the database for songs relating to an album using search.
|
|
|
| Search the database for songs relating to a song title.
|
|
|
| Retrieve the current playlist.
Equivalent to playlistinfo Nothing.
|
|
|
| Toggles play/pause. Plays if stopped.
|
|
|
| Like update, but returns the update job id.
|
|
| Produced by Haddock version 2.1.0 |