diff options
author | Jose A Ortega Ruiz <jao@gnu.org> | 2010-11-18 23:23:48 +0100 |
---|---|---|
committer | Jose A Ortega Ruiz <jao@gnu.org> | 2010-11-18 23:23:48 +0100 |
commit | 94dfb2d3c878273cf9a8efa9aa20fd90c8cb761e (patch) | |
tree | d99573c48db9101cc51152ef4d8b49a4249d1405 /Plugins | |
parent | f590bb2676c0fcdc2186d75284d353ce962dabd8 (diff) | |
download | xmobar-94dfb2d3c878273cf9a8efa9aa20fd90c8cb761e.tar.gz xmobar-94dfb2d3c878273cf9a8efa9aa20fd90c8cb761e.tar.bz2 |
Wee refactoring
Ignore-this: 705ca49db1de40582c3e9052813ea398
darcs-hash:20101118222348-748be-20f09415cd721dd3254c36014e6b473ce0b0e586.gz
Diffstat (limited to 'Plugins')
-rw-r--r-- | Plugins/Monitors/MPD.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Plugins/Monitors/MPD.hs b/Plugins/Monitors/MPD.hs index b97eca4..daf0ed4 100644 --- a/Plugins/Monitors/MPD.hs +++ b/Plugins/Monitors/MPD.hs @@ -97,13 +97,14 @@ stateGlyph s o = parseSong :: M.Response (Maybe M.Song) -> Monitor [String] parseSong (Left _) = return $ repeat "" parseSong (Right Nothing) = return $ repeat "" -parseSong (Right (Just s)) = do - let x = M.sgFilePath s : map str [ M.Name, M.Artist, M.Composer, M.Performer - , M.Album, M.Title, M.Track, M.Genre ] - mapM showWithPadding x - where join [] = "" - join (x:xs) = foldl (\a o -> a ++ ", " ++ o) x xs - str sel = maybe "" join (M.sgGet sel s) +parseSong (Right (Just s)) = + let join [] = "" + join (x:xs) = foldl (\a o -> a ++ ", " ++ o) x xs + str sel = maybe "" join (M.sgGet sel s) + sels = [ M.Name, M.Artist, M.Composer, M.Performer + , M.Album, M.Title, M.Track, M.Genre ] + fields = M.sgFilePath s : map str sels + in mapM showWithPadding fields showTime :: Integer -> String showTime t = int2str minutes ++ ":" ++ int2str seconds |