From bc8b37cfd47a96b45e5823cd5d139765eecae6ca Mon Sep 17 00:00:00 2001 From: horhik Date: Tue, 8 Feb 2022 22:44:40 +0300 Subject: [PATCH] prints only changed lines --- src/Main.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Main.hs b/src/Main.hs index 6558cbe..9aa7b01 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -13,6 +13,10 @@ import Data.Algorithm.DiffOutput data GeneratorState = IsRunning | IsFinished deriving (Eq) +getChanges :: Diff f -> Bool +getChanges (First _) = True +getChanges _ = False + showRunning html = IsRunning getCheckBoxList html = html @@ -22,7 +26,7 @@ timecodeGenerator IsFinished _ _ = return () timecodeGenerator IsRunning text time = do html <- simpleHttp "https://hd.socks.town/s/h0jnEJQWy/download" let body = (splitOn ("\n")) . L8.unpack $ html - print $ getDiff body text + print $ filter getChanges $ getDiff body text threadDelay 1000000 if showRunning body == IsRunning then