diff --git a/roles/scripts/templates/preview.j2 b/roles/scripts/templates/preview.j2 index d3b00a4..b7b4883 100644 --- a/roles/scripts/templates/preview.j2 +++ b/roles/scripts/templates/preview.j2 @@ -7,6 +7,9 @@ _cache_thumbnail() { tmpfile="${thumbnail_dir}/$(stat -c '%n%i%F%s%Y' -- "$(readlink -f "$2")" | sha256sum | awk '{print $1}').jpg" if [ ! -f "$tmpfile" ]; then case "$1" in + image) + convert -- "$2"'[0]' "$tmpfile" + ;; video) ffmpegthumbnailer -i "$2" -o "$tmpfile" -s 0 ;; @@ -41,15 +44,15 @@ _preview_markdown() { } _preview_image() { - chafa --animate=off --polite=on --size="$2"x"$3" "$1" || exiftool "$1" + chafa --animate=off --polite=on --size="$2"x"$3" "$1" || chafa --animate=off --polite=on --size="$2"x"$3" "$(_cache_thumbnail image "$1")" } _preview_video() { - _preview_image "$(_cache_thumbnail video "$1")" "$2" "$3" || fprobe -hide_banner -pretty "$1" || exiftool "$1" + _preview_image "$(_cache_thumbnail video "$1")" "$2" "$3" } _preview_font() { - _preview_image "$(_cache_thumbnail font "$1")" "$2" "$3" || exiftool "$1" + _preview_image "$(_cache_thumbnail font "$1")" "$2" "$3" } # Take 2 additional arguments as width and height (rows/cols)