import Turtle
import Prelude hiding (FilePath)
import Data.Text hiding (find)
main = do
f <- view $ format fp <$> find (suffix ".mp4") "/Users/me/videos"
procs "ffmpeg" ["-vn","-acodec","libmp3lame","-ac","2","-ab","160k","-ar","48000","-i"] empty
Basically I want to feed all the video filenames to ffmpeg. Two questions:
- How to combine the
procswithShellstreams? - ffmpeg takes two inputs: one for
-iand one for the output filename. What is the best practise to implement this with Turtle?
I've seen the foldIO function that looks promising. But I can't figure out how to use it.
Don't use
viewlike that. You use that to run aShell, and it prints the resulting values and makes them inaccessible to you.Shellitself is a monad, so you should build up aShellaction, then run with withvieworsh(to discard the values without printing). (They're terminal functions; you use them only when you're done doing what you're doing). In fact,MonadIO Shell, so anything you can do inIOyou can do inShell(vialiftIO :: MonadIO m => IO a -> m a).This is comparable to