Skip to content

Instantly share code, notes, and snippets.

@anacrolix
Created March 11, 2018 10:18
Show Gist options
  • Save anacrolix/32f55a87c47d7fb23632e49b9be8a147 to your computer and use it in GitHub Desktop.
Save anacrolix/32f55a87c47d7fb23632e49b9be8a147 to your computer and use it in GitHub Desktop.
what have i made
data Transcode = Transcode
{ inputUrl :: ByteString
, ffmpegOpts :: [ByteString]
, format :: ByteString
}
getOutputName :: ByteString -> [ByteString] -> ByteString -> ByteString
getOutputName i opts f =
(C.pack . List.map toLower . C.unpack . hex $ hashStrings (i : opts)) <> "." <>
f
target :: Transcode -> OpId
target t = C.unpack $ getOutputName .* inputUrl $. ffmpegOpts $. format .$ t
infixr 9 .$
a .$ b = (\c -> c (a b), b)
infixr 8 $.
a $. (b, c) = (\d -> b $ d $ a c, c)
infixr 7 .*
a .* (b, c) = b a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment