-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Video display #118
Comments
@daslu Does Clay/Kindly support metadata on return values to know how to display them? So that when we return I obviously cannot simply |
Hi. I'm copying a few details from a private chat with @light-matters:
If you are pointing to files, you need to put them under a directory which is copied by Clay under the target directory, as explained in Referring to files. Then, you can just refer to them with the path relative to the target directory. There is also some support for custom functions, as you suggested: Functions Does it seem to make sense? |
@daslu thank you! How would we make Clay output Quarto's @light-matters perhaps we can just do ^:kind/hiccup
(let [url (->> (wl/eval (w/VideoTrim ...)) second)]
[:video [:source {:src url :type "video/mp4" }]]) WDYT? Or, using Clay fns: (defn wolf-video->hiccup [wl-result]
{:pre [(list? wl-result) (= 'Video (first wl-result))]}
^:kind/hiccup
[:video [:source {:src (second wl-result) :type "video/mp4"}]])
(k/fn [wolf-video->hiccup (wl/eval ....)]) The fn could also make the video to another place, if desired... |
Hi! Quarto Markdown can simply be included in Clojure comments or kind/md. I hope to add some better support to the other ways during the coming weekend. |
My feeling is that we should avoid explicit quarto notation where possible. Whether the output uses quarto or not to garner the particular effect seems like an implementation detail and not something for Wolframite to worry about. An argument can be made for the case of the website etc. where the exact output goal is known in advance. |
Can we highjack the return from Wolfram and add the kind information automatically (after detecting the return)? |
That would be best, but not possible with the way kind/fn works now, as far as I understand it. It either wants a vector with the fn and value (where value in our case is the returned ^{:kind/f (fn [the-value] ^:kind/hiccup [:video [:source {:src (second the-value)}]])}
the-value because then we could leave the value as-is and just attach metadata to it. However that is not how kind/fn works, as far as I see. It requires either a vector or a map. WDYT? |
Maybe we should avoid the kind function? Let's discuss this later. |
@holyjak having Anyway, |
Oh, sorry, I see what you mean now. You need the custom function to avoid changing the value I'll sleep on the |
Clay version See: https://scicloj.github.io/clay/#functions So, we can do something like: (k/fn (w/eval ...)
{:kindly/f wolf-video->hiccup}) Thanks for these helpful ideas. |
Issue: Wolfram may return `(Video <path to file> ...)` and we want to be able to display it nicely in a Clay or compatible notebook. Fix: Add ns with a fn to try add display metadata to all results, call it from eval.
Issue: Wolfram may return `(Video <path to file> ...)` and we want to be able to display it nicely in a Clay or compatible notebook. Fix: Add ns with a fn to try add display metadata to all results, call it from eval.
@light-matters could you be so kind and verify that #131 works for you? @daslu This is amazing, thanks a lot! Does the meta we attach here https://github.com/scicloj/wolframite/pull/131/files#diff-62bf9ddf1ee0d76b66dec5a61c7d8766df142e9471c228ce2e7925b67a5403d3R18-R20 look good to you? |
Looks good! |
This comment was marked as outdated.
This comment was marked as outdated.
From the other thread (#131), The format (k/video {:src "./resources/video/Baby.mp4"}) works for me rather than |
We also need to make those folders visible to clay. |
Thank you, the code works now. However, as you point out, the video must be in a folder which Clay can read. Not sure how to ensure that, when we work with a video from Wolfram. When using a notebook, we could start with having the video in an appropriate folder - just need to document this well. But what about the output of We could/should perhaps check that the url is relative, and return something else such as hiccup with a warning message, when it is not...? |
For reference, absolute paths can be given to the clay options, see this thread This is particularly necessary for operations like VideoTrim which store the results centrally. Probably we need to pass some of these default paths to whatever viewer the user uses at startup. |
Manipulating/creating a Wolfram
Video
returns a strange format that no visual tool knows how to interpret.Returns
We should some implement some sort of 'kindly' support (e.g. metadata) that allows visual tools such as Clay and Clerk to display these outputs correctly.
The text was updated successfully, but these errors were encountered: