mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-01-30 09:48:11 +01:00
close #1423
This commit is contained in:
parent
475e4abb40
commit
6556ef5c4d
@ -19,11 +19,11 @@ image() {
|
|||||||
|
|
||||||
case "$(file --dereference --brief --mime-type -- "$1")" in
|
case "$(file --dereference --brief --mime-type -- "$1")" in
|
||||||
image/avif) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
|
image/avif) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
|
||||||
[ ! -f "$CACHE" ] && convert "$1" "$CACHE.jpg"
|
[ ! -f "$CACHE" ] && magick "$1" "$CACHE.jpg"
|
||||||
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;;
|
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;;
|
||||||
image/vnd.djvu)
|
image/vnd.djvu)
|
||||||
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
|
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
|
||||||
[ ! -f "$CACHE" ] && djvused "$1" -e 'select 1; save-page-with /dev/stdout' | convert -density 200 - "$CACHE.jpg" > /dev/null 2>&1
|
[ ! -f "$CACHE" ] && djvused "$1" -e 'select 1; save-page-with /dev/stdout' | magick -density 200 - "$CACHE.jpg" > /dev/null 2>&1
|
||||||
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;;
|
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;;
|
||||||
image/svg+xml)
|
image/svg+xml)
|
||||||
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
|
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
|
||||||
@ -32,7 +32,7 @@ image/svg+xml)
|
|||||||
;;
|
;;
|
||||||
image/x-xcf)
|
image/x-xcf)
|
||||||
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')"
|
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')"
|
||||||
[ ! -f "$CACHE.jpg" ] && convert "$1[0]" "$CACHE.jpg"
|
[ ! -f "$CACHE.jpg" ] && magick "$1[0]" "$CACHE.jpg"
|
||||||
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1"
|
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1"
|
||||||
;;
|
;;
|
||||||
image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;;
|
image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;;
|
||||||
|
|||||||
@ -14,11 +14,11 @@ do
|
|||||||
mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &
|
mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &
|
||||||
;;
|
;;
|
||||||
"r")
|
"r")
|
||||||
convert -rotate 90 "$file" "$file" ;;
|
magick -rotate 90 "$file" "$file" ;;
|
||||||
"R")
|
"R")
|
||||||
convert -rotate -90 "$file" "$file" ;;
|
magick -rotate -90 "$file" "$file" ;;
|
||||||
"f")
|
"f")
|
||||||
convert -flop "$file" "$file" ;;
|
magick -flop "$file" "$file" ;;
|
||||||
"y")
|
"y")
|
||||||
printf "%s" "$file" | tr -d '\n' | xclip -selection clipboard &&
|
printf "%s" "$file" | tr -d '\n' | xclip -selection clipboard &&
|
||||||
notify-send "$file copied to clipboard" & ;;
|
notify-send "$file copied to clipboard" & ;;
|
||||||
|
|||||||
@ -67,7 +67,6 @@ if [ -n "${audio+x}" ]; then
|
|||||||
*) echo "That doesn't look like an audio file."; exit 1 ;;
|
*) echo "That doesn't look like an audio file."; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
totseconds="$(date '+%s' -d $(ffmpeg -i "$audio" 2>&1 | awk '/Duration/ {print $2}' | sed s/,//))"
|
totseconds="$(date '+%s' -d $(ffmpeg -i "$audio" 2>&1 | awk '/Duration/ {print $2}' | sed s/,//))"
|
||||||
endtime="$((totseconds-seconds))"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
prepdir="${prepdir:-$cache/$file}"
|
prepdir="${prepdir:-$cache/$file}"
|
||||||
@ -95,10 +94,10 @@ do
|
|||||||
# If images have already been made in a previous run, do not recreate
|
# If images have already been made in a previous run, do not recreate
|
||||||
# them unless -r was given.
|
# them unless -r was given.
|
||||||
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} &&
|
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} &&
|
||||||
convert -size "${res:-1920x1080}" canvas:"${bgc:-black}" -gravity center "$content" -resize 1920x1080 -composite "$prepdir/$base"
|
magick -size "${res:-1920x1080}" canvas:"${bgc:-black}" -gravity center "$content" -resize 1920x1080 -composite "$prepdir/$base"
|
||||||
else
|
else
|
||||||
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} &&
|
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} &&
|
||||||
convert -size "${res:-1920x1080}" -background "${bgc:-black}" -fill "${fgc:-white}" -font "${font:-Sans}" -pointsize "${ppt:-150}" -gravity center label:"$content" "$prepdir/$base"
|
magick -size "${res:-1920x1080}" -background "${bgc:-black}" -fill "${fgc:-white}" -font "${font:-Sans}" -pointsize "${ppt:-150}" -gravity center label:"$content" "$prepdir/$base"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the first line, do not write yet.
|
# If the first line, do not write yet.
|
||||||
@ -111,6 +110,7 @@ duration $duration"
|
|||||||
prevseconds="$(date '+%s' -d "$prevtime")"
|
prevseconds="$(date '+%s' -d "$prevtime")"
|
||||||
done < "$file"
|
done < "$file"
|
||||||
# Do last file which must be given twice as follows
|
# Do last file which must be given twice as follows
|
||||||
|
endtime="$((totseconds-seconds))"
|
||||||
echo "file '$base'
|
echo "file '$base'
|
||||||
duration ${endtime:-5}
|
duration ${endtime:-5}
|
||||||
file '$base'"
|
file '$base'"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user