about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorjakanakae-envangel <jakanakaevangeli@chiru.no>2018-08-23 20:59:02 +0200
committerjakanakae-envangel <jakanakaevangeli@chiru.no>2018-08-23 20:59:02 +0200
commit2abdc70358dc7eefab81c436d5b09946964a148e (patch)
treeeae78006b60c26a7874f10a3f963e5d272aaeb45
parentb3ac23bc6aba2bbcc82eeeb032928bd97bc87db5 (diff)
downloadranger-2abdc70358dc7eefab81c436d5b09946964a148e.tar.gz
scope.sh: Use python's mimetypes for finding imgs
-rwxr-xr-xranger/data/scope.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index 27a527ca..d66f33a1 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -148,7 +148,10 @@ handle_image() {
         #         [ $? != 0 ] && return
         #     fi
         #
-        #     fn=$(echo -n "$fn" | grep '\.\(png\|jpe\?g\|gif\)$' | sort -V | head -n 1)
+        #     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")
         #