summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2017-12-13 22:41:22 +0100
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2017-12-13 22:46:06 +0100
commitab8fd9e8256a1a6c296934af6ffb77bd34671bb2 (patch)
tree71f5fe841e045c27802b447581ffb519cb8a0794
parentface63d7e726ab2ed5b5acb0c80dcbd42371802f (diff)
downloadranger-ab8fd9e8256a1a6c296934af6ffb77bd34671bb2.tar.gz
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.
-rwxr-xr-xranger/data/scope.sh11
1 files changed, 10 insertions, 1 deletions
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