Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- umask 177
- ThumbMTime=$(stat -c "%Y" "$1")
- if ! [[ -f "$2" ]] || [[ $ThumbMTime -gt $(gm identify -verbose "$2" | awk '/Thumb::MTime/ {print $2}') ]]; then
- ffmpegthumbnailer -t 50% -c png -i "$1" -o "$2" 2>/dev/null 1>/dev/null
- if [[ $? -gt 0 ]]; then
- rm "$2"
- failedname="$HOME/.thumbnails/fail/$(basename "$2")"
- gm convert -size 128x96 +profile "*" -set Thumb::URI "file://$1" \
- -set Thumb::MTime $ThumbMTime xc:black "${failedname}"
- # touch -c -m -r "$1" "${failedname}"
- else
- gm convert -set Thumb::URI "file://$1" -set Thumb::MTime $ThumbMTime "$2" "$2"
- # touch -c -m -r "$1" "$2"
- fi
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement