From 4c252b3b52ae9e3a2e72872fbad8158bec086963 Mon Sep 17 00:00:00 2001 From: jq Date: Thu, 5 Apr 2007 15:38:21 +0000 Subject: [PATCH] [project @ 5837] mpd-dynamic now uses the am::playlist extension --- bin/mpd-dynamic | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/mpd-dynamic b/bin/mpd-dynamic index 6a74590..2712021 100755 --- a/bin/mpd-dynamic +++ b/bin/mpd-dynamic @@ -54,13 +54,13 @@ while (1) { # endless loop # keep at most $ARGV{old} songs. if ( $song > $ARGV{old} ) { my $old = $song - $ARGV{old}; - eval { $mpd->delete(0) for 1..$old }; + eval { $mpd->playlist->delete(0) for 1..$old }; } # add at most $ARGV{new} songs. - my $pl = $mpd->playlist; - if ( $#$pl - $song < $ARGV{new} ) { - my $new = $ARGV{new} - ( $#$pl - $song ); + my @pl = $mpd->playlist->as_items; + if ( $#pl - $song < $ARGV{new} ) { + my $new = $ARGV{new} - ( $#pl - $song ); debug("need to add $new songs\n"); my %ratings; @@ -78,7 +78,7 @@ while (1) { # endless loop redo PICK_ONE; } debug("will add [$random]\n"); - eval { $mpd->add( $random ) }; + eval { $mpd->playlist->add( $random ) }; debug("error: $@\n") if $@; } untie %ratings if $istied; -- 2.11.4.GIT