diff options
author | Jose A Ortega Ruiz <jao@gnu.org> | 2010-05-30 15:26:42 +0200 |
---|---|---|
committer | Jose A Ortega Ruiz <jao@gnu.org> | 2010-05-30 15:26:42 +0200 |
commit | dda166d42608f2170dd3af14a1a28e82941429fd (patch) | |
tree | 9f71d53b16a79896b49a6dc34265c724a76ff504 /Plugins/Monitors | |
parent | d89e78b8e254bb0c2b1597d85998b49754849113 (diff) | |
download | xmobar-dda166d42608f2170dd3af14a1a28e82941429fd.tar.gz xmobar-dda166d42608f2170dd3af14a1a28e82941429fd.tar.bz2 |
New MPD field: remaining time.
Ignore-this: 26930a015637cf0b4bb86e5c84409654
darcs-hash:20100530132642-748be-b1baa3fa98907c333733134c56cb6cd29625181f.gz
Diffstat (limited to 'Plugins/Monitors')
-rw-r--r-- | Plugins/Monitors/MPD.hs | 8 |
1 files changed, 5 insertions, 3 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 |