[file_previewer.sh]: Revert to using chafa for image previews

The most recent chafa update has fixed broken previews
This commit is contained in:
2024-08-26 00:46:59 +01:00
parent eccb7686e8
commit 8fed0779b6

View File

@ -17,7 +17,7 @@ case "$(mimetype --brief -- "$file")" in
jq --color-output . "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;; jq --color-output . "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;;
application/pdf) application/pdf)
pdftoppm -jpeg "$file" -singlefile | termimage --size "$(($width-4))"x"$height" pdftoppm -jpeg "$file" -singlefile | chafa --size "$(($width-4))"x"$height"
pdfinfo "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;; pdfinfo "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;;
application/vnd.sqlite3) application/vnd.sqlite3)
@ -30,12 +30,11 @@ case "$(mimetype --brief -- "$file")" in
unzip -lv "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;; unzip -lv "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;;
audio/*) audio/*)
exiftool -Picture -b "$file" | termimage --size "$(($width-4))"x"$height" || termimage cover.* --size "$(($width-4))"x"$height" exiftool -Picture -b "$file" | chafa --size "$(($width-4))"x"$height" || chafa cover.* --size "$(($width-4))"x"$height"
exiftool "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;; exiftool "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;;
image/*) image/*)
termimage "$file" --size "$(($width-4))"x"$height" chafa "$file" --size "$(($width-4))"x"$height" --animate off
# chafa "$file" --size="$(($width-4))"x"$height" --animate off
exiftool "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;; exiftool "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;;
text/csv) text/csv)
@ -43,7 +42,7 @@ case "$(mimetype --brief -- "$file")" in
video/*) video/*)
ffmpeg -ss 00:00:00 -i "$file" -frames:v 1 -q:v 2 "$preview_image" ffmpeg -ss 00:00:00 -i "$file" -frames:v 1 -q:v 2 "$preview_image"
termimage "$preview_image" --size "$(($width-4))"x"$height" chafa "$preview_image" --size "$(($width-4))"x"$height"
rm "$preview_image" # removing preview file so that lf looks for a new preview image instead of going for an old one rm "$preview_image" # removing preview file so that lf looks for a new preview image instead of going for an old one
exiftool "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;; exiftool "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;;