diff options
author | Tony Morris <tmorris@tmorris.net> | 2014-08-29 09:13:31 +1000 |
---|---|---|
committer | Tony Morris <tmorris@tmorris.net> | 2014-08-29 09:13:31 +1000 |
commit | e64c4d26448ebadc8b08f95d9c591ebe9a9f6ea0 (patch) | |
tree | ae82077c2b2d1a3566c8c43cc7097b3f5782845e | |
parent | 4fc5b8a1b5998dff4717478b6772878c1ed2de7f (diff) | |
download | xmobar-e64c4d26448ebadc8b08f95d9c591ebe9a9f6ea0.tar.gz xmobar-e64c4d26448ebadc8b08f95d9c591ebe9a9f6ea0.tar.bz2 |
Change <dewPoint> to be <dewPointC> and <dewPointF>
-rw-r--r-- | readme.md | 2 | ||||
-rw-r--r-- | src/Plugins/Monitors/Weather.hs | 16 |
2 files changed, 11 insertions, 7 deletions
@@ -678,7 +678,7 @@ something like: - Variables that can be used with the `-t`/`--template` argument: `station`, `stationState`, `year`, `month`, `day`, `hour`, `wind`, `visibility`, `skyCondition`, `tempC`, `tempF`, - `dewPoint`, `rh`, `pressure` + `dewPointC`, `dewPointF`, `rh`, `pressure` - Default template: `<station>: <tempC>C, rh <rh>% (<hour>)` - Retrieves weather information from http://weather.noaa.gov. diff --git a/src/Plugins/Monitors/Weather.hs b/src/Plugins/Monitors/Weather.hs index ba4d911..1050637 100644 --- a/src/Plugins/Monitors/Weather.hs +++ b/src/Plugins/Monitors/Weather.hs @@ -37,7 +37,8 @@ weatherConfig = mkMConfig , "skyCondition" , "tempC" , "tempF" - , "dewPoint" + , "dewPointC" + , "dewPointF" , "rh" , "pressure" ] @@ -54,7 +55,8 @@ data WeatherInfo = , skyCondition :: String , tempC :: Int , tempF :: Int - , dewPoint :: String + , dewPointC :: Int + , dewPointF :: Int , humidity :: Int , pressure :: Int } deriving (Show) @@ -117,13 +119,15 @@ parseData = sk <- getAfterString "Sky conditions: " skipTillString "Temperature: " (tC,tF) <- pTemp - dp <- getAfterString "Dew Point: " + skipTillString "Dew Point: " + -- dp <- getAfterString "Dew Point: " + (dC, dF) <- pTemp skipTillString "Relative Humidity: " rh <- pRh skipTillString "Pressure (altimeter): " p <- pPressure manyTill skipRestOfLine eof - return [WI st ss y m d h w v sk tC tF dp rh p] + return [WI st ss y m d h w v sk tC tF dC dF rh p] defUrl :: String defUrl = "http://weather.noaa.gov/pub/data/observations/metar/decoded/" @@ -139,10 +143,10 @@ getData station = do errHandler _ = return "<Could not retrieve data>" formatWeather :: [WeatherInfo] -> Monitor String -formatWeather [WI st ss y m d h w v sk tC tF dp r p] = +formatWeather [WI st ss y m d h w v sk tC tF dC dF r p] = do cel <- showWithColors show tC far <- showWithColors show tF - parseTemplate [st, ss, y, m, d, h, w, v, sk, cel, far, dp, show r , show p ] + parseTemplate [st, ss, y, m, d, h, w, v, sk, cel, far, show dC, show dF, show r , show p ] formatWeather _ = getConfigValue naString runWeather :: [String] -> Monitor String |