projects
/
xyz.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d1034b2
)
Case for when there is no video
author
Cameron Ball
<cameron@moodle.com>
Thu, 13 Jun 2019 08:00:22 +0000
(16:00 +0800)
committer
Cameron Ball
<cameron@moodle.com>
Thu, 13 Jun 2019 08:00:22 +0000
(16:00 +0800)
app/Main.hs
patch
|
blob
|
history
diff --git
a/app/Main.hs
b/app/Main.hs
index
4d1f781
..
0b0c25b
100644
(file)
--- a/
app/Main.hs
+++ b/
app/Main.hs
@@
-67,13
+67,19
@@
entry = do
then putStrLn "Video filename?" >> getLine >>= return . ("::" ++) . (++ ".webm")
else return ""
then putStrLn "Video filename?" >> getLine >>= return . ("::" ++) . (++ ".webm")
else return ""
+ ytLink <- if (ytUrl /= "")
+ then return $ "\n<a href=\"https://www.youtube.com/watch?v=" ++ ytUrl ++ "\">https://www.youtube.com/watch?v=" ++ ytUrl ++ "</a>"
+ else return ""
+
entryNum <- fmap ((+1) . length) $ allFilesIn "entries"
stamp <- fmap round getPOSIXTime
let filename = "entries/" ++ (show entryNum) ++ "-" ++ (unpack . (toLower. replace " " "-") $ pack entryName) ++ ".txt"
entryNum <- fmap ((+1) . length) $ allFilesIn "entries"
stamp <- fmap round getPOSIXTime
let filename = "entries/" ++ (show entryNum) ++ "-" ++ (unpack . (toLower. replace " " "-") $ pack entryName) ++ ".txt"
- writeFile filename (show stamp ++ "::" ++ entryName ++ ytFilename ++ "\nEntry goes here!\nᚳᚱᛒ
\n<a href=\"https://www.youtube.com/watch?v=" ++ ytUrl ++ "\">https://www.youtube.com/watch?v=" ++ ytUrl ++ "</a>"
)
+ writeFile filename (show stamp ++ "::" ++ entryName ++ ytFilename ++ "\nEntry goes here!\nᚳᚱᛒ
" ++ ytLink
)
putStrLn $ "Created " ++ filename
callCommand $ "nano " ++ filename
putStrLn $ "Created " ++ filename
callCommand $ "nano " ++ filename
- callCommand $ "youtube-dl -f 'webm[height<1080]+bestaudio' \"https://www.youtube.com/watch?v=" ++ ytUrl ++ "\" -o 'build/videos/" ++ (snd . splitAt 2 $ ytFilename) ++ "'"
+ if (ytUrl /= "")
+ then callCommand $ "youtube-dl -f 'webm[height<1080]+bestaudio' \"https://www.youtube.com/watch?v=" ++ ytUrl ++ "\" -o 'build/videos/" ++ (snd . splitAt 2 $ ytFilename) ++ "'"
+ else return ()
build
usage :: IO ()
build
usage :: IO ()