Write timecodes to file

This commit is contained in:
horhik 2022-02-10 10:24:54 +03:00
parent 6969f8db3f
commit 54e57b4df0
1 changed files with 4 additions and 3 deletions

View File

@ -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