summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2014-09-28 00:24:15 +0200
committerjao <jao@gnu.org>2014-09-28 00:25:54 +0200
commit6b9dfabf23b7c48a86c3553a63ebb3924bea8d46 (patch)
tree96746eb0ff0f24c5f10a453921642f91a9184dd6 /src
parenta04850b0cbe4355dc7bd083a353fabdc644a24fb (diff)
downloadxmobar-6b9dfabf23b7c48a86c3553a63ebb3924bea8d46.tar.gz
xmobar-6b9dfabf23b7c48a86c3553a63ebb3924bea8d46.tar.bz2
Upgrade to libmpd 0.9
Diffstat (limited to 'src')
-rw-r--r--src/Plugins/Monitors/MPD.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Plugins/Monitors/MPD.hs b/src/Plugins/Monitors/MPD.hs
index 1a49ad3..e02a747 100644
--- a/src/Plugins/Monitors/MPD.hs
+++ b/src/Plugins/Monitors/MPD.hs
@@ -75,7 +75,7 @@ mpdReady _ = do
-- Only cases where MPD isn't responding is an issue; bogus information at
-- least won't hold xmobar up.
Left M.NoMPD -> return False
- Left M.TimedOut -> return False
+ Left (M.ConnectionError _) -> return False
Left _ -> return True
mopts :: [String] -> IO MOpts
@@ -96,8 +96,12 @@ parseMPD (Right st) song opts = do
where s = M.stState st
ss = show s
si = stateGlyph s opts
- vol = int2str $ M.stVolume st
- (p, t) = M.stTime st
+ vol = int2str $ case M.stVolume st of
+ Just x -> x
+ Nothing -> 0
+ (p, t) = case M.stTime st of
+ Just x -> x
+ Nothing -> (0, 0)
[lap, len, remain] = map showTime [floor p, t, max 0 (t - floor p)]
b = if t > 0 then realToFrac $ p / fromIntegral t else 0
plen = int2str $ M.stPlaylistLength st