{-# LANGUAGE OverloadedStrings #-}
module Network.MPD.Applicative.Stickers
( stickerGet
, stickerSet
, stickerDelete
, stickerList
, stickerFind
) 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
import qualified Data.ByteString.UTF8 as UTF8
stickerGet :: ObjectType -> String -> String -> Command [String]
stickerGet :: ObjectType -> String -> String -> Command [String]
stickerGet ObjectType
typ String
uri String
name = forall a. Parser a -> [String] -> Command a
Command Parser [String]
p [String]
c
where
p :: Parser [String]
p :: Parser [String]
p = forall a b. (a -> b) -> [a] -> [b]
map ByteString -> String
UTF8.toString forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ByteString] -> [ByteString]
takeValues forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser [ByteString]
getResponse
c :: [String]
c = [Command
"sticker get" forall a. MPDArg a => Command -> a -> String
<@> ObjectType
typ forall a b. (MPDArg a, MPDArg b) => a -> b -> Args
<++> String
uri forall a b. (MPDArg a, MPDArg b) => a -> b -> Args
<++> String
name]
stickerSet :: ObjectType -> String -> String -> String -> Command ()
stickerSet :: ObjectType -> String -> String -> String -> Command ()
stickerSet ObjectType
typ String
uri String
name String
value = forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [String]
c
where
c :: [String]
c = [Command
"sticker set" forall a. MPDArg a => Command -> a -> String
<@> ObjectType
typ forall a b. (MPDArg a, MPDArg b) => a -> b -> Args
<++> String
uri forall a b. (MPDArg a, MPDArg b) => a -> b -> Args
<++> String
name forall a b. (MPDArg a, MPDArg b) => a -> b -> Args
<++> String
value]
stickerDelete :: ObjectType -> String -> String -> Command ()
stickerDelete :: ObjectType -> String -> String -> Command ()
stickerDelete ObjectType
typ String
uri String
name = forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [String]
c
where
c :: [String]
c = [Command
"sticker delete" forall a. MPDArg a => Command -> a -> String
<@> ObjectType
typ forall a b. (MPDArg a, MPDArg b) => a -> b -> Args
<++> String
uri forall a b. (MPDArg a, MPDArg b) => a -> b -> Args
<++> String
name]
stickerList :: ObjectType -> String -> Command [(String, String)]
stickerList :: ObjectType -> String -> Command [(String, String)]
stickerList ObjectType
typ String
uri = forall a. Parser a -> [String] -> Command a
Command Parser [(String, String)]
p [String]
c
where
p :: Parser [(String, String)]
p = forall a b. (a -> b) -> [a] -> [b]
map (ByteString, ByteString) -> (String, String)
decodePair forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ByteString] -> [(ByteString, ByteString)]
toAssocList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser [ByteString]
getResponse
c :: [String]
c = [Command
"sticker list" forall a. MPDArg a => Command -> a -> String
<@> ObjectType
typ forall a b. (MPDArg a, MPDArg b) => a -> b -> Args
<++> String
uri]
stickerFind :: ObjectType -> String -> String -> Command [(String, String)]
stickerFind :: ObjectType -> String -> String -> Command [(String, String)]
stickerFind ObjectType
typ String
uri String
name = forall a. Parser a -> [String] -> Command a
Command Parser [(String, String)]
p [String]
c
where
p :: Parser [(String, String)]
p = forall a b. (a -> b) -> [a] -> [b]
map (ByteString, ByteString) -> (String, String)
decodePair forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ByteString] -> [(ByteString, ByteString)]
toAssocList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser [ByteString]
getResponse
c :: [String]
c = [Command
"sticker find" forall a. MPDArg a => Command -> a -> String
<@> ObjectType
typ forall a b. (MPDArg a, MPDArg b) => a -> b -> Args
<++> String
uri forall a b. (MPDArg a, MPDArg b) => a -> b -> Args
<++> String
name]