Yet another Music Player Daemon (MPD) client library written entirely in Ruby.
mpd_client
is a Ruby port of the python-mpd library.
Add this line to your application Gemfile
:
gem 'mpd_client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mpd_client
All functionality is contained in the MPDClient
class. Creating an instance of this class is as simple as:
client = MPDClient.new
Once you have an instance of the MPDClient
class, start by connecting to the server:
client.connect('localhost', 6600)
The client library can be used as follows:
puts client.mpd_version # print the mpd version
puts client.search('title', 'ruby') # print the result of the command 'search title ruby'
client.close # send the close command
client.disconect # disconnect from the server
Command lists are also supported using command_list_ok_begin
and command_list_end
:
client.command_list_ok_begin # start a command list
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
git checkout -b my-new-feature
) git commit -am 'Added some feature'
) git push origin my-new-feature
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
# MPDClient
Yet another Music Player Daemon (MPD) client library written entirely in Ruby.
`mpd_client` is a Ruby port of the [python-mpd](https://github.com/Mic92/python-mpd2) library.
## Installation
Add this line to your application `Gemfile`:
```ruby
gem 'mpd_client'
```
And then execute:
```
$ bundle
```
Or install it yourself as:
```
$ gem install mpd_client
```
## Usage
All functionality is contained in the `MPDClient` class. Creating an instance of this class is as simple as:
```ruby
client = MPDClient.new
```
Once you have an instance of the `MPDClient` class, start by connecting to the server:
```ruby
client.connect('localhost', 6600)
```
The client library can be used as follows:
```ruby
puts client.mpd_version # print the mpd version
puts client.search('title', 'ruby') # print the result of the command 'search title ruby'
client.close # send the close command
client.disconect # disconnect from the server
```
Command lists are also supported using `command_list_ok_begin` and `command_list_end`:
```ruby
client.command_list_ok_begin # start a command list
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
```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request