{-# LANGUAGE OverloadedStrings #-}
module Network.MPD.Applicative.PlaybackOptions
( consume
, crossfade
, random
, repeat
, setVolume
, single
, replayGainMode
, replayGainStatus
, mixrampDb
, mixrampDelay
) where
import Network.MPD.Applicative.Internal
import Network.MPD.Applicative.Util
import Network.MPD.Commands.Arg hiding (Command)
import Network.MPD.Commands.Types
import Network.MPD.Util (toAssocList)
import Control.Applicative
import Prelude hiding (repeat)
consume :: Bool -> Command ()
consume :: Bool -> Command ()
consume Bool
f = Parser () -> [String] -> Command ()
forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [Command
"consume" Command -> Bool -> String
forall a. MPDArg a => Command -> a -> String
<@> Bool
f]
crossfade :: Seconds -> Command ()
crossfade :: Seconds -> Command ()
crossfade Seconds
secs = Parser () -> [String] -> Command ()
forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [Command
"crossfade" Command -> Seconds -> String
forall a. MPDArg a => Command -> a -> String
<@> Seconds
secs]
random :: Bool -> Command ()
random :: Bool -> Command ()
random Bool
f = Parser () -> [String] -> Command ()
forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [Command
"random" Command -> Bool -> String
forall a. MPDArg a => Command -> a -> String
<@> Bool
f]
repeat :: Bool -> Command ()
repeat :: Bool -> Command ()
repeat Bool
f = Parser () -> [String] -> Command ()
forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [Command
"repeat" Command -> Bool -> String
forall a. MPDArg a => Command -> a -> String
<@> Bool
f]
setVolume :: Volume -> Command ()
setVolume :: Volume -> Command ()
setVolume Volume
vol = Parser () -> [String] -> Command ()
forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [Command
"setvol" Command -> Volume -> String
forall a. MPDArg a => Command -> a -> String
<@> Volume
vol]
single :: Bool -> Command ()
single :: Bool -> Command ()
single Bool
f = Parser () -> [String] -> Command ()
forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [Command
"single" Command -> Bool -> String
forall a. MPDArg a => Command -> a -> String
<@> Bool
f]
replayGainMode :: ReplayGainMode -> Command ()
replayGainMode :: ReplayGainMode -> Command ()
replayGainMode ReplayGainMode
f = Parser () -> [String] -> Command ()
forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [Command
"replay_gain_mode" Command -> ReplayGainMode -> String
forall a. MPDArg a => Command -> a -> String
<@> ReplayGainMode
f]
replayGainStatus :: Command [(String, String)]
replayGainStatus :: Command [(String, String)]
replayGainStatus = Parser [(String, String)] -> [String] -> Command [(String, String)]
forall a. Parser a -> [String] -> Command a
Command Parser [(String, String)]
p [String
"replay_gain_status"]
where
p :: Parser [(String, String)]
p = ((ByteString, ByteString) -> (String, String))
-> [(ByteString, ByteString)] -> [(String, String)]
forall a b. (a -> b) -> [a] -> [b]
map (ByteString, ByteString) -> (String, String)
decodePair ([(ByteString, ByteString)] -> [(String, String)])
-> ([ByteString] -> [(ByteString, ByteString)])
-> [ByteString]
-> [(String, String)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ByteString] -> [(ByteString, ByteString)]
toAssocList ([ByteString] -> [(String, String)])
-> Parser [ByteString] -> Parser [(String, String)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser [ByteString]
getResponse
mixrampDb :: Decibels -> Command ()
mixrampDb :: Seconds -> Command ()
mixrampDb Seconds
db = Parser () -> [String] -> Command ()
forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [Command
"mixrampdb" Command -> Seconds -> String
forall a. MPDArg a => Command -> a -> String
<@> Seconds
db]
mixrampDelay :: Seconds -> Command ()
mixrampDelay :: Seconds -> Command ()
mixrampDelay Seconds
sec = Parser () -> [String] -> Command ()
forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [Command
"mixrampdelay" Command -> Seconds -> String
forall a. MPDArg a => Command -> a -> String
<@> Seconds
sec]