summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-21 15:43:05 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-21 15:43:05 -0700
commit36d8e7b37af77beb9718dbf292425085c29b83ca (patch)
treeb1987fec67f79ff782ef1766ba10a01b30d8691b
parent17daf095bb67798cfd45494a427973b2bcc9bc35 (diff)
downloadruby-libmpd-36d8e7b37af77beb9718dbf292425085c29b83ca.tar.gz
ruby-libmpd-36d8e7b37af77beb9718dbf292425085c29b83ca.tar.xz
Add status and stats methods.
-rw-r--r--mpdlib.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/mpdlib.rb b/mpdlib.rb
index bd25637..4519787 100644
--- a/mpdlib.rb
+++ b/mpdlib.rb
@@ -48,4 +48,28 @@ class MPD
return hash
end
+
+ def status
+ response = send_request('status')
+ hash = Hash.new
+
+ response.split("\n").each do |line|
+ field, value = line.split(': ')
+ hash[field] = value
+ end
+
+ return hash
+ end
+
+ def stats
+ response = send_request('stats')
+ hash = Hash.new
+
+ response.split("\n").each do |line|
+ field, value = line.split(': ')
+ hash[field] = value
+ end
+
+ return hash
+ end
end