diff options
author | jakanakae-envangel <jakanakaevangeli@chiru.no> | 2018-08-23 20:59:02 +0200 |
---|---|---|
committer | jakanakae-envangel <jakanakaevangeli@chiru.no> | 2018-08-23 20:59:02 +0200 |
commit | 2abdc70358dc7eefab81c436d5b09946964a148e (patch) | |
tree | eae78006b60c26a7874f10a3f963e5d272aaeb45 | |
parent | b3ac23bc6aba2bbcc82eeeb032928bd97bc87db5 (diff) | |
download | ranger-2abdc70358dc7eefab81c436d5b09946964a148e.tar.gz |
scope.sh: Use python's mimetypes for finding imgs
-rwxr-xr-x | ranger/data/scope.sh | 5 |
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") # |