From 54e57b4df0170bd5673e73d9ef594cd26eec62fb Mon Sep 17 00:00:00 2001 From: horhik Date: Thu, 10 Feb 2022 10:24:54 +0300 Subject: [PATCH] Write timecodes to file --- src/Main.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Main.hs b/src/Main.hs index c1d901c..5464079 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -11,7 +11,7 @@ import Data.List.Split import Data.Algorithm.Diff import Data.Algorithm.DiffOutput import Data.ByteString.Lazy.UTF8 (toString) - +import System.IO data GeneratorState = IsRunning | IsFinished deriving (Eq) @@ -43,10 +43,11 @@ myFormatDiffTime (a,b)= formatTime defaultTimeLocale "%H:%M:%S" . posixSecondsTo -- Printing changes is they exsists genOutput :: Maybe String -> String -> IO () genOutput (Just changes) time = do - putStrLn $ time ++ "\n " ++ changes + file <- openFile "timecodes.md" AppendMode + hPutStrLn file $ time ++ "\n " ++ changes genOutput Nothing _ = return() - +-- Returning fetched url as a string separated by \n fetchFile :: String -> IO [String] fetchFile url = do html <- simpleHttp url