From 2abdc70358dc7eefab81c436d5b09946964a148e Mon Sep 17 00:00:00 2001 From: jakanakae-envangel Date: Thu, 23 Aug 2018 20:59:02 +0200 Subject: scope.sh: Use python's mimetypes for finding imgs --- ranger/data/scope.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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") # -- cgit 1.4.1-2-gfad0