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);
$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 = <THUMB>;
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;
$menu //= "MenuMPDRecordings";
my @tracks = sort { $a->{Title} cmp $b->{Title} }
grep { $_->{Album} eq $albumname } @recs;
+
+ # Show thumbnails for standalone recordings
+ my @thumbs = get_item_thumbnails({ small => 1 },
+ map { $_->{file} } @tracks);
+ foreach my $entry (@tracks) {
+ $entry->{thumb} = shift @thumbs;
+ }
+
my @notqueued = update_entry_ids(@tracks);
fvwm_cmd("AddToMenu", $menu);