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
|
case "$(file "$arg")" in
|
||||||
(*\ ?udio*)
|
(*\ ?udio*)
|
||||||
img="$tmpfile.png"
|
img="$tmpfile.png"
|
||||||
|
case $TERM in (*-kitty) kitty=true; audioheight=2;; (*) audioheight=5;; esac
|
||||||
if which audiowaveform 2>/dev/null >&2
|
if which audiowaveform 2>/dev/null >&2
|
||||||
then find "$img" -not -empty 2>/dev/null | grep --quiet . ||
|
then find "$img" -not -empty 2>/dev/null | grep --quiet . ||
|
||||||
audiowaveform --quiet --pixels-per-second 2 --height 36 --width 2000 --amplitude-scale auto \
|
audiowaveform --quiet --pixels-per-second 2 --height 36 --width 2000 --amplitude-scale auto \
|
||||||
--background-color 000000 --waveform-color 99BBFF --axis-label-color 000000 \
|
--background-color 000000 --waveform-color 99BBFF --axis-label-color 000000 \
|
||||||
--input-filename "$arg" --output-format png >"$img" && {
|
--input-filename "$arg" --output-format png >"$img" && {
|
||||||
timg -g $(tput cols)x2 "$arg" && printf "\\033[2A "
|
test "$kitty" && timg -g x$audioheight "$arg" &&
|
||||||
timg -g $(tput cols)x2 --auto-crop --upscale "$img"
|
printf "\\033[${audioheight}A%$(expr $audioheight \* 3)s"
|
||||||
|
timg -g x$audioheight --auto-crop --upscale "$img"
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
timga+=("$arg")
|
timga+=("$arg")
|
||||||
|
|
Loading…
Reference in New Issue