Commit c8cf8f1959721da77db787fc5be021d3b6b7400f

Anton Maminov 2013-11-06T12:31:47

Add support for readcomments

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a4afe86..6cf0a11 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # MPDClient CHANGELOG
 
+### 0.0.4
+
+* Add support for readcomments
+
 ### 0.0.3
 
 * Support for logging
diff --git a/MPD_COMMANDS.md b/MPD_COMMANDS.md
index ebdf0ce..012a3b0 100644
--- a/MPD_COMMANDS.md
+++ b/MPD_COMMANDS.md
@@ -431,6 +431,15 @@ Some of the commands described in this section can be used to run playlist plugi
 
 > Same as `update`, but also rescans unmodified files.
 
+---
+`readcomments [URI] => fetch_object`
+
+> Read "comments" (i.e. key-value pairs) from the file specified by `URI`. This `URI` can be a path relative to the music directory or a URL in the form `file:///foo/bar.ogg`.
+
+> The response consists of lines in the form "KEY: VALUE". Comments with suspicious characters (e.g. newlines) are ignored silently.
+
+> The meaning of these depends on the codec, and not all decoder plugins support it.  For example, on Ogg files, this lists the Vorbis comments.
+
 ### Sticker Commands
 
 "Stickers" are pieces of information attached to existing MPD objects (e.g. song files, directories, albums). Clients can create arbitrary name/value pairs. MPD itself does not assume any special meaning in them.
diff --git a/lib/mpd_client.rb b/lib/mpd_client.rb
index 854524e..41acfef 100644
--- a/lib/mpd_client.rb
+++ b/lib/mpd_client.rb
@@ -86,6 +86,7 @@ COMMANDS = {
   "searchaddp1"        => "fetch_nothing",
   "update"             => "fetch_item",
   "rescan"             => "fetch_item",
+  "readcomments"       => "fetch_item",
   # Sticker Commands
   "sticker get"        => "fetch_sticker",
   "sticker set"        => "fetch_nothing",