diff options
-rw-r--r-- | libmpd.rb | 12 | ||||
-rw-r--r-- | libmpd/database.rb | 17 |
2 files changed, 19 insertions, 10 deletions
@@ -5,6 +5,7 @@ # See http://www.gnu.org/licenses/gpl.txt for the full license text. require 'socket' +require 'libmpd/database' require 'libmpd/playbackcontrol' require 'libmpd/playbackoptions' require 'libmpd/playlist' @@ -23,6 +24,7 @@ class FalseClass # :nodoc: end class MPD + include MPDDatabase include MPDPlaybackControl include MPDPlaybackOptions include MPDPlaylist @@ -81,16 +83,6 @@ class MPD return songs end - # Find all songs in database with an exact match. - def find type, what - return split_and_hash send_request 'find %s "%s"' % [type, what] - end - - # Searches the database. - def search type, what - return split_and_hash send_request 'search %s "%s"' % [type, what] - end - private :generate_hash private :get_response private :split_and_hash diff --git a/libmpd/database.rb b/libmpd/database.rb new file mode 100644 index 0000000..a1a6660 --- /dev/null +++ b/libmpd/database.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# +# Copyright 2009 David Vazgenovich Shakaryan <dvshakaryan@gmail.com> +# Distributed under the terms of the GNU General Public License v3. +# 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] + end + + # Searches the database. + def search type, what + return split_and_hash send_request 'search %s "%s"' % [type, what] + end +end |