]> git.draconx.ca Git - mpdhacks.git/blobdiff - mpdmenu.pl
mpdmenu: Retrieve cover art from MPD.
[mpdhacks.git] / mpdmenu.pl
index 9a7c77efe9f4f185dede74aab9cb4e202b3cfb7d..2311a539cf546f8e301277618142551cf1fe7810 100755 (executable)
@@ -18,7 +18,7 @@ use FindBin;
 
 use constant {
        MPD_MJR_MIN => 0,
-       MPD_MNR_MIN => 13,
+       MPD_MNR_MIN => 21,
        MPD_REV_MIN => 0,
 };
 
@@ -33,11 +33,10 @@ my $MUSIC = $ENV{MUSIC} // "/srv/music";
 # get_item_thumbnails({ options }, file, ...)
 # get_item_thumbnails(file, ...)
 #
-# For each music file listed, obtain a thumbnail (if any) for the
-# cover art.
+# For each music file listed, obtain a thumbnail (if any) for the cover art.
 #
-# The first argument is a hash reference to control the mode of
-# operation; it may be omitted for default options.
+# The first argument is a hash reference to control the mode of operation;
+# it may be omitted for default options.
 #
 #   get_item_thumbnails({ small => 1 }, ...) - smaller thumbnails
 #
@@ -60,17 +59,16 @@ sub get_item_thumbnails {
                $c = "%";
        }
 
+       open THUMB, "-|", "$FindBin::Bin/mpdthumb.sh", @opts, "--", @_;
        foreach (@_) {
-               open THUMB, "-|", "$FindBin::Bin/thumbnail.zsh", "--music",
-                                 @opts, $_;
                my $thumb = <THUMB>;
                chomp $thumb;
 
                $thumb = "$c$thumb$c" if (-f $thumb);
                push @results, $thumb;
-               close THUMB;
-               die("thumbnail.zsh failed") if ($?);
        }
+       close THUMB;
+       die("mpdthumb failed") if ($?);
 
        return @results;
 }