@hiredman thanks .. very helpful
@hoertlehner https://gist.github.com/ghadishayban/2e81021f0156c017babd460cba1d58d6
step!
is a function that given a token, hits the http endpoint to fetch data - returning a channel with that data. when token is nil
, that signifies the initial call to step!
:vsf
the vsf argument is a function taking the result of step!
(AKA fetched api data) and extract a collection of the juicy bits
:kf
would take the fetched page data and produce the token that, when given to step!
grabs the next page
in your case @hoertlehner, you would put all the retries inside step!
the gist above is a way to consume iterated api patterns generically. it is not a helper for retries
the core operation, the step!
argument, is to fetch one page (no matter how many retries it takes)
I admit that the docstring is a bit much
:kf = key function :vsf = values (plural) function
Thank you very much
whoops meant to post that in a thread
From the fact that turns a tuple into individual arguments. For example here’s type of curry
in haskell:
curry :: ((a, b) -> c) -> a -> b -> c
Though now that I look at it it’s actually uncurrying, not currying 😅
uncurry :: (a -> b -> c) -> (a, b) -> c
Suppose I have a .mov video file of length 4 min. I want to crop 5 s section of the video file and create another file out of it. How do I do that?
I give a +1 for ffmpeg if at all possible. If it’s a one off thing, I would recommend learning how to invoke ffmpeg directly. Save the one liners in a note somewhere and collect them over time. My ffmpeg + babashka work is glue applied to the one liners I’ve collected
I'd simply use ffmpeg
, if the platform has it.
So use this?: https://clojuredocs.org/clojure.java.shell/sh. And what if the platform doesn’t have ffmpeg?
Yep.
Then, after recovering from the surprise, I would look for other avenues. :) Perhaps, there are pure Java libraries that deal with videos. Perhaps, the .mov
container and the actual codec have some specialized implementations that you can use. Or maybe you can write something yourself.
Or you can use a web service like http://coconut.co - it works great in some contexts and is pretty affordable.
could also look at https://github.com/cnuernber/avclj but this still requires the right native library to be installed :)
I used avidemux to cut out some parts from an .mkv file. I use this for very basic editing of youtube videos I recorded with OBS
for audio/video codec I wouldn't rely on a language stdlib, there's a lot of variety and a lot of quirks, ffmpeg is hard to beat for programmability plus codec support
Here is @adam.james automating video edits with babashka and ffmpeg: https://youtu.be/Tmgy57R9HZM same tricks apply to normal Clojure as well