diff options
author | Joris Guyonvarch | 2015-04-12 22:46:56 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2015-04-12 22:47:27 +0200 |
commit | 10a9aa9391ac2995527557d9d808693b57236603 (patch) | |
tree | d1aae79b86a7d289b5733519683302c712fe96da /src/AdListener.hs | |
parent | 293fab1df23821b5f131603c4db56ab71681ce59 (diff) |
Ignore lines beginning with # in the configuration file
Diffstat (limited to 'src/AdListener.hs')
-rw-r--r-- | src/AdListener.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/AdListener.hs b/src/AdListener.hs index d676b61..dbd7a71 100644 --- a/src/AdListener.hs +++ b/src/AdListener.hs @@ -11,7 +11,7 @@ import qualified Data.Text.IO as T import Control.Concurrent (threadDelay) -import Ad (getResumes, getAds) +import Ad (fetchResumes, fetchAds) import Model.Ad import Model.URL @@ -27,7 +27,7 @@ import qualified Config as C listenToNewAds :: Config -> IO () listenToNewAds config = do - eitherResumes <- getResumes (C.url config) + eitherResumes <- fetchResumes (C.url config) case eitherResumes of Left error -> listenError config [] error @@ -37,7 +37,7 @@ listenToNewAds config = do listenToNewAdsWithViewedURLs :: Config -> [URL] -> IO () listenToNewAdsWithViewedURLs config viewedURLs = do - eitherResumes <- getResumes (C.url config) + eitherResumes <- fetchResumes (C.url config) case eitherResumes of Left error -> listenError config viewedURLs error @@ -48,7 +48,7 @@ listenToNewAdsWithResumes :: Config -> [URL] -> [Resume] -> IO () listenToNewAdsWithResumes config viewedURLs resumes = let (newURLs, newResumes) = getNewResumes viewedURLs resumes in do - eitherNewAds <- getAds newResumes + eitherNewAds <- fetchAds newResumes case eitherNewAds of Left error -> listenError config viewedURLs error @@ -68,7 +68,9 @@ newAdsMessage newAds = T.concat [ "Got " , T.pack . show . length $ newAds - , " new ads." + , " new ad" + , if length newAds > 1 then "s" else "" + , "." ] line = T.map (\_ -> '-') newAdsMessage in T.intercalate |