summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorjakanakae-envangel <jakanakaevangeli@chiru.no>2018-08-23 18:53:27 +0200
committerjakanakae-envangel <jakanakaevangeli@chiru.no>2018-08-23 19:12:43 +0200
commitb9eacb84a1fc013ec3903d230d12f846041f8108 (patch)
tree6ba609c71df574cde43ba657c9c2e614e6f9639b /ranger
parent8fd92581dfcd126ce432b8832209f8cdf4a73ecd (diff)
downloadranger-b9eacb84a1fc013ec3903d230d12f846041f8108.tar.gz
scope.sh: Comment archive previewing by default
Diffstat (limited to 'ranger')
-rwxr-xr-xranger/data/scope.sh90
1 files changed, 45 insertions, 45 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index ceb9e1ae..29f4d718 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -125,51 +125,51 @@ handle_image() {
         #         && exit 6 || exit 1;;
 
         # Archive
-        application/zip|application/x-rar|application/x-7z-compressed|\
-            application/x-xz|application/x-bzip2|application/x-gzip|application/x-tar)
-            local fn=""
-            local bsd=""
-            local zip=""; local rar=""; local z7=""; local tar=""
-            case "${MIMETYPE}" in
-                application/zip) zip=1 ;;
-                application/x-rar) rar=1 ;;
-                application/x-7z-compressed) z7=1 ;;
-                *) tar=1 ;;
-            esac
-            [ "$tar" ] && fn=$(tar --list --file "${FILE_PATH}")
-            [ $? != 0 ] && bsd=1 && fn=$(bsdtar --list --file "${FILE_PATH}")
-            [ $? != 0 ] && [ "$bsd" ] && bsd="" && [ "$tar" -o "$z7"] && return
-            if [ -z "$bsd" ] && [ -z "$tar" ]; then
-                if [ "$rar" ]; then
-                    fn=$(unrar lb -p- -- "${FILE_PATH}")
-                elif [ "$zip" ]; then
-                    fn=$(zipinfo -1 -- "${FILE_PATH}")
-                fi
-                [ $? != 0 ] && return
-            fi
-
-            fn=$(echo -n "$fn" | grep '\.\(png\|jpe\?g\|gif\)$' | sort -V | head -n 1)
-            [ "$fn" = "" ] && return
-            [ "$bsd" ] && fn=$(printf '%b' "$fn")
-
-            if [ "$tar" ] && [ -z "$bsd" ]; then
-                tar --extract --to-stdout --file "${FILE_PATH}" "$fn" > \
-                    "${IMAGE_CACHE_PATH}" && exit 6
-                rm -- "${IMAGE_CACHE_PATH}"
-                return
-            fi
-            # bsdtar and unzip need escaiping
-            fne=$(echo -n "$fn" | sed 's/[][*?\]/\\\0/g')
-            bsdtar --extract --to-stdout --file "${FILE_PATH}" "$fne" > \
-                "${IMAGE_CACHE_PATH}" && exit 6
-            rm -- "${IMAGE_CACHE_PATH}"
-            if [ "$rar" ]; then
-                unrar p -p- -inul -- "${FILE_PATH}" "$fn" > "${IMAGE_CACHE_PATH}" && exit 6
-            elif [ "$zip" ]; then
-                unzip -pP "" -- "${FILE_PATH}" "$fne" > "${IMAGE_CACHE_PATH}" && exit 6
-            fi
-            rm -- "${IMAGE_CACHE_PATH}"
-            ;;
+        # application/zip|application/x-rar|application/x-7z-compressed|\
+        #     application/x-xz|application/x-bzip2|application/x-gzip|application/x-tar)
+        #     local fn=""
+        #     local bsd=""
+        #     local zip=""; local rar=""; local z7=""; local tar=""
+        #     case "${MIMETYPE}" in
+        #         application/zip) zip=1 ;;
+        #         application/x-rar) rar=1 ;;
+        #         application/x-7z-compressed) z7=1 ;;
+        #         *) tar=1 ;;
+        #     esac
+        #     [ "$tar" ] && fn=$(tar --list --file "${FILE_PATH}")
+        #     [ $? != 0 ] && bsd=1 && fn=$(bsdtar --list --file "${FILE_PATH}")
+        #     [ $? != 0 ] && [ "$bsd" ] && bsd="" && [ "$tar" -o "$z7"] && return
+        #     if [ -z "$bsd" ] && [ -z "$tar" ]; then
+        #         if [ "$rar" ]; then
+        #             fn=$(unrar lb -p- -- "${FILE_PATH}")
+        #         elif [ "$zip" ]; then
+        #             fn=$(zipinfo -1 -- "${FILE_PATH}")
+        #         fi
+        #         [ $? != 0 ] && return
+        #     fi
+        #
+        #     fn=$(echo -n "$fn" | grep '\.\(png\|jpe\?g\|gif\)$' | sort -V | head -n 1)
+        #     [ "$fn" = "" ] && return
+        #     [ "$bsd" ] && fn=$(printf '%b' "$fn")
+        #
+        #     if [ "$tar" ] && [ -z "$bsd" ]; then
+        #         tar --extract --to-stdout --file "${FILE_PATH}" "$fn" > \
+        #             "${IMAGE_CACHE_PATH}" && exit 6
+        #         rm -- "${IMAGE_CACHE_PATH}"
+        #         return
+        #     fi
+        #     # bsdtar and unzip need escaiping
+        #     fne=$(echo -n "$fn" | sed 's/[][*?\]/\\\0/g')
+        #     bsdtar --extract --to-stdout --file "${FILE_PATH}" "$fne" > \
+        #         "${IMAGE_CACHE_PATH}" && exit 6
+        #     rm -- "${IMAGE_CACHE_PATH}"
+        #     if [ "$rar" ]; then
+        #         unrar p -p- -inul -- "${FILE_PATH}" "$fn" > "${IMAGE_CACHE_PATH}" && exit 6
+        #     elif [ "$zip" ]; then
+        #         unzip -pP "" -- "${FILE_PATH}" "$fne" > "${IMAGE_CACHE_PATH}" && exit 6
+        #     fi
+        #     rm -- "${IMAGE_CACHE_PATH}"
+        #     ;;
     esac
 }