summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xranger/data/scope.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index ed4f01e1..3a6504dd 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 # ranger supports enhanced previews.  If the option "use_preview_script"
-# is set to True (by default it's False), this script will be called
-# and its output is displayed in ranger.  ANSI color codes are supported.
+# is set to True and this file exists, this script will be called and its
+# output is displayed in ranger.  ANSI color codes are supported.
 
 # NOTES: This script is considered a configuration file.  If you upgrade
 # ranger, it will be left untouched. (You must update it yourself.)
@@ -67,9 +67,13 @@ case "$mimetype" in
 		img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;;
 	# Display information about media files:
 	video/* | audio/*)
+		have exiftool && exiftool "$path" && exit 5
 		# Use sed to remove spaces so the output fits into the narrow window
-		mediainfo "$path" | sed 's/  \+:/: /;'
-		success && exit 5 || exit 1;;
+		if have mediainfo; then
+			mediainfo "$path" | sed 's/  \+:/: /;'
+			success && exit 5
+		fi
+		exit 1;;
 esac
 
 exit 1
7 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226