{"id":20199036,"url":"https://github.com/robertodoering/dart_mpd","last_synced_at":"2025-09-21T21:32:29.588Z","repository":{"id":149466360,"uuid":"609697133","full_name":"robertodoering/dart_mpd","owner":"robertodoering","description":"dart mpd client","archived":false,"fork":false,"pushed_at":"2024-12-30T11:40:18.000Z","size":283,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T19:17:11.182Z","etag":null,"topics":["dart-package","mpd","mpd-client"],"latest_commit_sha":null,"homepage":"","language":"Dart","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/robertodoering.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":"2023-03-05T00:23:05.000Z","updated_at":"2024-12-30T11:40:21.000Z","dependencies_parsed_at":"2024-07-14T12:43:48.680Z","dependency_job_id":"d79dcca7-eca7-4bb4-8371-126b78d8bc05","html_url":"https://github.com/robertodoering/dart_mpd","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertodoering%2Fdart_mpd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertodoering%2Fdart_mpd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertodoering%2Fdart_mpd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertodoering%2Fdart_mpd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertodoering","download_url":"https://codeload.github.com/robertodoering/dart_mpd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233802414,"owners_count":18732534,"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":["dart-package","mpd","mpd-client"],"created_at":"2024-11-14T04:35:36.533Z","updated_at":"2025-09-21T21:32:24.176Z","avatar_url":"https://github.com/robertodoering.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dart_mpd\n\n[![pub](https://img.shields.io/pub/v/dart_mpd)](https://pub.dev/packages/dart_mpd)\n\ndart_mpd is a dart package which implements the [Music Player Daemon](https://www.musicpd.org/) protocol.\n\nSupports Linux, macOS and Windows.\n\n## Example\n\n```dart\nfinal client = MpdClient(\n  // resolves connection details from environment variables and defaults\n  connectionDetails: MpdConnectionDetails.resolve(),\n);\n\n// a request will automatically connect to the socket if not already connected\nfinal song = await client.currentsong();\n\n// responses are parsed into models\nprint(song?.file); // -\u003e String\nprint(song?.duration); // -\u003e Duration\nprint(song?.artist); // -\u003e List\u003cString\u003e\nprint(song?.title); // -\u003e List\u003cString\u003e\n\n// you can hook into the connection lifecycle through callbacks on the client\nfinal client = MpdClient(\n  connectionDetails: MpdConnectionDetails.resolve(),\n  onConnect: () =\u003e print('connected to socket'),\n  onConnectError: (Object e, StackTrace st) =\u003e print('socket connection failed: $e'),\n  onSend: (String event) =\u003e print('sent mpd command: $event'),\n  onData: (Uint8List data) =\u003e print('received raw data: $data'),\n  onResponse: (MpdResponse response) =\u003e print('response: $response'),\n  onDone: () =\u003e print('socket closed'),\n  onError: (Object e, StackTrace st) =\u003e print('error: $e'),\n);\n```\n\n## Requests\n\nTo handle concurrent request, each request gets queued, so you can use use one client to make simultaneous requests.\n\nKeep in mind that using `idle` will block the socket until an `idle` response has been received.\n\n### Arguments\n\nRequest arguments are escaped and wrapped in quotation marks automatically.\n\n## Connection details\n\n`MpdConnectionDetails.resolve` will resolve the connection details from\nenvironment variables and fallback to the default values as described in\nhttps://mpd.readthedocs.io/en/stable/client.html#connecting-to-mpd.\n\nYou can also manually set the host and port using the default constructor.\n\n## Error handling\n\nA request can throw the following errors:\n- `MpdResponseError` if the server returns with an error\n- `SocketException` if the host-lookup or connection fails\n- `MpdUnexpectedResponse` if an unexpected response is received\n- `MpdClientException` and any other error that may be thrown when trying to parse the response\n\n```dart\ntry {\n  await client.setval(200);\n} catch (e) {\n  print(e); // -\u003e MpdResponseError\n}\n```\n\n## Commands\n\nThis package provides interfaces for all commands in MPD's stable release and parses their response into data models.\n\nEach method on the `MpdClient` resembles the name of the command. A reference can be found here: https://mpd.readthedocs.io/en/stable/protocol.html#command-reference.\n\nIf a command has not yet been added to the `MpdClient`, a request can be made manually using `MpdClient.connection.send`. Example:\n\n```dart\nfinal response = await client.connection.send('currentsong');\nfinal values = switch (response) {\n  MpdResponseOk(:final values) =\u003e values,\n  _ =\u003e null,\n};\n// values is a list of the received key-value pairs\n```\n\nIf a command is in the stable release and has not been added to dart_mpd, please file an [issue](https://github.com/robertodoering/twitter_api/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertodoering%2Fdart_mpd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertodoering%2Fdart_mpd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertodoering%2Fdart_mpd/lists"}