module Network.MPD.Commands.Types where
import Network.MPD.Commands.Arg (MPDArg(prep), Args(Args))
import qualified Data.Map as M
import Data.Time.Clock (UTCTime)
type Artist = String
type Album = String
type Title = String
type PlaylistName = String
type Path = String
data Metadata = Artist | ArtistSort | Album | AlbumArtist
| AlbumArtistSort | Title | Track | Name | Genre
| Date | Composer | Performer | Comment | Disc
| MUSICBRAINZ_ARTISTID | MUSICBRAINZ_ALBUMID
| MUSICBRAINZ_ALBUMARTISTID | MUSICBRAINZ_TRACKID
deriving (Eq, Ord, Show)
instance MPDArg Metadata
data ObjectType = SongObj
deriving (Eq, Show)
instance MPDArg ObjectType where
prep SongObj = Args ["song"]
type Seconds = Integer
data State = Playing
| Stopped
| Paused
deriving (Show, Eq)
data Subsystem
= DatabaseS
| UpdateS
| StoredPlaylistS
| PlaylistS
| PlayerS
| MixerS
| OutputS
| OptionsS
deriving (Eq, Show)
instance MPDArg Subsystem where
prep DatabaseS = Args ["database"]
prep UpdateS = Args ["update"]
prep StoredPlaylistS = Args ["stored_playlist"]
prep PlaylistS = Args ["playlist"]
prep PlayerS = Args ["player"]
prep MixerS = Args ["mixer"]
prep OutputS = Args ["output"]
prep OptionsS = Args ["options"]
data ReplayGainMode
= Off
| TrackMode
| AlbumMode
deriving (Eq, Show)
instance MPDArg ReplayGainMode where
prep Off = Args ["off"]
prep TrackMode = Args ["track"]
prep AlbumMode = Args ["album"]
data Count =
Count { cSongs :: Integer
, cPlaytime :: Seconds
}
deriving (Eq, Show)
data Output =
Output { outID :: Int
, outName :: String
, outEnabled :: Bool
} deriving (Eq, Show)
data Song = Song
{ sgFilePath :: String
, sgTags :: M.Map Metadata [String]
, sgLastModified :: Maybe UTCTime
, sgLength :: Seconds
, sgIndex :: Maybe (Int, Int)
} deriving (Eq, Show)
sgGet :: Metadata -> Song -> Maybe [String]
sgGet meta s = M.lookup meta $ sgTags s
data Playlist = Playlist {
plName :: String
, plLastModified :: Maybe UTCTime
} deriving (Eq, Show)
data Entry = SongE Song
| PlaylistE Playlist
| DirectoryE String
deriving (Eq, Show)
data Stats =
Stats { stsArtists :: Integer
, stsAlbums :: Integer
, stsSongs :: Integer
, stsUptime :: Seconds
, stsPlaytime :: Seconds
, stsDbPlaytime :: Seconds
, stsDbUpdate :: Integer
}
deriving (Eq, Show)
data Status =
Status { stState :: State
, stVolume :: Int
, stRepeat :: Bool
, stRandom :: Bool
, stPlaylistID :: Integer
, stPlaylistLength :: Integer
, stSongPos :: Maybe Int
, stSongID :: Maybe Int
, stNextSongPos :: Maybe Int
, stNextSongID :: Maybe Int
, stTime :: (Double, Seconds)
, stBitrate :: Int
, stXFadeWidth :: Seconds
, stMixRampdB :: Double
, stMixRampDelay :: Double
, stAudio :: (Int, Int, Int)
, stUpdatingDb :: Integer
, stSingle :: Bool
, stConsume :: Bool
, stError :: Maybe String }
deriving (Eq, Show)