README.md in mpd_client-0.1.0 vs README.md in mpd_client-0.2.0

- old
+ new

@@ -29,10 +29,12 @@ ## Usage All functionality is contained in the `MPD::Client` class. Creating an instance of this class is as simple as: ```ruby +require 'mpd_client' + client = MPD::Client.new ``` Once you have an instance of the `MPD::Client` class, start by connecting to the server: @@ -62,10 +64,30 @@ client.update # insert the update command into the list client.status # insert the status command into the list client.command_list_end # result will be a Array with the results ``` +### Binary responses + +Some commands can return binary data. + +```ruby +require 'mpd_client' + +client = MPD::Client.new +client.connect('localhost', 6600) + +if (current_song = client.currentsong) + data, io = client.readpicture(current_song['file']) + io # StringIO + data # => {"size"=>"322860", "type"=>"image/jpeg", "binary"=>"3372"} + File.write('cover.jpg', io.string) +end +``` + +The above will locate album art for the current song and save image to `cover.jpg` file. + ### Ranges Some commands(e.g. `move`, `delete`, `load`, `shuffle`, `playlistinfo`) support integer ranges(`[START:END]`) as argument. This is done in `mpd_client` by using two element array: ```ruby @@ -101,11 +123,11 @@ client = MPD::Client.new client.log = Logger.new($stderr) ``` -For more information about logging configuration, see [Logger](https://ruby-doc.org/stdlib-2.5.1/libdoc/logger/rdoc/Logger.html) +For more information about logging configuration, see [Logger](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. @@ -119,8 +141,8 @@ 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request ## License and Author -Copyright (c) 2013-2018 by Anton Maminov +Copyright (c) 2012-2022 by Anton Maminov This library is distributed under the MIT license. Please see the LICENSE file.