-#!/bin/sh
+#!/bin/zsh
-music=/home/music
+music=/stuff/music
thumbs="$HOME/.fvwm/.thumbs"
if [ ! -d "$thumbs" ]; then
fi
if [ -z "$1" ]; then
- echo "usage: thumbnail.sh [--small|--size <spec>] [--image] [--music] path" 1>&2
+ echo "usage: thumbnail.zsh [--small|--size <spec>] [--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"
+ imgpath="$music/`dirname "${1#$music}"`/cover.jpg"
+ [ ! -f "$imgpath" ] && imgpath="${imgpath%jpg}png"
else
- path="$1"
+ imgpath="$1"
fi
-[ ! -f "$path" ] && exit 0
+[ ! -f "$imgpath" ] && exit 0
-image="`readlink -f -- "$path"`"
+image="$(readlink -f -- "$imgpath")"
[ ! -f "$image" ] && exit 0
thumb="$thumbs/`echo -n $image | md5sum - | cut -d ' ' -f 1`_$size.png"