diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2009-07-24 11:00:20 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2009-07-24 11:00:20 -0700 |
commit | 890476e7e2452e359d8c528348dc4f30c3dfb797 (patch) | |
tree | 8133329eddf16271a857b9e4e7ae5f1d506f40e5 /libmpd/database.rb | |
parent | a23f9c8b2a71c18c9ab51e4f752f0a32d0c96312 (diff) | |
download | ruby-libmpd-890476e7e2452e359d8c528348dc4f30c3dfb797.tar.gz ruby-libmpd-890476e7e2452e359d8c528348dc4f30c3dfb797.tar.xz |
New update method and improved database docs.
Diffstat (limited to 'libmpd/database.rb')
-rw-r--r-- | libmpd/database.rb | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/libmpd/database.rb b/libmpd/database.rb index a1a6660..3f5616e 100644 --- a/libmpd/database.rb +++ b/libmpd/database.rb @@ -5,13 +5,28 @@ # See http://www.gnu.org/licenses/gpl.txt for the full license text. module MPDDatabase - # Find all songs in database with an exact match. - def find type, what - return split_and_hash send_request 'find %s "%s"' % [type, what] + # Finds all songs in the database where _field_ is _value_. + # Matching is case-sensitive. + # + # Possible field names: album, artist, title. + def find field, value + return split_and_hash send_request 'find %s "%s"' % [field, value] end - # Searches the database. - def search type, what - return split_and_hash send_request 'search %s "%s"' % [type, what] + # Finds all songs in the database where _field_ contains _value_. + # Matching is not case-sensitive. + # + # Possible field names: album, artist, filename, title. + def search field, value + return split_and_hash send_request 'search %s "%s"' % [field, value] + end + + # Updates the database. + # If an argument is given, update that particular file or directory. + def update uri=nil + command = 'update' + command << ' "%s"' % uri if uri + + return send_request command end end |