mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
reuse image code, use more variables
This commit is contained in:
parent
a918a59856
commit
4d77066b62
|
@ -156,7 +156,12 @@ preview_file () {
|
||||||
fifo_pager ls --color=always
|
fifo_pager ls --color=always
|
||||||
fi
|
fi
|
||||||
elif [ "$encoding" = "binary" ]; then
|
elif [ "$encoding" = "binary" ]; then
|
||||||
if [ "${mimetype%%/*}" = "image" ] ; then
|
if [ "${mimetype%%/*}" = "image" ] || [ "${mimetype%%/*}" = "video" ]; then
|
||||||
|
if [ "${mimetype%%/*}" = "video" ] && [ "$USE_VIDEOTHUMB" -ne 0 ] && exists ffmpegthumbnailer; then
|
||||||
|
videothumb="/tmp/videothumb.$$.png"
|
||||||
|
ffmpegthumbnailer -s 0 -i "$1" -o "$videothumb"
|
||||||
|
set "$videothumb"
|
||||||
|
fi
|
||||||
if [ "$TERMINAL" = "kitty" ]; then
|
if [ "$TERMINAL" = "kitty" ]; then
|
||||||
# Kitty terminal users can use the native image preview method.
|
# Kitty terminal users can use the native image preview method.
|
||||||
kitty +kitten icat --silent --transfer-mode=stream --stdin=no \
|
kitty +kitten icat --silent --transfer-mode=stream --stdin=no \
|
||||||
|
@ -168,19 +173,6 @@ preview_file () {
|
||||||
else
|
else
|
||||||
fifo_pager print_bin_info "$1"
|
fifo_pager print_bin_info "$1"
|
||||||
fi
|
fi
|
||||||
elif [ "${mimetype%%/*}" = "video" ] && [ "$USE_VIDEOTHUMB" -ne 0 ] && exists ffmpegthumbnailer; then
|
|
||||||
ffmpegthumbnailer -s 0 -i "$1" -o "/tmp/videothumb.png"
|
|
||||||
if [ "$TERMINAL" = "kitty" ]; then
|
|
||||||
# Kitty terminal users can use the native image preview method.
|
|
||||||
kitty +kitten icat --silent --transfer-mode=stream --stdin=no \
|
|
||||||
"/tmp/videothumb.png" &
|
|
||||||
elif exists catimg; then
|
|
||||||
catimg "/tmp/videothumb.png"
|
|
||||||
elif exists viu; then
|
|
||||||
viu -t "/tmp/videothumb.png"
|
|
||||||
else
|
|
||||||
fifo_pager print_bin_info "$1"
|
|
||||||
fi
|
|
||||||
elif [ "$mimetype" = "application/zip" ] ; then
|
elif [ "$mimetype" = "application/zip" ] ; then
|
||||||
fifo_pager unzip -l "$1"
|
fifo_pager unzip -l "$1"
|
||||||
elif [ "$ext" = "gz" ] || [ "$ext" = "bz2" ] ; then
|
elif [ "$ext" = "gz" ] || [ "$ext" = "bz2" ] ; then
|
||||||
|
@ -222,6 +214,7 @@ if [ "$PREVIEW_MODE" ] ; then
|
||||||
kitty @ last-used-layout --no-response >/dev/null 2>&1
|
kitty @ last-used-layout --no-response >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm $videothumb
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue