packages feed

libmpd 0.9.1.0 → 0.9.2.0

raw patch · 11 files changed

+58/−12 lines, 11 files

Files

changelog.md view
@@ -1,3 +1,10 @@+* v0.9.2.0+    - New command: `seekCur`+    - Add `newtype Sign` to pass positive numbers to `MPDArg` with leading `+/-`.+    - Add monadic versions of `deleteRange` and `moveRange` commands (previously+      only had applicative versions)+    - Deprecate `<&>`, use `<>` instead. `<&>` will be removed in the next major version.+ * v0.9.1.0     - Support partition in Network.MPD.Status     - Ignore unknown key-value pairs in Network.MPD.status so that it breaks much less often.
libmpd.cabal view
@@ -1,5 +1,5 @@ Name:               libmpd-Version:            0.9.1.0+Version:            0.9.2.0 Synopsis:           An MPD client library. Description:        A client library for MPD, the Music Player Daemon. Category:           Network, Sound
src/Network/MPD/Applicative/CurrentPlaylist.hs view
@@ -71,7 +71,6 @@ delete :: Position -> Command () delete pos = Command emptyResponse ["delete" <@> pos] --- XXX: this does not exist in the monadic version -- | Delete a range of songs from the playlist. deleteRange :: (Position, Position) -> Command () deleteRange range = Command emptyResponse ["delete" <@> range]
src/Network/MPD/Applicative/PlaybackControl.hs view
@@ -20,6 +20,7 @@     , previous     , seek     , seekId+    , seekCur     , stop     ) where @@ -56,6 +57,15 @@ -- | Seek to time in the song with the given id. seekId :: Id -> FractionalSeconds -> Command () seekId id' time = Command emptyResponse ["seekid" <@> id' <++> time]++-- | Seek to time in the current song. Absolute time for True in+-- the frist argument, relative time for False.+--+-- @since 0.9.2.0+seekCur :: Bool -> FractionalSeconds -> Command ()+seekCur bool time+  | bool      = Command emptyResponse ["seekcur" <@> time]+  | otherwise = Command emptyResponse ["seekcur" <@> (Sign time)]  -- | Stop playback. stop :: Command ()
src/Network/MPD/Commands/Arg.hs view
@@ -12,7 +12,7 @@ Prepare command arguments. -} -module Network.MPD.Commands.Arg (Command, Args(..), MPDArg(..), (<++>), (<@>)) where+module Network.MPD.Commands.Arg (Command, Args(..), MPDArg(..), (<++>), (<@>),Sign(..)) where  import           Network.MPD.Util (showBool) @@ -76,6 +76,17 @@ instance MPDArg Integer instance MPDArg Bool where prep = Args . return . showBool instance MPDArg Double++-- | Wrapper for creating signed instances of MPDArg.+--+-- @since 0.9.2.0+newtype Sign a = Sign {unSign :: a}+  deriving (Show)++instance (Num a,Ord a,Show a) => MPDArg (Sign a) where+  prep sx | x >= 0 = Args ["+" ++ show x]+          | otherwise  = Args [show x]+    where x = unSign sx  addSlashes :: String -> String addSlashes = concatMap escapeSpecial
src/Network/MPD/Commands/CurrentPlaylist.hs view
@@ -17,8 +17,10 @@     , add     , clear     , delete+    , deleteRange     , deleteId     , move+    , moveRange     , moveId     , playlist     , playlistFind@@ -63,6 +65,12 @@ delete :: MonadMPD m => Position -> m () delete = A.runCommand . A.delete +-- | Remove a range of songs from the current playlist.+--+-- @since 0.9.2.0+deleteRange :: MonadMPD m => (Position, Position) -> m ()+deleteRange = A.runCommand . A.deleteRange+ -- | Remove a song from the current playlist. deleteId :: MonadMPD m => Id -> m () deleteId = A.runCommand . A.deleteId@@ -70,6 +78,12 @@ -- | Move a song to a given position in the current playlist. move :: MonadMPD m => Position -> Position -> m () move pos = A.runCommand . A.move pos++-- | Move a range of songs to a given position in the current playlist.+--+-- @since 0.9.2.0+moveRange :: MonadMPD m => (Position, Position) -> Position -> m ()+moveRange range = A.runCommand . A.moveRange range  -- | Move a song from (songid) to (playlist index) in the playlist. If to is -- negative, it is relative to the current song in the playlist (if there is one).
src/Network/MPD/Commands/Extensions.hs view
@@ -23,6 +23,7 @@ import           Control.Monad (liftM) import           Data.Traversable (for) import           Data.Foldable (for_)+import           Data.Semigroup ((<>))  -- | This is exactly the same as `update`. updateId :: MonadMPD m => Maybe Path -> m Integer@@ -88,7 +89,7 @@  -- | List the songs in an album of some artist. listAlbum :: MonadMPD m => Artist -> Album -> m [Song]-listAlbum artist album = find (Artist =? artist <&> Album =? album)+listAlbum artist album = find (Artist =? artist <> Album =? album)  -- | Retrieve the current playlist. -- Equivalent to @playlistinfo Nothing@.
src/Network/MPD/Commands/PlaybackControl.hs view
@@ -20,6 +20,7 @@     , previous     , seek     , seekId+    , seekCur     , stop     ) where @@ -55,6 +56,13 @@ -- | Seek to some point in a song (id version) seekId :: MonadMPD m => Id -> FractionalSeconds -> m () seekId id' = A.runCommand . A.seekId id'++-- | Seek to some point in the current song. Absolute time for True in+-- the frist argument, relative time for False.+--+-- @since 0.9.2.0+seekCur :: MonadMPD m => Bool -> FractionalSeconds -> m ()+seekCur bool = A.runCommand . A.seekCur bool  -- | Stop playing. stop :: MonadMPD m => m ()
src/Network/MPD/Commands/Query.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}- {- | Module      : Network.MPD.Commands.Query Copyright   : (c) Joachim Fasting 2012@@ -18,9 +16,7 @@ import           Network.MPD.Commands.Types  import           Data.Monoid-#if MIN_VERSION_base(4,9,0) import           Data.Semigroup-#endif  -- | An interface for creating MPD queries. --@@ -33,7 +29,7 @@ -- match any song where the value of artist is \"Foo\" and the value of album -- is \"Bar\", we use: ----- > Artist =? "Foo" <&> Album =? "Bar"+-- > Artist =? "Foo" <> Album =? "Bar" newtype Query = Query [Match] deriving Show  -- A single query clause, comprising a metadata key and a desired value.@@ -47,10 +43,8 @@     mempty  = Query []     Query a `mappend` Query b = Query (a ++ b) -#if MIN_VERSION_base(4,9,0) instance Semigroup Query where     (<>) = mappend-#endif  instance MPDArg Query where     prep = foldl (<++>) (Args []) . f@@ -68,3 +62,4 @@ infixr 6 <&> (<&>) :: Query -> Query -> Query (<&>) = mappend+{-# DEPRECATED (<&>) "will be removed in the next major version of libmpd, use `(<>)` instead" #-}
src/Network/MPD/Commands/Types.hs view
@@ -330,6 +330,7 @@ instance Integral Volume where     quotRem (Volume x) (Volume y) =         let (x', y') = x `quotRem` y in (Volume x', Volume y')+    divMod = quotRem     toInteger (Volume x) = fromIntegral x  instance Real Volume where
src/Network/MPD/Core.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleContexts, GeneralizedNewtypeDeriving, OverloadedStrings, CPP #-}+{-# LANGUAGE FlexibleContexts, GeneralizedNewtypeDeriving, OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-}  -- | Module    : Network.MPD.Core