support thumbnails for cbz, dbr and cbt

This commit is contained in:
cho 2023-05-19 17:39:51 +07:00
parent 3ac2f3f9c1
commit 42f33547a4

View File

@ -35,6 +35,12 @@ case "$(printf "%s\n" "$1" | awk '{print tolower($0)}')" in
chafa "$CACHE.jpg" -f sixel -s "$(($2-2))x$(($3-2))" | sed 's/#/\n#/g'
exit 0
;;
*.cbz|*.cbr|*.cbt)
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
[ ! -f "$CACHE.jpg" ] && comicthumb "$1" "$CACHE.jpg" 768
chafa "$CACHE.jpg" -f sixel -s "$(($2-2))x$(($3-2))" | sed 's/#/\n#/g'
exit 0
;;
esac
case "$(file --dereference --brief --mime-type -- "$1")" in