clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
awb99 2021-04-02T01:40:46.209500Z

@hiredman thanks .. very helpful

ghadi 2021-04-02T02:08:03.209900Z

ghadi 2021-04-02T02:12:24.210Z

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

ghadi 2021-04-02T02:12:47.210200Z

in your case @hoertlehner, you would put all the retries inside step!

ghadi 2021-04-02T02:13:39.210400Z

the gist above is a way to consume iterated api patterns generically. it is not a helper for retries

ghadi 2021-04-02T02:14:27.210600Z

the core operation, the step! argument, is to fetch one page (no matter how many retries it takes)

ghadi 2021-04-02T02:15:30.210800Z

I admit that the docstring is a bit much

ghadi 2021-04-02T02:16:57.211Z

:kf = key function :vsf = values (plural) function

awb99 2021-04-02T02:28:35.211300Z

Thank you very much

ghadi 2021-04-02T02:28:46.211700Z

whoops meant to post that in a thread

Max 2021-04-02T02:56:57.215800Z

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

Max 2021-04-02T02:57:30.216900Z

Though now that I look at it it’s actually uncurrying, not currying 😅

Max 2021-04-02T03:03:41.218800Z

uncurry :: (a -> b -> c) -> (a, b) -> c

zendevil 2021-04-02T16:30:59.223500Z

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?

adam-james 2021-04-10T23:42:48.325300Z

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

p-himik 2021-04-02T16:40:05.223900Z

I'd simply use ffmpeg, if the platform has it.

zendevil 2021-04-02T17:30:40.225200Z

So use this?: https://clojuredocs.org/clojure.java.shell/sh. And what if the platform doesn’t have ffmpeg?

p-himik 2021-04-02T17:35:51.225400Z

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.

lukasz 2021-04-02T17:36:34.225600Z

Or you can use a web service like http://coconut.co - it works great in some contexts and is pretty affordable.

borkdude 2021-04-02T18:04:42.225900Z

could also look at https://github.com/cnuernber/avclj but this still requires the right native library to be installed :)

borkdude 2021-04-02T18:05:37.226400Z

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

2021-04-02T18:24:31.226600Z

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

borkdude 2021-04-02T18:26:52.226800Z

Here is @adam.james automating video edits with babashka and ffmpeg: https://youtu.be/Tmgy57R9HZM same tricks apply to normal Clojure as well

👍 1
🙂 1