2022-08-13 05:26:11 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2022-09-19 02:52:05 +00:00
|
|
|
img () {
|
2023-05-05 04:09:10 +00:00
|
|
|
#chafa "$1" --size="$2"x"$3" --animate=false | sed 's/#/\n#/g'
|
|
|
|
chafa --format=symbols "$1" --size="$2"x"$3"
|
2022-09-19 02:52:05 +00:00
|
|
|
}
|
|
|
|
|
2022-08-13 05:26:11 +00:00
|
|
|
W="$(($(tput cols)/2 - 10))"
|
|
|
|
#H="$(tput lines)"
|
|
|
|
|
|
|
|
fn="$1"
|
2023-03-10 04:54:58 +00:00
|
|
|
w="$(($2 - 5))"
|
2022-08-13 05:26:11 +00:00
|
|
|
h="$3"
|
|
|
|
x="$4"
|
|
|
|
y="$5"
|
|
|
|
|
|
|
|
case "$fn" in
|
|
|
|
*.tar*) tar tf "$1";;
|
|
|
|
*.zip) unzip -l "$1";;
|
|
|
|
*.rar) unrar l "$1";;
|
|
|
|
*.7z) 7z l "$1";;
|
2022-09-19 02:52:05 +00:00
|
|
|
*.jpg | *.JPG | *.jpeg) img "$fn" "$w" "$h";;
|
2022-12-21 19:53:32 +00:00
|
|
|
*.webp) img "$fn" "$w" "$h";;
|
2022-09-19 02:52:05 +00:00
|
|
|
*.png | *.svg | *.gif) img "$fn" "$w" "$h";; #viu -t "$1" -w "$W" ;; #chafa "$fn" --size="$w"x"$h" ;;
|
2023-03-10 04:54:58 +00:00
|
|
|
*.mp4 | *.mkv | *.webm | *.avi | *.mpg | *.mpeg | *.ogv | *.flv | *.wmv | *.WMV) ffmpegthumbnailer -s 0 -i "$fn" -c jpeg -o - | img - "$w" "$h";;
|
2022-08-13 05:26:11 +00:00
|
|
|
*.pdf) pdftotext "$1" -;;
|
|
|
|
*) bat -f "$1";; #*) highlight -O ansi "$1" || cat "$1";;
|
|
|
|
esac
|
2023-05-02 04:33:51 +00:00
|
|
|
|
|
|
|
exit 0
|