X-Git-Url: https://git.draconx.ca/gitweb/fvwmconf.git/blobdiff_plain/61a4f45722337bcd4ff40305963a9401b777f10d:/scripts/thumbnail.sh..f32812c246d791696b007798cb9e63fa3c695e9b:/scripts/static/gitweb/gitweb.css diff --git a/scripts/thumbnail.sh b/scripts/thumbnail.sh deleted file mode 100755 index b04f2e6..0000000 --- a/scripts/thumbnail.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh - -music=/home/music -thumbs="$HOME/.fvwm/.thumbs" - -if [ ! -d "$thumbs" ]; then - mkdir "$thumbs" || exit 1 -fi - -size="x128" -printimg="" -ismusic="" - -while [ "${1#--}" != "$1" -a "$1" != "-" ]; do - if [ "$1" = "--small" ]; then - size="56" - elif [ "$1" = "--size" ]; then - size="$2" - shift - elif [ "$1" = "--music" ]; then - ismusic="yes" - elif [ "$1" = "--image" ]; then - printimg="yes" - else - echo "unrecognised option: $1" 1>&2 - exit 1 - fi - shift -done -[ "$1" = "-" ] && shift - -if ! expr match "$size" '^\([0-9]*\(x[0-9]\+\)\?\)$' >/dev/null 2>&1; then - echo "invalid size specification: $size" 1>&2 - exit 1 -fi - -if [ -z "$1" ]; then - echo "usage: thumbnail.sh [--small|--size ] [--image] [--music] path" 1>&2 - exit 1 -fi - -if [ -n "$ismusic" ]; then - path="$music/`dirname "${1#$music}"`/cover.jpg" - [ ! -f "$path" ] && path="${path%jpg}png" -else - path="$1" -fi - -[ ! -f "$path" ] && exit 0 - -image="`readlink -f -- "$path"`" -[ ! -f "$image" ] && exit 0 - -thumb="$thumbs/`echo -n $image | md5sum - | cut -d ' ' -f 1`_$size.png" -if [ -f "$thumb" ]; then - mtime_s="`stat -c %Y -- "$image"`" - mtime_t="`stat -c %Y -- "$thumb"`" - if [ "$mtime_s" -gt "$mtime_t" ]; then - convert -scale "$size" "$image" "$thumb" - fi -else - convert -scale "$size" "$image" "$thumb" -fi - -echo "$thumb" -[ -n "$printimg" ] && echo "$image" -exit 0