From 5ebda82d1b57733e0960eac5eb74d078b64e7cc5 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Fri, 24 Jul 2009 11:43:51 -0700 Subject: Add count method. --- libmpd/database.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libmpd/database.rb') diff --git a/libmpd/database.rb b/libmpd/database.rb index 3f5616e..20099c8 100644 --- a/libmpd/database.rb +++ b/libmpd/database.rb @@ -5,8 +5,13 @@ # See http://www.gnu.org/licenses/gpl.txt for the full license text. module MPDDatabase + # Counts the number of songs in the database where _field_ is _value_, as + # well as their total playtime. + def count field, value + return generate_hash send_request 'count %s "%s"' % [field, value] + end + # Finds all songs in the database where _field_ is _value_. - # Matching is case-sensitive. # # Possible field names: album, artist, title. def find field, value -- cgit v1.2.3-70-g09d2