fix file_previewer video previews

This commit is contained in:
2024-05-24 12:42:18 +01:00
parent 26d963d960
commit 401f1f6f49

View File

@ -1,7 +1,7 @@
#!/bin/sh
# File preview handler for lf using the Perl `mimetype` utility.
preview_image="/tmp/lf_preview_image.jpg"
preview_image="/tmp/lf_preview_image.png"
file=$1
width=$2
@ -34,9 +34,9 @@ case "$(mimetype --brief -- "$file")" in
exiftool "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;;
video/*)
ffmpeg -ss 00:00:00 -i "$file" -frames:v 1 "$preview_filepath"
chafa "$preview_filepath" --size="$(($width-4))"x"$height"
rm "$preview_filepath" # removing preview file so that lf looks for a new preview image instead of going for an old one
ffmpeg -ss 00:00:00 -i "$file" -frames:v 1 -q:v 2 "$preview_image"
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
exiftool "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;;
image/*)