From 94dfb2d3c878273cf9a8efa9aa20fd90c8cb761e Mon Sep 17 00:00:00 2001 From: Jose A Ortega Ruiz Date: Thu, 18 Nov 2010 23:23:48 +0100 Subject: Wee refactoring Ignore-this: 705ca49db1de40582c3e9052813ea398 darcs-hash:20101118222348-748be-20f09415cd721dd3254c36014e6b473ce0b0e586.gz --- Plugins/Monitors/MPD.hs | 15 ++++++++------- 1 file 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 -- cgit v1.2.3