summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Plugins/Monitors/MPD.hs8
-rw-r--r--README3
2 files changed, 7 insertions, 4 deletions
diff --git a/Plugins/Monitors/MPD.hs b/Plugins/Monitors/MPD.hs
index d6f8ec6..520279f 100644
--- a/Plugins/Monitors/MPD.hs
+++ b/Plugins/Monitors/MPD.hs
@@ -21,7 +21,7 @@ import qualified Network.MPD as M
mpdConfig :: IO MConfig
mpdConfig = mkMConfig "MPD: <state>"
[ "bar", "state", "statei", "volume", "length"
- , "lapsed", "plength", "ppos"
+ , "lapsed", "remaining", "plength", "ppos"
, "name", "artist", "composer", "performer"
, "album", "title", "track", "trackno", "file", "genre"
]
@@ -56,13 +56,15 @@ mopts argv =
parseMPD :: M.Response M.Status -> M.Response (Maybe M.Song) -> MOpts
-> (Float, [String])
parseMPD (Left e) _ _ = (0, show e:repeat "")
-parseMPD (Right st) song opts = (b, [ss, si, vol, len, lap, plen, pp] ++ sf)
+parseMPD (Right st) song opts =
+ (b, [ss, si, vol, len, lap, remain, plen, pp] ++ sf)
where s = M.stState st
ss = show s
si = stateGlyph s opts
vol = int2str $ M.stVolume st
- (lap, len) = (showTime p, showTime t)
(p, t) = M.stTime st
+ (lap, len) = (showTime p, showTime t)
+ remain = showTime $ max 0 (t - p)
b = if t > 0 then fromIntegral p / fromIntegral t else 0
plen = int2str $ M.stPlaylistLength st
sf = parseSong song
diff --git a/README b/README
index d0c710f..0375269 100644
--- a/README
+++ b/README
@@ -451,7 +451,8 @@ Monitors have default aliases.
playing, stopped and paused states in the `statei` template field.
- Variables that can be used with the `-t`/`--template` argument:
`bar`, `state`, `statei`, `volume`, `length`
- `lapsed`, `plength` (playlist length), `ppos` (playlist position)
+ `lapsed`, `remaining`,
+ `plength` (playlist length), `ppos` (playlist position)
`name`, `artist`, `composer`, `performer`
`album`, `title`, `track`, `file`, `genre`
- Default template: `MPD: <state>`