dwim-shell-command
dwim-shell-command copied to clipboard
quoting around complex noweb template use is unclear
Consider the following defun:
(defun dwim-shell-command-thumbnail-with-ffmpeg ()
"Generate a thumbnail with ffmpeg."
(interactive)
(dwim-shell-command-on-marked-files
"Thumbnail with ffmpeg"
" ffmpeg -i '<<f>>' -vf \"thumbnail,scale=640:360\" -frames:v 1 '<<td>>/<<fne>>.png'"
:utils "ffmpeg"
:silent-success t))
This fails with dwim-shell-command--escaped-quote-around: Couldn’t figure out how to quote for " ffmpeg -i '<<f>>' -vf "thumbnail,scale=640:360" -frames:v 1 '<<td>>/<<fne>>.png'" using / and .
If instead the command is " ffmpeg -i '<<f>>' -vf \"thumbnail,scale=640:360\" -frames:v 1 '<<fne>>.png'"
, (ie, omitting the temporary directory), this succeeds.
how does <
/
path separator doesn't seem to matter, nor does hardcoding a /tmp/
instead of using <<td>>
.
(my actual goal here is to generate temporary thumbnails for videos, so what i really want is something like " ffmpeg -i '<<f>>' -vf \"thumbnail,scale=640:360\" -frames:v 1 '<<td>>/<<fne>>.png' && feh <<td>>/<<fne>>.png"
, but omitting the && ... clause doesn't affect the error here. I'm also a little curious about how to use <
This wasn't quite possible. Made some changes.
Adds support for and
for https://github.com/xenodium/dwim-shell-command/issues/15
This adds <b>
(base name) and <bne>
(base name no extension), so we can now craft what you're after.
(my actual goal here is to generate temporary thumbnails for videos, so what i really want is something like " ffmpeg -i '<
>' -vf "thumbnail,scale=640:360" -frames:v 1 '< >/< >.png' && feh < >/< >.png", After getting the latest (v0.60), it should be possible with something like:
(defun dwim-shell-commands-video-temporary-thumbnail () "Generate a thumbnail with ffmpeg." (interactive) (let ((temp-dir (make-temp-file "thumbnails-" t))) (dwim-shell-command-on-marked-files "Thumbnail with ffmpeg" "ffmpeg -i '<<f>>' -vf \"thumbnail,scale=640:360\" -frames:v 1 '<<td>>/<<bne>>.png' && feh <<td>>/<<bne>>.png" :silent-success t :utils "ffmpeg")))
Note: I'm on a mac, so I used
open
instead offeh
. Should hopefully work on linux with feh.ps. Would be nice if there was a way to preserve the video aspect ratio in the thumbnail, if you know?
ps. Would be nice if there was a way to preserve the video aspect ratio in the thumbnail, if you know?
This worked for me: "ffmpeg -i '<<f>>' -ss 00:00:01.000 -vframes 1 '<<td>>/<<bne>>.jpg' && feh <<td>>/<<bne>>.jpg"