aboutsummaryrefslogtreecommitdiff
path: root/src/AdListener.hs
diff options
context:
space:
mode:
authorJoris2016-11-14 21:47:10 +0100
committerJoris2016-11-14 21:47:10 +0100
commitae45764821dc3c04eeb8c2171f14d36256ce4027 (patch)
tree99d3d3f6bf78b03232d75ce9c10b0cffd979a28e /src/AdListener.hs
parentd155bab73eb383753df4d267c7db584af44f3349 (diff)
downloadad-listener-ae45764821dc3c04eeb8c2171f14d36256ce4027.tar.gz
ad-listener-ae45764821dc3c04eeb8c2171f14d36256ce4027.tar.bz2
ad-listener-ae45764821dc3c04eeb8c2171f14d36256ce4027.zip
Warn log when no resume is parsed from search page
Diffstat (limited to 'src/AdListener.hs')
-rw-r--r--src/AdListener.hs27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/AdListener.hs b/src/AdListener.hs
index 9946d9e..3db4c6a 100644
--- a/src/AdListener.hs
+++ b/src/AdListener.hs
@@ -38,7 +38,7 @@ start conf = do
showErrorAndListenBack conf [] error
Right resumes -> do
let newURLs = map url resumes
- putStrLn "Listening to new ads…"
+ T.putStrLn "Listening to new ads…"
waitListenInterval conf
listenToNewAdsWithViewedURLs conf newURLs
@@ -59,19 +59,18 @@ listenToNewAdsWithResumes conf viewedURLs resumes =
case eitherNewAds of
Left error ->
showErrorAndListenBack conf viewedURLs error
- Right newAds ->
- do
- time <- getCurrentFormattedTime
- if not (null newAds)
- then
- let message = P.renderConsoleAds conf time newAds
- in do
- T.putStrLn message
- trySendMail conf newAds
- else
- return ()
- waitListenInterval conf
- listenToNewAdsWithViewedURLs conf (viewedURLs ++ newURLs)
+ Right newAds -> do
+ time <- getCurrentFormattedTime
+ if not (null newAds)
+ then
+ let message = P.renderConsoleAds conf time newAds
+ in do
+ T.putStrLn message
+ trySendMail conf newAds
+ else
+ return ()
+ waitListenInterval conf
+ listenToNewAdsWithViewedURLs conf (viewedURLs ++ newURLs)
trySendMail :: Conf -> [Ad] -> IO ()
trySendMail conf ads =