Commit d7230894 authored by Henrik Tramberend's avatar Henrik Tramberend
Browse files

Optimize dependncies for recorded videos

parent 5c3f943e
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
......@@ -10,6 +11,7 @@ import Data.IORef ()
import Data.List
import Data.String ()
import qualified Data.Text as Text
import Data.Time (diffUTCTime)
import Data.Version
import Development.Shake
import GHC.IO.Encoding
......@@ -268,8 +270,19 @@ run = do
--
"**/*-recording.mp4" %> \out -> do
let src = replaceSuffix "-recording.mp4" "-recording.webm" out
need [src]
command [] "ffmpeg" ["-nostdin", "-v", "fatal", "-y", "-i", src, "-vcodec", "copy", "-acodec", "aac", out]
let runFfmpeg =
command [] "ffmpeg" ["-nostdin", "-v", "fatal", "-y", "-i", src, "-vcodec", "copy", "-acodec", "aac", out]
webmExists <- liftIO $ Dir.doesFileExist src
when (webmExists) $ do
need [src]
mp4Exists <- liftIO $ Dir.doesFileExist out
if not mp4Exists
then runFfmpeg
else do
let modTime = liftIO . Dir.getModificationTime
mp4Mod <- modTime out
webmMod <- modTime src
when (diffUTCTime webmMod mp4Mod > 0.0) runFfmpeg
--
"**/*.tex.svg" %> \out -> do
let src = dropExtension out
......
......@@ -189,7 +189,9 @@ annotationSuffix = "-annot.json"
timesSuffix = "-times.json"
recordingSuffix = "-recording.webm"
recordingSuffix1 = "-recording.webm"
recordingSuffix2 = "-recording.mp4"
recordingTargetSuffix = "-recording.mp4"
......@@ -199,6 +201,7 @@ sourceRegexes :: [String] =
"-deck-index.yaml\\'",
"-quest.yaml\\'",
"-recording.webm\\'",
"-recording.mp4\\'",
"-times.json\\'",
"-annot.json\\'",
"\\`(^_).*\\.scss\\'"
......@@ -250,7 +253,10 @@ scanTargets meta = do
_questions = sort $ calcTargets questSuffix questHTMLSuffix srcs,
_annotations = sort $ calcTargets annotationSuffix annotationSuffix srcs,
_times = sort $ calcTargets timesSuffix timesSuffix srcs,
_recordings = sort $ calcTargets recordingSuffix recordingTargetSuffix srcs,
_recordings =
List.nub $ sort $
calcTargets recordingSuffix1 recordingTargetSuffix srcs
<> calcTargets recordingSuffix2 recordingTargetSuffix srcs,
_css = sort $ calcTargets ".scss" ".css" srcs
}
where
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment