From 72acb4ad02d7add803c8bf397aa0f58106cd2672 Mon Sep 17 00:00:00 2001 From: Dino Morelli Date: Sat, 31 Jan 2015 15:43:18 -0500 Subject: Added additional wind parser case for "Variable at" Wind data sometimes looks like this: "Wind: Variable at 3 MPH (3 KT):0" Note the missing direction info. This fix adds an additional parser for this case to pWind. --- src/Plugins/Monitors/Weather.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Plugins/Monitors/Weather.hs b/src/Plugins/Monitors/Weather.hs index 3cfbc74..5d3317e 100644 --- a/src/Plugins/Monitors/Weather.hs +++ b/src/Plugins/Monitors/Weather.hs @@ -99,6 +99,12 @@ pWind = let tospace = manyTill anyChar (char ' ') wind0 = do manyTill skipRestOfLine (string "Wind: Calm:0") return pWind0 + windVar = do manyTill skipRestOfLine (string "Wind: Variable at ") + mph <- tospace + string "MPH (" + knot <- tospace + manyTill anyChar newline + return ("μ", "μ", mph, knot) wind = do manyTill skipRestOfLine (string "Wind: from the ") cardinal <- tospace char '(' @@ -109,7 +115,7 @@ pWind = knot <- tospace manyTill anyChar newline return (cardinal, azimuth, mph, knot) - in try wind0 <|> wind + in try wind0 <|> try windVar <|> wind pTemp :: Parser (Int, Int) pTemp = do let num = digit <|> char '-' <|> char '.' -- cgit v1.2.3