prints only changed lines

This commit is contained in:
horhik 2022-02-08 22:44:40 +03:00
parent 26ce916e80
commit bc8b37cfd4

View file

@ -13,6 +13,10 @@ import Data.Algorithm.DiffOutput
data GeneratorState = IsRunning | IsFinished data GeneratorState = IsRunning | IsFinished
deriving (Eq) deriving (Eq)
getChanges :: Diff f -> Bool
getChanges (First _) = True
getChanges _ = False
showRunning html = IsRunning showRunning html = IsRunning
getCheckBoxList html = html getCheckBoxList html = html
@ -22,7 +26,7 @@ timecodeGenerator IsFinished _ _ = return ()
timecodeGenerator IsRunning text time = do timecodeGenerator IsRunning text time = do
html <- simpleHttp "https://hd.socks.town/s/h0jnEJQWy/download" html <- simpleHttp "https://hd.socks.town/s/h0jnEJQWy/download"
let body = (splitOn ("\n")) . L8.unpack $ html let body = (splitOn ("\n")) . L8.unpack $ html
print $ getDiff body text print $ filter getChanges $ getDiff body text
threadDelay 1000000 threadDelay 1000000
if showRunning body == IsRunning then if showRunning body == IsRunning then