aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-03-02 20:51:24 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-03-02 20:51:24 -0300
commit66d05cf16d5835ffce66323705356b1fb7e36aff (patch)
tree74f7acfb0af3611d5c0d6465cce71ae26f4b44bb
parent842b92de6de0719354f3eefc1557d1edd9be7575 (diff)
downloadranger-66d05cf16d5835ffce66323705356b1fb7e36aff.tar.gz
ranger-66d05cf16d5835ffce66323705356b1fb7e36aff.tar.bz2
Customized scope.sh with video preview, firejail workaround and debug recipe
-rwxr-xr-xconfig.dot/ranger/scope.sh.link19
1 files changed, 16 insertions, 3 deletions
diff --git a/config.dot/ranger/scope.sh.link b/config.dot/ranger/scope.sh.link
index 57aaa1d..989de8e 100755
--- a/config.dot/ranger/scope.sh.link
+++ b/config.dot/ranger/scope.sh.link
@@ -27,9 +27,16 @@ cached="$4" # Path that should be used to cache image previews
maxln=200 # Stop after $maxln lines. Can be used like ls | head -n $maxln
# Find out something about the file:
-mimetype=$(file --mime-type -Lb "$path")
+#mimetype=$(file --mime-type -Lb "$path")
extension=$(/bin/echo -E "${path##*.}" | tr "[:upper:]" "[:lower:]")
+# Workaround for firejail
+#mimetype=$(/usr/bin/file --mime-type -Lb "$path")
+#mimetype=$(file --mime-type -Lb "$path" | grep -v "^Redirecting symlink to")
+#mimetype=$(file --mime-type -Lb "$path" | sed -e 's/^.* //')
+#mimetype=$(file --mime-type -Lb "$path" | xargs)
+mimetype=$(firejail --quiet /usr/bin/file --mime-type -Lb "$path")
+
# Functions:
# runs a command and saves its output into $output. Useful if you need
# the return value AND want to use the output in a pipe
@@ -38,6 +45,12 @@ try() { output=$(eval '"$@"'); }
# writes the output of the previously used "try" command
dump() { /bin/echo -E "$output"; }
+# Use xmessage if you need to debug something
+#xmessage $*
+#xmessage $extension
+#xmessage $mimetype
+#exit
+
# a common post-processing function used after most commands
trim() { head -n "$maxln"; }
@@ -77,8 +90,8 @@ case "$mimetype" in
image/*)
img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;;
# Image preview for videos, disabled by default:
- #video/*)
- # ffmpegthumbnailer -i "$path" -o "$cached" -s 0 && exit 6 || exit 1;;
+ video/*)
+ ffmpegthumbnailer -i "$path" -o "$cached" -s 0 && exit 6 || exit 1;;
# Display information about media files:
video/* | audio/*)
exiftool "$path" && exit 5