From 486c69cccbe9aa14032615a91313d20f701b61a6 Mon Sep 17 00:00:00 2001 From: Nikita Ivanov Date: Sun, 27 Nov 2022 02:47:22 +0100 Subject: [PATCH] Add audio preview --- previews.h | 1 + sh/prev/audio.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 sh/prev/audio.sh diff --git a/previews.h b/previews.h index f180dfd..43db2c4 100644 --- a/previews.h +++ b/previews.h @@ -42,6 +42,7 @@ Preview b_previews[] = { PR(NULL, "image", NULL, image, PREV_ATTR_NONE), PR(NULL, "image", "svg+xml", svg, PREV_ATTR_NONE), PR(NULL, "video", NULL, video, PREV_ATTR_NONE), + PR(NULL, "audio", NULL, audio, PREV_ATTR_NONE), PR(NULL, "application", "pdf", pdf, PREV_ATTR_NONE), PR(NULL, "application", "json", jq, PREV_ATTR_NONE), diff --git a/sh/prev/audio.sh b/sh/prev/audio.sh new file mode 100644 index 0000000..b4f2d82 --- /dev/null +++ b/sh/prev/audio.sh @@ -0,0 +1,12 @@ +# audio: ffmpegthumbnailer ffmpeg + +audio() { + ffmpegthumbnailer -i "$f" -s 0 -q 50% -t 10 -o "$cache_f" 2>/dev/null +} + +x="$(ffmpeg -hide_banner -i "$f" 2>&1)" + +printf '%s\n' "$x" +y=$((y + $(printf '%s\n' "$x" | wc -l))) + +convert_and_show_image audio