Skip to content

Commit

Permalink
Move withCurlDo up a statement.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Young committed Jan 10, 2012
1 parent 7d17bc0 commit 7044f0f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Haskell/Scraper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ main = do
let images = concat $ nub $ show body =~ "http://images.4chan.org/[A-Za-z0-9]+/src/[0-9]{13}.[A-Za-z0-9]+"
if (cc /= CurlOK)
then putStrLn $ "Error: " ++ show cc ++ ". Exiting."
else if quiet args
then withCurlDo $
forM_ images (\a -> getImage a (output args))
else withCurlDo $ do
putStrLn $ "Page retrieved. " ++ show (length images) ++ " images found."
forM_ images $ \a -> do
got <- getImage a (output args)
if got
then putStrLn $ "Downloaded " ++ show a
else putStrLn $ "Skipped " ++ show a
else withCurlDo $ if quiet args
then
forM_ images (\a -> getImage a (output args))
else do
putStrLn $ "Page retrieved. " ++ show (length images) ++ " images found."
forM_ images $ \a -> do
got <- getImage a (output args)
if got
then putStrLn $ "Downloaded " ++ show a
else putStrLn $ "Skipped " ++ show a

0 comments on commit 7044f0f

Please sign in to comment.