X-Git-Url: https://git.draconx.ca/gitweb/mpdhacks.git/blobdiff_plain/f955e376aa421d6e1c169addf66e120d29415faa:/thumbnail.sh..fa6f5f1c2997f0b6e69c435285d19b5b2ec173ff:/thumbnail.zsh diff --git a/thumbnail.sh b/thumbnail.zsh similarity index 78% rename from thumbnail.sh rename to thumbnail.zsh index b04f2e6..245cba2 100755 --- a/thumbnail.sh +++ b/thumbnail.zsh @@ -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 ] [--image] [--music] path" 1>&2 + echo "usage: thumbnail.zsh [--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" + 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"