print meta to file for each new timecode-generator start
This commit is contained in:
parent
e8eacc2f0c
commit
2ee3d94d3e
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
*~
|
*~
|
||||||
dist-newstyle/
|
dist-newstyle/
|
||||||
timecodes.md
|
*.md
|
||||||
|
*.txt
|
||||||
|
|
11
src/Main.hs
11
src/Main.hs
|
@ -39,11 +39,16 @@ showRunning html = IsRunning
|
||||||
myFormatDiffTime :: (UTCTime, UTCTime) -> String
|
myFormatDiffTime :: (UTCTime, UTCTime) -> String
|
||||||
myFormatDiffTime (a,b)= formatTime defaultTimeLocale "%H:%M:%S" . posixSecondsToUTCTime $ diffUTCTime a b
|
myFormatDiffTime (a,b)= formatTime defaultTimeLocale "%H:%M:%S" . posixSecondsToUTCTime $ diffUTCTime a b
|
||||||
|
|
||||||
|
appendToFile :: String -> String -> IO()
|
||||||
|
appendToFile filename str = do
|
||||||
|
file <- openFile filename AppendMode
|
||||||
|
hPutStrLn file str
|
||||||
|
hClose file
|
||||||
|
|
||||||
-- Printing changes is they exsists
|
-- Printing changes is they exsists
|
||||||
genOutput :: Maybe String -> String -> String -> IO ()
|
genOutput :: Maybe String -> String -> String -> IO ()
|
||||||
genOutput (Just changes) time timecodeFile= do
|
genOutput (Just changes) time timecodeFile= do
|
||||||
file <- openFile timecodeFile AppendMode
|
appendToFile timecodeFile $ time ++ "\n " ++ changes
|
||||||
hPutStrLn file $ time ++ "\n " ++ changes
|
|
||||||
genOutput Nothing _ _ = return()
|
genOutput Nothing _ _ = return()
|
||||||
|
|
||||||
-- Returning fetched url as a string separated by \n
|
-- Returning fetched url as a string separated by \n
|
||||||
|
@ -79,6 +84,8 @@ main = do
|
||||||
let url:timecodeFile:xs = args
|
let url:timecodeFile:xs = args
|
||||||
time <- getCurrentTime
|
time <- getCurrentTime
|
||||||
file <- fetchFile url
|
file <- fetchFile url
|
||||||
|
appendToFile timecodeFile $ "New Timecodes starts here \n "
|
||||||
|
appendToFile timecodeFile $ show time
|
||||||
timecodeGenerator IsRunning file time url timecodeFile
|
timecodeGenerator IsRunning file time url timecodeFile
|
||||||
|
|
||||||
--let url = "https://hd.socks.town/s/h0jnEJQWy/download"
|
--let url = "https://hd.socks.town/s/h0jnEJQWy/download"
|
||||||
|
|
Loading…
Reference in a new issue