Advertisement
Guest User

FAST_THUMBS_GEN

a guest
Oct 27th, 2010
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.68 KB | None | 0 0
  1. #!/bin/bash
  2. umask 177
  3. ThumbMTime=$(stat -c "%Y" "$1")
  4. if ! [[ -f "$2" ]] || [[ $ThumbMTime -gt $(gm identify -verbose "$2" | awk '/Thumb::MTime/ {print $2}') ]]; then
  5.     ffmpegthumbnailer -t 50% -c png -i "$1" -o "$2" 2>/dev/null 1>/dev/null
  6.     if [[ $? -gt 0 ]]; then
  7.         rm "$2"
  8.         failedname="$HOME/.thumbnails/fail/$(basename "$2")"
  9.         gm convert -size 128x96 +profile "*" -set Thumb::URI "file://$1" \
  10.             -set Thumb::MTime $ThumbMTime xc:black "${failedname}"
  11. #       touch -c -m -r "$1" "${failedname}"
  12.     else
  13.         gm convert -set Thumb::URI "file://$1" -set Thumb::MTime $ThumbMTime "$2" "$2"
  14. #       touch -c -m -r "$1" "$2"
  15.     fi
  16. fi
  17. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement