From 0310c0b24ca508a70d2e276c96898d76aed7c7ea Mon Sep 17 00:00:00 2001 From: Jose A Ortega Ruiz Date: Sat, 2 Oct 2010 03:54:15 +0200 Subject: MPD refactoring Ignore-this: 41e26c0538bf4a4e78dceda558db5011 darcs-hash:20101002015415-748be-087e42a5001aa030762c0c6a7da13c19c48b602b.gz --- Plugins/Monitors/MPD.hs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'Plugins') diff --git a/Plugins/Monitors/MPD.hs b/Plugins/Monitors/MPD.hs index 250fd47..34f409c 100644 --- a/Plugins/Monitors/MPD.hs +++ b/Plugins/Monitors/MPD.hs @@ -21,9 +21,9 @@ import qualified Network.MPD as M mpdConfig :: IO MConfig mpdConfig = mkMConfig "MPD: " [ "bar", "state", "statei", "volume", "length" - , "lapsed", "remaining", "plength", "ppos" + , "lapsed", "remaining", "plength", "ppos", "file" , "name", "artist", "composer", "performer" - , "album", "title", "track", "file", "genre" + , "album", "title", "track", "genre" ] data MOpts = MOpts @@ -100,17 +100,11 @@ parseSong :: M.Response (Maybe M.Song) -> [String] parseSong (Left _) = repeat "" parseSong (Right Nothing) = repeat "" parseSong (Right (Just s)) = - [name, artist, composer, performer , album, title, track, path, genre] - where str sel = maybe "" head (M.sgGet sel s) - name = str M.Name - artist = str M.Artist - composer = str M.Composer - performer = str M.Performer - album = str M.Album - title = str M.Title - genre = str M.Genre - track = str M.Track - path = M.sgFilePath s + M.sgFilePath s : map str [ M.Name, M.Artist, M.Composer, M.Performer + , M.Album, M.Title, M.Track, M.Genre ] + where join [] = "" + join (x:xs) = foldl (\a o -> a ++ ", " ++ o) x xs + str sel = maybe "" join (M.sgGet sel s) showTime :: Integer -> String showTime t = int2str minutes ++ ":" ++ int2str seconds -- cgit v1.2.3