summaryrefslogtreecommitdiffhomepage
path: root/src/lib/GMPDP.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/GMPDP.hs')
-rw-r--r--src/lib/GMPDP.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/GMPDP.hs b/src/lib/GMPDP.hs
index 370e360..d7e36de 100644
--- a/src/lib/GMPDP.hs
+++ b/src/lib/GMPDP.hs
@@ -7,14 +7,13 @@ module GMPDP where
import Data.Aeson
import Data.Text
import Control.Applicative
-import Control.Monad
import qualified Data.ByteString.Lazy as B
import Network.HTTP.Conduit (simpleHttp)
import GHC.Generics
import Xmobar
-import Control.Monad (when)
+import Control.Monad (when, guard)
import Control.Concurrent.STM
import Control.Exception (SomeException (..), handle, evaluate)
@@ -61,7 +60,7 @@ getGMPDPStatus = do
Left _ -> return Nothing
Right r -> return $ Just r
-data GMPDP = GMPDP String deriving (Show,Read,Generic)
+newtype GMPDP = GMPDP String deriving (Show,Read,Generic)
handleNotification :: TVar (Maybe GMPDPStatus) -> Event -> IO ()
handleNotification v _ =
@@ -70,8 +69,8 @@ handleNotification v _ =
formatStatus Nothing = ""
formatStatus (Just s) =
fmtt (current $ time s) ++ "/" ++ fmtt (total $ time s) ++
- " " ++ (title $ song s) ++ " <fc=sienna4>" ++ (album $ song s) ++ "</fc>" ++
- " " ++ (artist $ song s)
+ " " ++ title (song s) ++ " <fc=sienna4>" ++ album (song s) ++ "</fc>" ++
+ " " ++ artist (song s)
where fmtt ms = let s = ms `div` 1000
sr x = if x < 10 then "0" ++ show x else show x
in sr (s `div` 60) ++ ":" ++ sr (s `mod` 60)