diff options
author | Jose A Ortega Ruiz <jao@gnu.org> | 2010-10-03 00:02:55 +0200 |
---|---|---|
committer | Jose A Ortega Ruiz <jao@gnu.org> | 2010-10-03 00:02:55 +0200 |
commit | cd0b3a4a3b7c485881e00eab593fbff32b9ebd01 (patch) | |
tree | 1099b98a34062c040ae06702552a7e3f049cd474 /Plugins/Monitors/MPD.hs | |
parent | 0310c0b24ca508a70d2e276c96898d76aed7c7ea (diff) | |
download | xmobar-cd0b3a4a3b7c485881e00eab593fbff32b9ebd01.tar.gz xmobar-cd0b3a4a3b7c485881e00eab593fbff32b9ebd01.tar.bz2 |
MPD: minor refactoring
Ignore-this: 387135a8f6c73b1b692166011fe3ed10
darcs-hash:20101002220255-748be-05efd57305148c71599891fab8647ce9ce065e0c.gz
Diffstat (limited to 'Plugins/Monitors/MPD.hs')
-rw-r--r-- | Plugins/Monitors/MPD.hs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Plugins/Monitors/MPD.hs b/Plugins/Monitors/MPD.hs index 34f409c..349e237 100644 --- a/Plugins/Monitors/MPD.hs +++ b/Plugins/Monitors/MPD.hs @@ -75,19 +75,16 @@ 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, remain, plen, pp] ++ parseSong song) + (bar, [ss, si, vol, len, lap, remain, plen, ppos] ++ parseSong song) where s = M.stState st ss = show s si = stateGlyph s opts vol = int2str $ M.stVolume st (p, t) = M.stTime st - ps = floor p - [lap, len, remain] = map showTime [ps, t, max 0 (t - ps)] - b = if t > 0 then realToFrac $ p / fromIntegral t else 0 + [lap, len, remain] = map showTime [floor p, t, max 0 (t - floor p)] + bar = if t > 0 then realToFrac $ p / fromIntegral t else 0 plen = int2str $ M.stPlaylistLength st - pp = case M.stSongPos st of - Nothing -> "" - Just n -> int2str $ n + 1 + ppos = maybe "" (int2str . (+1)) $ M.stSongPos st stateGlyph :: M.State -> MOpts -> String stateGlyph s o = |