X-Git-Url: http://git.draconx.ca/gitweb/mpdhacks.git/blobdiff_plain/9b02bdda42565b687ecefe63b106118088f1c505..66698921f766b569c784a58d12ca912b32fd94ed:/mpdmenu.pl diff --git a/mpdmenu.pl b/mpdmenu.pl index 15a49b2..e536470 100755 --- a/mpdmenu.pl +++ b/mpdmenu.pl @@ -35,7 +35,7 @@ use constant { my $SELF = "$FindBin::Bin/$FindBin::Script"; my $MUSIC = $ENV{MUSIC} // "/srv/music"; -my $sock; +my ($sock, $mpd_have_binarylimit); my ($albumid, $albumname, $trackid, $recordingid); my ($topmenu, $menu); @@ -134,6 +134,13 @@ sub get_item_thumbnails { $c = "%"; } + if ($mpd_have_binarylimit) { + # --embedded implies and requires binarylimit support + push @opts, "--embedded"; + } else { + push @opts, "--no-binarylimit"; + } + open THUMB, "-|", "$FindBin::Bin/mpdthumb.sh", @opts, "--", @_; foreach (@_) { my $thumb = ; @@ -613,6 +620,12 @@ $sock = MPD::connect(); die("MPD version $MPD::major.$MPD::minor.$MPD::revision insufficient.") unless MPD::min_version(MPD_MJR_MIN, MPD_MNR_MIN, MPD_REV_MIN); +MPD::exec("binarylimit", 64); +while (<$sock>) { + $mpd_have_binarylimit = 1 if /^OK/; + last if /^OK/ or /^ACK/; +} + if ($mode eq "top") { my %current; my %state;