1
0
Fork 0

previewer fixes

This commit is contained in:
Luca Bilke 2024-01-08 11:38:20 +01:00
parent e3f460acc0
commit e925296450

View file

@ -51,7 +51,7 @@ run() {
fi
}
CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))"
CACHE="$HOME/.cache/lf/thumbnail-$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')"
case "$(xdg-mime query filetype "$1")" in
*/x-bzip-compressed-tar | */x-compressed-tar | */x-xz-compressed-tar) run als -- "$1" ;;
@ -63,17 +63,17 @@ case "$(xdg-mime query filetype "$1")" in
*/vnd.openxmlformats-officedocument.wordprocessingml.document) run docx2txt <"$1" ;;
*/vnd.ms-excel) run ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv ;;
*/vnd.openxmlformats-officedocument.spreadsheetml.sheet) run ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv ;;
*/epub+zip) [ ! -f "$CACHE" ] && run epub-thumbnailer "$1" "$CACHE" 1024 && image "$CACHE" "$2" "$3" "$4" "$5" ;;
*/epub+zip) [ ! -f "$CACHE" ] && run epub-thumbnailer "$1" "$CACHE" 1024; image "$CACHE" "$2" "$3" "$4" "$5" ;;
*/pgp-encrypted) run gpg -d -- "$1" ;;
*/pkix-cert) run openssl x509 -text -noout -in "$1" ;;
image/svg+xml) [ ! -f "$CACHE" ] && run inkscape --convert-dpi-method=none -o "$CACHE" --export-overwrite -D --export-png-color-mode=RGBA_16 "$1" && image $CACHE "$2" "$3" "$4" "$5" ;;
image/svg+xml) [ ! -f "$CACHE" ] && run inkscape --convert-dpi-method=none -o "$CACHE" --export-overwrite -D --export-png-color-mode=RGBA_16 "$1"; image $CACHE "$2" "$3" "$4" "$5" ;;
image/*) image "$1" "$2" "$3" "$4" "$5" ;;
video/*) video "$1" "$2" "$3" "$4" "$5" ;;
*opendocument*) run odt2txt "$1" ;;
*/markdown) run lowdown -Tterm "$1" ;;
*/html) run lynx -dump "$1" ;;
text/* | */json | */schema+json | */xml) batorcat "$1" "$2" ;;
*/pdf) [ ! -f "${CACHE}.jpg" ] && run pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" && image "${CACHE}.jpg" "$2" "$3" "$4" "$5" ;;
*/pdf) [ ! -f "${CACHE}.jpg" ] && run pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"; image "${CACHE}.jpg" "$2" "$3" "$4" "$5" ;;
esac
case "$(file -bL --mime-type "$1")" in