{"id":15672337,"url":"https://github.com/mamantoha/mpd_client","last_synced_at":"2025-10-29T06:09:05.178Z","repository":{"id":2869342,"uuid":"3874887","full_name":"mamantoha/mpd_client","owner":"mamantoha","description":"Simple Music Player Daemon library written entirely in Ruby","archived":false,"fork":false,"pushed_at":"2023-10-29T11:45:27.000Z","size":63,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-06T21:06:07.902Z","etag":null,"topics":["hacktoberfest","mpd","music-player-daemon","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mamantoha.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-03-30T08:47:49.000Z","updated_at":"2024-05-11T09:41:05.000Z","dependencies_parsed_at":"2024-10-23T10:37:32.590Z","dependency_job_id":"19590892-860e-46d5-973e-82626b553d62","html_url":"https://github.com/mamantoha/mpd_client","commit_stats":{"total_commits":58,"total_committers":3,"mean_commits":"19.333333333333332","dds":"0.051724137931034475","last_synced_commit":"0d74f7590458044d6324921ac59ed50894a0079f"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mamantoha%2Fmpd_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mamantoha%2Fmpd_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mamantoha%2Fmpd_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mamantoha%2Fmpd_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mamantoha","download_url":"https://codeload.github.com/mamantoha/mpd_client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252769396,"owners_count":21801376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","mpd","music-player-daemon","ruby"],"created_at":"2024-10-03T15:24:18.885Z","updated_at":"2025-10-29T06:09:00.141Z","avatar_url":"https://github.com/mamantoha.png","language":"Ruby","readme":"# MPD::Client\n\n[![Build Status](https://badgen.net/travis/mamantoha/mpd_client)](https://travis-ci.org/mamantoha/mpd_client)\n[![Gem Version](https://badge.fury.io/rb/mpd_client.svg)](https://badge.fury.io/rb/mpd_client)\n\nYet another Music Player Daemon (MPD) client library written entirely in Ruby.\n`mpd_client` is a Ruby port of the [python-mpd](https://github.com/Mic92/python-mpd2) library.\n\n## Installation\n\nAdd this line to your application `Gemfile`:\n\n```ruby\ngem 'mpd_client'\n```\n\nAnd then execute:\n\n```console\nbundle\n```\n\nOr install it yourself as:\n\n```console\ngem install mpd_client\n```\n\n## Usage\n\nAll functionality is contained in the `MPD::Client` class. Creating an instance of this class is as simple as:\n\n```ruby\nrequire 'mpd_client'\n\nclient = MPD::Client.new\n```\n\nOnce you have an instance of the `MPD::Client` class, start by connecting to the server:\n\n```ruby\nclient.connect('localhost', 6600)\n```\n\nor Unix domain socket\n\n```ruby\nclient.connect('/var/run/mpd/socket')\n```\n\nThe client library can be used as follows:\n\n```ruby\nputs client.mpd_version             # print the mpd version\nputs client.search('title', 'ruby') # print the result of the command 'search title ruby'\nclient.close                        # send the close command\nclient.disconect                    # disconnect from the server\n```\n\nCommand lists are also supported using `command_list_ok_begin` and `command_list_end`:\n\n```ruby\nclient.command_list_ok_begin # start a command list\nclient.update                # insert the update command into the list\nclient.status                # insert the status command into the list\nclient.command_list_end      # result will be a Array with the results\n```\n\n### Binary responses\n\nSome commands can return binary data.\n\n```ruby\nrequire 'mpd_client'\n\nclient = MPD::Client.new\nclient.connect('localhost', 6600)\n\nif (current_song = client.currentsong)\n  data, io = client.readpicture(current_song['file'])\n  io # StringIO\n  data # =\u003e {\"size\"=\u003e\"322860\", \"type\"=\u003e\"image/jpeg\", \"binary\"=\u003e\"3372\"}\n  File.write('cover.jpg', io.string)\nend\n```\n\nThe above will locate album art for the current song and save image to `cover.jpg` file.\n\n### Ranges\n\nSome 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:\n\n```ruby\n# move the first three songs after the fifth number in the playlist\nclient.move([0, 3], 5)\n```\n\nSecond element can be omitted. MPD will assumes the biggest possible number then:\n\n```ruby\n# delete all songs from the current playlist, except for the firts ten\nclient.delete([10,])\n```\n\n### Logging\n\nDefault logger for all MPD::Client instances:\n\n```ruby\nrequire 'logger'\nrequire 'mpd_client'\n\nMPD::Client.log = Logger.new($stderr)\n\nclient = MPD::Client.new\n```\n\nSets the logger used by this instance of MPD::Client:\n\n```ruby\nrequire 'logger'\nrequire 'mpd_client'\n\nclient = MPD::Client.new\nclient.log = Logger.new($stderr)\n```\n\nFor more information about logging configuration, see [Logger](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html)\n\n## Development\n\nAfter 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.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## License and Author\n\nCopyright (c) 2012-2023 by Anton Maminov\n\nThis library is distributed under the MIT license.  Please see the LICENSE file.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmamantoha%2Fmpd_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmamantoha%2Fmpd_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmamantoha%2Fmpd_client/lists"}