diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2009-07-21 15:30:21 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2009-07-21 15:30:21 -0700 |
commit | d17997f59f1d3eac2ed60980724786778c06d6c9 (patch) | |
tree | c03c5fdc2300c08eb2019380d95c770b1f996f56 | |
parent | ca0ac60d048ed34cc39be0414b14a51bb0408b82 (diff) | |
download | ruby-libmpd-d17997f59f1d3eac2ed60980724786778c06d6c9.tar.gz ruby-libmpd-d17997f59f1d3eac2ed60980724786778c06d6c9.tar.xz |
Add currentsong method.
-rw-r--r-- | mpdlib.rb | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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 |