summaryrefslogtreecommitdiff
path: root/libmpd/database.rb
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-24 11:43:51 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-24 11:43:51 -0700
commit5ebda82d1b57733e0960eac5eb74d078b64e7cc5 (patch)
treefdf84c8a65015db9108cac652002ff89f7721e60 /libmpd/database.rb
parent890476e7e2452e359d8c528348dc4f30c3dfb797 (diff)
downloadruby-libmpd-5ebda82d1b57733e0960eac5eb74d078b64e7cc5.tar.gz
ruby-libmpd-5ebda82d1b57733e0960eac5eb74d078b64e7cc5.tar.xz
Add count method.
Diffstat (limited to 'libmpd/database.rb')
-rw-r--r--libmpd/database.rb7
1 files changed, 6 insertions, 1 deletions
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