diff options
author | Yuchen Pei <hi@ypei.me> | 2022-05-28 00:48:52 +1000 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-05-28 00:48:52 +1000 |
commit | 20231d809b57c3050fb1cd812ea4c6e66cdaf6fb (patch) | |
tree | f395be8b27b4ff067ad1394fd39d01452433aef1 /src/Main.hs | |
parent | caf354c7e5bcb5142d8b4358824d22d3de122f34 (diff) |
time and map updates
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Main.hs b/src/Main.hs index f3f8a5a..133d155 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -10,10 +10,11 @@ import System.FilePath main :: IO () main = do - (feeds, maildir) <- getUserdata "./.f2m.json" + (feeds, maildir, dbPath) <- getUserdata "./.f2m.json" whenJust maildir $ \root -> do mapM_ (createDirectoryIfMissing True) [root </> "new", root </> "cur", root </> "tmp"] - messages <- (fmap concat . sequence) $ - (\feed -> toMessagesFromUrl (url feed) (lastUpdated feed)) <$> feeds - mapM_ (writeMessage root) messages + feedMessages <- sequence $ + (\feed -> toMessagesFromUrl (fuUrl feed) (fuLastUpdated feed)) <$> feeds + mapM_ (writeMessage root) $ concat feedMessages + whenJust dbPath $ \dbPath' -> updateLastUpdated dbPath' feeds feedMessages |