summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mpdlib.rb21
1 files changed, 16 insertions, 5 deletions
diff --git a/mpdlib.rb b/mpdlib.rb
index 70eb016..12d2d3d 100644
--- a/mpdlib.rb
+++ b/mpdlib.rb
@@ -102,13 +102,24 @@ class MPD
return send_request 'clear'
end
- # Not yet complete.
- def playlistinfo
- playlist = send_request 'playlistinfo'
- playlist = playlist.split(/(?!\n)(?=file:)/).map do |song|
+ def split_and_hash str
+ songs = str.split(/(?!\n)(?=file:)/).map do |song|
generate_hash song
end
- return playlist
+ return songs
+ end
+
+ # Not yet complete.
+ def playlistinfo
+ return split_and_hash send_request 'playlistinfo'
+ end
+
+ def find type, what
+ return split_and_hash send_request 'find %s "%s"' % [type, what]
+ end
+
+ def search type, what
+ return split_and_hash send_request 'search %s "%s"' % [type, what]
end
end