From d17997f59f1d3eac2ed60980724786778c06d6c9 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Tue, 21 Jul 2009 15:30:21 -0700 Subject: Add currentsong method. --- mpdlib.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mpdlib.rb b/mpdlib.rb index c8266be..3b5a27f 100644 --- a/mpdlib.rb +++ b/mpdlib.rb @@ -36,4 +36,14 @@ class MPD response << line end end + + def currentsong + response = send_request('currentsong') + hash = Hash.new + + response.split("\n").each do |line| + field, value = line.split(': ') + hash[field] = value + end + end end -- cgit v1.2.3-70-g09d2