Add lf file preview script
This commit is contained in:
parent
f586eaa8a2
commit
d05902f42c
1 changed files with 19 additions and 0 deletions
19
preview.sh
Executable file
19
preview.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
case "$(file -Lb --mime-type -- "$1")" in
|
||||
image/*)
|
||||
chafa -f sixel -s "$2x$3" --animate off --polite on -t 1 --bg black "$1"
|
||||
;;
|
||||
video/*)
|
||||
ffmpegthumbnailer -i "$1" -s 0 -c jpg -o - | chafa -f sixel -s "$2x$3" --animate off --polite on -t 1 --bg black -
|
||||
;;
|
||||
application/pdf)
|
||||
magick -density 150 "$1[0]" -trim -flatten -sharpen 0x1.0 png:- | chafa -f sixel -s "$2x$3" --animate off --polite on -t 1 --bg white -
|
||||
;;
|
||||
application/json)
|
||||
cat "$1" | jq '.'
|
||||
;;
|
||||
text/*)
|
||||
bat "$1"
|
||||
;;
|
||||
esac
|
||||
Loading…
Reference in a new issue