From 143a9b792173c07e23932b9723ba18771e1a748d Mon Sep 17 00:00:00 2001 From: lanxu Date: Sun, 17 Dec 2017 15:29:33 +0200 Subject: [PATCH] Fixed ranger scope for comicbooks (apparently broken in update) --- .config/ranger/scope.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.config/ranger/scope.sh b/.config/ranger/scope.sh index 86cf5ae..55a01d8 100755 --- a/.config/ranger/scope.sh +++ b/.config/ranger/scope.sh @@ -87,6 +87,14 @@ handle_extension() { handle_image() { local mimetype="${1}" + + case "${FILE_EXTENSION_LOWER}" in + # Comic book previews + cbz|cbr|epub) + comicthumb "${FILE_PATH}" "${IMAGE_CACHE_PATH}" 512 > /dev/null 2>&1 && exit 6 + exit 1;; + esac + case "${mimetype}" in # SVG image/svg+xml) @@ -109,13 +117,6 @@ handle_image() { application/pdf) pdftoppm -jpeg -singlefile "$path" "${cached//.jpg}" && exit 6;; esac - - case "${FILE_EXTENSION_LOWER}" in - # Comic book previews - cbz|cbr|epub) - comicthumb "$path" "$cached" 512 > /dev/null 2>&1 && exit 6 || exit 1;; - esac - } handle_mime() { @@ -161,7 +162,8 @@ handle_fallback() { handle_extension -MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )" +#MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )" +MIMETYPE="$(xdg-mime query filetype "${FILE_PATH}" )" if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then handle_image "${MIMETYPE}" fi