r10629 - in /trunk/libaudio-mpd-perl: debian/changelog lib/Audio/MPD.pm lib/Audio/MPD/Collection.pm

joeyh at users.alioth.debian.org joeyh at users.alioth.debian.org
Sat Dec 1 20:36:42 UTC 2007


Author: joeyh
Date: Sat Dec  1 20:36:42 2007
New Revision: 10629

URL: http://svn.debian.org/wsvn/?sc=1&rev=10629
Log:
* Modify all_playlists to returns strings, not objects, for consistency
  with the other _all methods, and for speed.
* Tighten up regexp in _cooked_command_as_kv, to not eat significant
  whitespace.

Modified:
    trunk/libaudio-mpd-perl/debian/changelog
    trunk/libaudio-mpd-perl/lib/Audio/MPD.pm
    trunk/libaudio-mpd-perl/lib/Audio/MPD/Collection.pm

Modified: trunk/libaudio-mpd-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libaudio-mpd-perl/debian/changelog?rev=10629&op=diff
==============================================================================
--- trunk/libaudio-mpd-perl/debian/changelog (original)
+++ trunk/libaudio-mpd-perl/debian/changelog Sat Dec  1 20:36:42 2007
@@ -1,3 +1,12 @@
+libaudio-mpd-perl (0.19.0-3) UNRELEASED; urgency=low
+
+  * Modify all_playlists to returns strings, not objects, for consistency
+    with the other _all methods, and for speed.
+  * Tighten up regexp in _cooked_command_as_kv, to not eat significant
+    whitespace.
+
+ -- Joey Hess <joeyh at debian.org>  Sat, 01 Dec 2007 15:23:58 -0500
+
 libaudio-mpd-perl (0.19.0-2) unstable; urgency=low
 
   * Add an all_playlists method.

Modified: trunk/libaudio-mpd-perl/lib/Audio/MPD.pm
URL: http://svn.debian.org/wsvn/trunk/libaudio-mpd-perl/lib/Audio/MPD.pm?rev=10629&op=diff
==============================================================================
--- trunk/libaudio-mpd-perl/lib/Audio/MPD.pm (original)
+++ trunk/libaudio-mpd-perl/lib/Audio/MPD.pm Sat Dec  1 20:36:42 2007
@@ -205,7 +205,7 @@
 sub _cooked_command_as_kv {
     my ($self, $command) = @_;
     my %hash =
-        map { split(/:\s+/, $_, 2) }
+        map { split(/:\s/, $_, 2) }
         $self->_send_command($command);
     return %hash;
 }

Modified: trunk/libaudio-mpd-perl/lib/Audio/MPD/Collection.pm
URL: http://svn.debian.org/wsvn/trunk/libaudio-mpd-perl/lib/Audio/MPD/Collection.pm?rev=10629&op=diff
==============================================================================
--- trunk/libaudio-mpd-perl/lib/Audio/MPD/Collection.pm (original)
+++ trunk/libaudio-mpd-perl/lib/Audio/MPD/Collection.pm Sat Dec  1 20:36:42 2007
@@ -170,13 +170,20 @@
 #
 # my @items = $collection->all_playlists;
 #
-# Return the list of all Audio::MPD::Common::Item::Playlist
-# objects currently known by mpd.
+# Return the list playlists (strings) currently known by mpd.
 #
 sub all_playlists {
     my ($self) = @_;
 
-    return grep { $_->isa('Audio::MPD::Common::Item::Playlist') } $self->_mpd->_cooked_command_as_items( "lsinfo\n" );
+    my @ret;
+    my ($key, $value);
+    foreach my $line ($self->_mpd->_send_command( "lsinfo\n" )) {
+        ($key, $value)=split(/:\s/, $line, 2);
+	if ($key eq 'playlist') {
+	    push @ret, $value;
+	}
+    }
+    return @ret;
 }
 
 # -- Collection: picking songs
@@ -414,8 +421,7 @@
 
 =item $coll->all_playlists()
 
-Return the list of all Audio::MPD::Common::Item::Playlist
-objects currently known by mpd.
+Return the list of all playlists (strings) currently known by mpd.
 
 
 =back




More information about the Pkg-perl-cvs-commits mailing list