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
procs
withShell
streams? - ffmpeg takes two inputs: one for
-i
and 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
view
like that. You use that to run aShell
, and it prints the resulting values and makes them inaccessible to you.Shell
itself is a monad, so you should build up aShell
action, then run with withview
orsh
(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 inIO
you can do inShell
(vialiftIO :: MonadIO m => IO a -> m a
).This is comparable to