summaryrefslogtreecommitdiff
path: root/scope.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scope.sh')
-rwxr-xr-xscope.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/scope.sh b/scope.sh
index c4cf37d..38578db 100755
--- a/scope.sh
+++ b/scope.sh
@@ -32,6 +32,7 @@ maxln=200 # Stop after $maxln lines. Can be used like ls | head -n $maxln
mimetype=$(file --mime-type -Lb "$path")
extension=$(/bin/echo "${path##*.}" | awk '{print tolower($0)}')
+
# 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
@@ -55,8 +56,14 @@ if [ "$preview_images" = "True" ]; then
# Image previews for image files. w3mimgdisplay will be called for all
# image files (unless overriden as above), but might fail for
# unsupported types.
+
+ application/epub+zip|application/x-mobipocket-ebook|\
+ application/x-fictionbook+xml)
+ gnome-epub-thumbnailer "$path" /tmp/thbn -s 600 && mv /tmp/thbn "$cached" && exit 6 || exit 1;;
application/pdf)
- pdftoppm -f 1 -singlefile -jpeg "$path" .thbn && mv .thbn.jpg "$cached" && exit 6 || exit 1;;
+ pdftoppm -f 1 -singlefile -jpeg "$path" /tmp/.thbn && mv /tmp/.thbn.jpg "$cached" && exit 6 || exit 1;;
+ image/avif)
+ convert "$path" "$cached" && exit 6 ||exit 1;;
image/svg+xml)
rsvg-convert "$path" -d 1 -p 2 > "$cached" && exit 6 ||exit 1;;
image/*)
@@ -85,6 +92,8 @@ case "$extension" in
pdf)
try pdftotext -l 10 -nopgbrk -q "$path" - && \
{ dump | trim | fmt -s -w $width; exit 0; } || exit 1;;
+ avif)
+ try convert "$path" "$cached" && exit 6 || exit 1;;
# BitTorrent Files
torrent)
try transmission-show "$path" && { dump | trim; exit 5; } || exit 1;;