From 840f1e3bdd34b0b4b8d1d199ef6e97b6f1a1951d Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Fri, 18 Sep 2020 00:13:07 +0300 Subject: Use solely mimeo to handle default files/links --- dotfiles/.config/ranger/scope.sh | 71 ---------------------------------------- 1 file changed, 71 deletions(-) (limited to 'dotfiles/.config/ranger') diff --git a/dotfiles/.config/ranger/scope.sh b/dotfiles/.config/ranger/scope.sh index 940c9ba..dcb0752 100755 --- a/dotfiles/.config/ranger/scope.sh +++ b/dotfiles/.config/ranger/scope.sh @@ -89,77 +89,6 @@ handle_extension() { handle_image() { local mimetype="${1}" case "${mimetype}" in - # SVG - image/svg+xml) - convert "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6 - exit 1;; - - # Image - image/*) - local orientation - orientation="$( identify -format '%[EXIF:Orientation]\n' -- "${FILE_PATH}" )" - # If orientation data is present and the image actually - # needs rotating ("1" means no rotation)... - if [[ -n "$orientation" && "$orientation" != 1 ]]; then - # ...auto-rotate the image according to the EXIF data. - convert -- "${FILE_PATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6 - fi - - # `w3mimgdisplay` will be called for all images (unless overriden as above), - # but might fail for unsupported types. - exit 7;; - - # Video - # video/*) - # # 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;; - - # Preview archives using the first image inside. - # (Very useful for comic book collections for example.) - # application/zip|application/x-rar|application/x-7z-compressed|\ - # application/x-xz|application/x-bzip2|application/x-gzip|application/x-tar) - # local fn=""; local fe="" - # local zip=""; local rar=""; local tar=""; local bsd="" - # case "${mimetype}" in - # application/zip) zip=1 ;; - # application/x-rar) rar=1 ;; - # application/x-7z-compressed) ;; - # *) tar=1 ;; - # esac - # { [ "$tar" ] && fn=$(tar --list --file "${FILE_PATH}"); } || \ - # { fn=$(bsdtar --list --file "${FILE_PATH}") && bsd=1 && tar=""; } || \ - # { [ "$rar" ] && fn=$(unrar lb -p- -- "${FILE_PATH}"); } || \ - # { [ "$zip" ] && fn=$(zipinfo -1 -- "${FILE_PATH}"); } || return - # - # fn=$(echo "$fn" | python -c "import sys; import mimetypes as m; \ - # [ print(l, end='') for l in sys.stdin if \ - # (m.guess_type(l[:-1])[0] or '').startswith('image/') ]" |\ - # sort -V | head -n 1) - # [ "$fn" = "" ] && return - # [ "$bsd" ] && fn=$(printf '%b' "$fn") - # - # [ "$tar" ] && tar --extract --to-stdout \ - # --file "${FILE_PATH}" -- "$fn" > "${IMAGE_CACHE_PATH}" && exit 6 - # fe=$(echo -n "$fn" | sed 's/[][*?\]/\\\0/g') - # [ "$bsd" ] && bsdtar --extract --to-stdout \ - # --file "${FILE_PATH}" -- "$fe" > "${IMAGE_CACHE_PATH}" && exit 6 - # [ "$bsd" ] || [ "$tar" ] && rm -- "${IMAGE_CACHE_PATH}" - # [ "$rar" ] && unrar p -p- -inul -- "${FILE_PATH}" "$fn" > \ - # "${IMAGE_CACHE_PATH}" && exit 6 - # [ "$zip" ] && unzip -pP "" -- "${FILE_PATH}" "$fe" > \ - # "${IMAGE_CACHE_PATH}" && exit 6 - # [ "$rar" ] || [ "$zip" ] && rm -- "${IMAGE_CACHE_PATH}" - # ;; esac } -- cgit v1.2.3