From 36d8e7b37af77beb9718dbf292425085c29b83ca Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Tue, 21 Jul 2009 15:43:05 -0700 Subject: Add status and stats methods. --- mpdlib.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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 -- cgit v1.2.3-70-g09d2