summaryrefslogtreecommitdiff
path: root/mpdlib.rb
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-21 15:30:21 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-21 15:30:21 -0700
commitd17997f59f1d3eac2ed60980724786778c06d6c9 (patch)
treec03c5fdc2300c08eb2019380d95c770b1f996f56 /mpdlib.rb
parentca0ac60d048ed34cc39be0414b14a51bb0408b82 (diff)
downloadruby-libmpd-d17997f59f1d3eac2ed60980724786778c06d6c9.tar.gz
ruby-libmpd-d17997f59f1d3eac2ed60980724786778c06d6c9.tar.xz
Add currentsong method.
Diffstat (limited to 'mpdlib.rb')
-rw-r--r--mpdlib.rb10
1 files changed, 10 insertions, 0 deletions
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