blob: b8cad0ceb6b2ef8e4ea79b3654ba433085f71e6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/bin/sh
draw() {
kitten icat --stdin no --transfer-mode memory --place "${w}x${h}@${x}x${y}" "$1" </dev/null >/dev/tty
exit 1
}
file="$1"
w="$2"
h="$3"
x="$4"
y="$5"
out="$(pistol $file)"
offset="$(echo $out | wc -l)"
y="$((y+offset))"
echo "$out"
case "$(file -Lb --mime-type "$file")" in
image/*)
draw "$file"
;;
video/*)
# vidthumb is from here:
# https://raw.githubusercontent.com/duganchen/kitty-pistol-previewer/main/vidthumb
draw "$(vidthumb "$file" ffmpegthumbnailer)"
;;
audio/*)
draw "$(vidthumb "$file" ffmpegthumbnailer)"
;;
application/pdf)
draw "$(vidthumb "$file" magick)"
;;
esac
|