bin/b: handle audio better in non-kitty terminal
This commit is contained in:
parent
e8eeb04303
commit
68ef1c1bcb
|
@ -86,13 +86,15 @@ for arg; do
|
|||
case "$(file "$arg")" in
|
||||
(*\ ?udio*)
|
||||
img="$tmpfile.png"
|
||||
case $TERM in (*-kitty) kitty=true; audioheight=2;; (*) audioheight=5;; esac
|
||||
if which audiowaveform 2>/dev/null >&2
|
||||
then find "$img" -not -empty 2>/dev/null | grep --quiet . ||
|
||||
audiowaveform --quiet --pixels-per-second 2 --height 36 --width 2000 --amplitude-scale auto \
|
||||
--background-color 000000 --waveform-color 99BBFF --axis-label-color 000000 \
|
||||
--input-filename "$arg" --output-format png >"$img" && {
|
||||
timg -g $(tput cols)x2 "$arg" && printf "\\033[2A "
|
||||
timg -g $(tput cols)x2 --auto-crop --upscale "$img"
|
||||
test "$kitty" && timg -g x$audioheight "$arg" &&
|
||||
printf "\\033[${audioheight}A%$(expr $audioheight \* 3)s"
|
||||
timg -g x$audioheight --auto-crop --upscale "$img"
|
||||
}
|
||||
fi
|
||||
timga+=("$arg")
|
||||
|
|
Loading…
Reference in New Issue