]> git.draconx.ca Git - mpdhacks.git/commitdiff
thumbnail.sh should be thumbnail.zsh.
authorNick Bowler <nbowler@draconx.ca>
Wed, 28 May 2008 19:17:51 +0000 (15:17 -0400)
committerNick Bowler <nbowler@draconx.ca>
Sat, 29 Jun 2019 16:05:58 +0000 (12:05 -0400)
mpdmenu.pl
thumbnail.zsh [moved from thumbnail.sh with 78% similarity]

index 7a48c20d0c4a0104645004392e27d28313afa12a..94ec8d5088ab1fdc9475b4595dbe4bfc7f34a6cf 100755 (executable)
@@ -138,11 +138,11 @@ if (defined $album) {
                my $key      = $_;
                my $a_album  = sanitise($key);
 
-               open THUMB, "-|", "$FVWM/scripts/thumbnail.sh",
+               open THUMB, "-|", "$FVWM/scripts/thumbnail.zsh",
                                         "--small", "--music", $albums{$key};
                my $thumb = <THUMB>;
                close THUMB;
-               die("Incompetent use of thumbnail.sh") if ($?);
+               die("Incompetent use of thumbnail.zsh") if ($?);
 
                $thumb =~ s/\n//sg;
                $thumb = "%$thumb%" if (-f $thumb);
@@ -234,11 +234,11 @@ if (defined $album) {
                $t_artist = sanitise($t_artist);
                $t_title  = sanitise($t_title);
 
-               open THUMB, "-|", "$FVWM/scripts/thumbnail.sh",
+               open THUMB, "-|", "$FVWM/scripts/thumbnail.zsh",
                                         "--small", "--music", $t_file;
                my $thumb = <THUMB>;
                close(THUMB);
-               die("Incompetent use of thumbnail.sh") if ($?);
+               die("Incompetent use of thumbnail.zsh") if ($?);
 
                $thumb =~ s/\n//sg;
                $thumb = "%$thumb%" if (-f $thumb);
@@ -276,12 +276,12 @@ if (defined $album) {
        }
        die("Failed data query\n") unless (keys(%entry) > 0);
 
-       open THUMB, "-|", "$FVWM/scripts/thumbnail.sh",
+       open THUMB, "-|", "$FVWM/scripts/thumbnail.zsh",
                                 "--image", "--music",  $entry{file};
        my $thumb = <THUMB>;
        my $scan  = <THUMB>;
        close(THUMB);
-       die("Incompetent use of thumbnail.sh") if ($?);
+       die("Incompetent use of thumbnail.zsh") if ($?);
 
        $thumb =~ s/\n//sg;
        $scan  =~ s/\n//sg;
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"