From ab8fd9e8256a1a6c296934af6ffb77bd34671bb2 Mon Sep 17 00:00:00 2001 From: Wojciech Siewierski Date: Wed, 13 Dec 2017 22:41:22 +0100 Subject: scope.sh: Add the image-based PDF previews (disabled by default) By default they are rendered for the FullHD resolution as it should be both legible on any resolution and generate not too large files. The order of handing the previews was changed to handle the image-based previews first as they are easy to toggle anyway and it makes sense for them to override any other preview type if enabled and available. --- ranger/data/scope.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh index 3bf5785a..560e27da 100755 --- a/ranger/data/scope.sh +++ b/ranger/data/scope.sh @@ -113,6 +113,15 @@ handle_image() { # # Thumbnail # ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6 # exit 1;; + # PDF + # application/pdf) + # pdftoppm -f 1 -l 1 \ + # -scale-to-x 1920 \ + # -scale-to-y -1 \ + # -singlefile \ + # -jpeg -tiffcompression jpeg \ + # -- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \ + # && exit 6 || exit 1;; esac } @@ -158,11 +167,11 @@ handle_fallback() { } -handle_extension MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )" if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then handle_image "${MIMETYPE}" fi +handle_extension handle_mime "${MIMETYPE}" handle_fallback -- cgit 1.4.1-2-gfad0