module Mpv.Data.Command where import Data.Aeson (FromJSON (parseJSON), Value) import Data.Aeson.TH (deriveJSON) import Path (Abs, File, Path) import Mpv.Data.EventName (EventName) import Mpv.Data.OsdLevel (OsdLevel) import Mpv.Data.Property (Property) import Mpv.Data.SeekFlags (SeekFlags) import Mpv.Json (basicOptions, lowerMinusJson) data CycleDirection = Up | Down deriving stock (CycleDirection -> CycleDirection -> Bool (CycleDirection -> CycleDirection -> Bool) -> (CycleDirection -> CycleDirection -> Bool) -> Eq CycleDirection forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: CycleDirection -> CycleDirection -> Bool $c/= :: CycleDirection -> CycleDirection -> Bool == :: CycleDirection -> CycleDirection -> Bool $c== :: CycleDirection -> CycleDirection -> Bool Eq, Int -> CycleDirection -> ShowS [CycleDirection] -> ShowS CycleDirection -> String (Int -> CycleDirection -> ShowS) -> (CycleDirection -> String) -> ([CycleDirection] -> ShowS) -> Show CycleDirection forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [CycleDirection] -> ShowS $cshowList :: [CycleDirection] -> ShowS show :: CycleDirection -> String $cshow :: CycleDirection -> String showsPrec :: Int -> CycleDirection -> ShowS $cshowsPrec :: Int -> CycleDirection -> ShowS Show) lowerMinusJson ''CycleDirection data LoadResponse = LoadResponse { LoadResponse -> Int playlist_entry_id :: Int } deriving stock (LoadResponse -> LoadResponse -> Bool (LoadResponse -> LoadResponse -> Bool) -> (LoadResponse -> LoadResponse -> Bool) -> Eq LoadResponse forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: LoadResponse -> LoadResponse -> Bool $c/= :: LoadResponse -> LoadResponse -> Bool == :: LoadResponse -> LoadResponse -> Bool $c== :: LoadResponse -> LoadResponse -> Bool Eq, Int -> LoadResponse -> ShowS [LoadResponse] -> ShowS LoadResponse -> String (Int -> LoadResponse -> ShowS) -> (LoadResponse -> String) -> ([LoadResponse] -> ShowS) -> Show LoadResponse forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [LoadResponse] -> ShowS $cshowList :: [LoadResponse] -> ShowS show :: LoadResponse -> String $cshow :: LoadResponse -> String showsPrec :: Int -> LoadResponse -> ShowS $cshowsPrec :: Int -> LoadResponse -> ShowS Show) deriveJSON basicOptions ''LoadResponse data LoadOption = Replace | Append | AppendPlay deriving stock (LoadOption -> LoadOption -> Bool (LoadOption -> LoadOption -> Bool) -> (LoadOption -> LoadOption -> Bool) -> Eq LoadOption forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: LoadOption -> LoadOption -> Bool $c/= :: LoadOption -> LoadOption -> Bool == :: LoadOption -> LoadOption -> Bool $c== :: LoadOption -> LoadOption -> Bool Eq, Int -> LoadOption -> ShowS [LoadOption] -> ShowS LoadOption -> String (Int -> LoadOption -> ShowS) -> (LoadOption -> String) -> ([LoadOption] -> ShowS) -> Show LoadOption forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [LoadOption] -> ShowS $cshowList :: [LoadOption] -> ShowS show :: LoadOption -> String $cshow :: LoadOption -> String showsPrec :: Int -> LoadOption -> ShowS $cshowsPrec :: Int -> LoadOption -> ShowS Show) lowerMinusJson ''LoadOption instance Default LoadOption where def :: LoadOption def = LoadOption Replace data EmptyResponse = EmptyResponse deriving stock (EmptyResponse -> EmptyResponse -> Bool (EmptyResponse -> EmptyResponse -> Bool) -> (EmptyResponse -> EmptyResponse -> Bool) -> Eq EmptyResponse forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: EmptyResponse -> EmptyResponse -> Bool $c/= :: EmptyResponse -> EmptyResponse -> Bool == :: EmptyResponse -> EmptyResponse -> Bool $c== :: EmptyResponse -> EmptyResponse -> Bool Eq, Int -> EmptyResponse -> ShowS [EmptyResponse] -> ShowS EmptyResponse -> String (Int -> EmptyResponse -> ShowS) -> (EmptyResponse -> String) -> ([EmptyResponse] -> ShowS) -> Show EmptyResponse forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [EmptyResponse] -> ShowS $cshowList :: [EmptyResponse] -> ShowS show :: EmptyResponse -> String $cshow :: EmptyResponse -> String showsPrec :: Int -> EmptyResponse -> ShowS $cshowsPrec :: Int -> EmptyResponse -> ShowS Show) instance FromJSON EmptyResponse where parseJSON :: Value -> Parser EmptyResponse parseJSON = Parser EmptyResponse -> Value -> Parser EmptyResponse forall a b. a -> b -> a const (EmptyResponse -> Parser EmptyResponse forall (f :: * -> *) a. Applicative f => a -> f a pure EmptyResponse EmptyResponse) data Command :: Type -> Type where Manual :: Maybe EventName -> Text -> [Value] -> Command Value Load :: Path Abs File -> Maybe LoadOption -> Command LoadResponse Stop :: Command EmptyResponse Seek :: Double -> SeekFlags -> Command EmptyResponse Prop :: Property v -> Command v SetProp :: Show v => Property v -> v -> Command () AddProp :: Show v => Property v -> Maybe v -> Command () CycleProp :: Show v => Property v -> Maybe CycleDirection -> Command () MultiplyProp :: Show v => Property v -> v -> Command () SetOption :: Text -> Text -> Command () ShowText :: (TimeUnit u, Show u) => Text -> u -> OsdLevel -> Command () ShowProgress :: Command () deriving stock instance Show (Command a)