]> git.draconx.ca Git - mpdhacks.git/blobdiff - thumbnail.zsh
thumbnail.sh should be thumbnail.zsh.
[mpdhacks.git] / thumbnail.zsh
similarity index 78%
rename from thumbnail.sh
rename to thumbnail.zsh
index b04f2e63d55ce77a677a59eb724354f47ef5de69..245cba2d2069bf1b342d0d4f7c9ba190ec46ad65 100755 (executable)
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/zsh
 
-music=/home/music
+music=/stuff/music
 thumbs="$HOME/.fvwm/.thumbs"
 
 if [ ! -d "$thumbs" ]; then
@@ -35,20 +35,20 @@ if ! expr match "$size" '^\([0-9]*\(x[0-9]\+\)\?\)$' >/dev/null 2>&1; 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"