{"action":"created","comment":{"url":"https://api.github.com/repos/fhs/gompd/pulls/comments/23893994","id":23893994,"diff_hunk":"@@ -591,6 +591,76 @@ func (c *Client) List(uri string) ([]string, error) {\n \treturn ret, nil\n }\n \n+// Output related commands.\n+\n+// ListOutputs lists all configured outputs with their name, id & enabled state.\n+func (c *Client) ListOutputs() ([]map[string]interface{}, error) {\n+\toutputs := []map[string]interface{}{}\n+\tid, err := c.cmd(\"outputs\")\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tc.text.StartResponse(id)\n+\tdefer c.text.EndResponse(id)\n+\t// var output map[string]string\n+\tfor {\n+\t\tline, err := c.text.ReadLine()\n+\t\tif err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\t\tif line == \"OK\" {\n+\t\t\tbreak\n+\t\t}\n+\t\tif strings.HasPrefix(line, \"outputid\") {\n+\t\t\toutputs = append(outputs, map[string]interface{}{})\n+\t\t}\n+\t\ti := strings.Index(line, \": \")\n+\t\tif i < 0 {\n+\t\t\treturn nil, textproto.ProtocolError(\"can't parse line: \" + line)\n+\t\t}\n+\t\tkey := line[6:i]\n+\t\tswitch key {\n+\t\tcase \"enabled\":\n+\t\t\tif line[i+2:] == \"1\" {\n+\t\t\t\toutputs[len(outputs)-1][key] = true\n+\t\t\t} else {\n+\t\t\t\toutputs[len(outputs)-1][key] = false\n+\t\t\t}\n+\t\tcase \"id\":\n+\t\t\tid, err := strconv.Atoi(line[i+2:])\n+\t\t\tif err != nil {\n+\t\t\t\treturn nil, textproto.ProtocolError(\"can't parse output id: \" + line)\n+\t\t\t}\n+\t\t\toutputs[len(outputs)-1][key] = id\n+\t\tdefault:\n+\t\t\toutputs[len(outputs)-1][key] = line[i+2:]\n+\t\t}\n+\t}\n+\treturn outputs, nil\n+}\n+\n+// EnableOutput enables the audio output with the given id.\n+func (c *Client) EnableOutput(id uint) error {","path":"mpd/client.go","position":53,"original_position":53,"commit_id":"9b53e12fb488b81c7702472cc53e17e6622b8155","original_commit_id":"9b53e12fb488b81c7702472cc53e17e6622b8155","user":{"login":"fhs","id":183501,"avatar_url":"https://avatars.githubusercontent.com/u/183501?v=3","gravatar_id":"","url":"https://api.github.com/users/fhs","html_url":"https://github.com/fhs","followers_url":"https://api.github.com/users/fhs/followers","following_url":"https://api.github.com/users/fhs/following{/other_user}","gists_url":"https://api.github.com/users/fhs/gists{/gist_id}","starred_url":"https://api.github.com/users/fhs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fhs/subscriptions","organizations_url":"https://api.github.com/users/fhs/orgs","repos_url":"https://api.github.com/users/fhs/repos","events_url":"https://api.github.com/users/fhs/events{/privacy}","received_events_url":"https://api.github.com/users/fhs/received_events","type":"User","site_admin":false},"body":"id should be int instead of uint. We use int for id throughout the package (e.g. DeleteId).","created_at":"2015-02-01T01:53:36Z","updated_at":"2015-02-01T01:53:36Z","html_url":"https://github.com/fhs/gompd/pull/23#discussion_r23893994","pull_request_url":"https://api.github.com/repos/fhs/gompd/pulls/23","_links":{"self":{"href":"https://api.github.com/repos/fhs/gompd/pulls/comments/23893994"},"html":{"href":"https://github.com/fhs/gompd/pull/23#discussion_r23893994"},"pull_request":{"href":"https://api.github.com/repos/fhs/gompd/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/fhs/gompd/pulls/23","id":28378087,"html_url":"https://github.com/fhs/gompd/pull/23","diff_url":"https://github.com/fhs/gompd/pull/23.diff","patch_url":"https://github.com/fhs/gompd/pull/23.patch","issue_url":"https://api.github.com/repos/fhs/gompd/issues/23","number":23,"state":"open","locked":false,"title":"Feature/outputs","user":{"login":"zefer","id":101193,"avatar_url":"https://avatars.githubusercontent.com/u/101193?v=3","gravatar_id":"","url":"https://api.github.com/users/zefer","html_url":"https://github.com/zefer","followers_url":"https://api.github.com/users/zefer/followers","following_url":"https://api.github.com/users/zefer/following{/other_user}","gists_url":"https://api.github.com/users/zefer/gists{/gist_id}","starred_url":"https://api.github.com/users/zefer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zefer/subscriptions","organizations_url":"https://api.github.com/users/zefer/orgs","repos_url":"https://api.github.com/users/zefer/repos","events_url":"https://api.github.com/users/zefer/events{/privacy}","received_events_url":"https://api.github.com/users/zefer/received_events","type":"User","site_admin":false},"body":"Adds `ListOutputs`, `EnableOutput` & `DisableOutput` methods to list and control MPD's audio outputs.","created_at":"2015-01-30T17:27:28Z","updated_at":"2015-02-01T01:53:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"87bf483e4414bc2edb7a8c5218c689966cd8e270","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fhs/gompd/pulls/23/commits","review_comments_url":"https://api.github.com/repos/fhs/gompd/pulls/23/comments","review_comment_url":"https://api.github.com/repos/fhs/gompd/pulls/comments/{number}","comments_url":"https://api.github.com/repos/fhs/gompd/issues/23/comments","statuses_url":"https://api.github.com/repos/fhs/gompd/statuses/9b53e12fb488b81c7702472cc53e17e6622b8155","head":{"label":"zefer:feature/outputs","ref":"feature/outputs","sha":"9b53e12fb488b81c7702472cc53e17e6622b8155","user":{"login":"zefer","id":101193,"avatar_url":"https://avatars.githubusercontent.com/u/101193?v=3","gravatar_id":"","url":"https://api.github.com/users/zefer","html_url":"https://github.com/zefer","followers_url":"https://api.github.com/users/zefer/followers","following_url":"https://api.github.com/users/zefer/following{/other_user}","gists_url":"https://api.github.com/users/zefer/gists{/gist_id}","starred_url":"https://api.github.com/users/zefer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zefer/subscriptions","organizations_url":"https://api.github.com/users/zefer/orgs","repos_url":"https://api.github.com/users/zefer/repos","events_url":"https://api.github.com/users/zefer/events{/privacy}","received_events_url":"https://api.github.com/users/zefer/received_events","type":"User","site_admin":false},"repo":{"id":23996573,"name":"gompd","full_name":"zefer/gompd","owner":{"login":"zefer","id":101193,"avatar_url":"https://avatars.githubusercontent.com/u/101193?v=3","gravatar_id":"","url":"https://api.github.com/users/zefer","html_url":"https://github.com/zefer","followers_url":"https://api.github.com/users/zefer/followers","following_url":"https://api.github.com/users/zefer/following{/other_user}","gists_url":"https://api.github.com/users/zefer/gists{/gist_id}","starred_url":"https://api.github.com/users/zefer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zefer/subscriptions","organizations_url":"https://api.github.com/users/zefer/orgs","repos_url":"https://api.github.com/users/zefer/repos","events_url":"https://api.github.com/users/zefer/events{/privacy}","received_events_url":"https://api.github.com/users/zefer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zefer/gompd","description":"Client side library for MPD (Music Player Daemon) for Go Programming Language.","fork":true,"url":"https://api.github.com/repos/zefer/gompd","forks_url":"https://api.github.com/repos/zefer/gompd/forks","keys_url":"https://api.github.com/repos/zefer/gompd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zefer/gompd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zefer/gompd/teams","hooks_url":"https://api.github.com/repos/zefer/gompd/hooks","issue_events_url":"https://api.github.com/repos/zefer/gompd/issues/events{/number}","events_url":"https://api.github.com/repos/zefer/gompd/events","assignees_url":"https://api.github.com/repos/zefer/gompd/assignees{/user}","branches_url":"https://api.github.com/repos/zefer/gompd/branches{/branch}","tags_url":"https://api.github.com/repos/zefer/gompd/tags","blobs_url":"https://api.github.com/repos/zefer/gompd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zefer/gompd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zefer/gompd/git/refs{/sha}","trees_url":"https://api.github.com/repos/zefer/gompd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zefer/gompd/statuses/{sha}","languages_url":"https://api.github.com/repos/zefer/gompd/languages","stargazers_url":"https://api.github.com/repos/zefer/gompd/stargazers","contributors_url":"https://api.github.com/repos/zefer/gompd/contributors","subscribers_url":"https://api.github.com/repos/zefer/gompd/subscribers","subscription_url":"https://api.github.com/repos/zefer/gompd/subscription","commits_url":"https://api.github.com/repos/zefer/gompd/commits{/sha}","git_commits_url":"https://api.github.com/repos/zefer/gompd/git/commits{/sha}","comments_url":"https://api.github.com/repos/zefer/gompd/comments{/number}","issue_comment_url":"https://api.github.com/repos/zefer/gompd/issues/comments/{number}","contents_url":"https://api.github.com/repos/zefer/gompd/contents/{+path}","compare_url":"https://api.github.com/repos/zefer/gompd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zefer/gompd/merges","archive_url":"https://api.github.com/repos/zefer/gompd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zefer/gompd/downloads","issues_url":"https://api.github.com/repos/zefer/gompd/issues{/number}","pulls_url":"https://api.github.com/repos/zefer/gompd/pulls{/number}","milestones_url":"https://api.github.com/repos/zefer/gompd/milestones{/number}","notifications_url":"https://api.github.com/repos/zefer/gompd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zefer/gompd/labels{/name}","releases_url":"https://api.github.com/repos/zefer/gompd/releases{/id}","created_at":"2014-09-13T14:40:52Z","updated_at":"2015-01-29T17:56:51Z","pushed_at":"2015-01-30T16:26:04Z","git_url":"git://github.com/zefer/gompd.git","ssh_url":"git@github.com:zefer/gompd.git","clone_url":"https://github.com/zefer/gompd.git","svn_url":"https://github.com/zefer/gompd","homepage":"http://code.google.com/p/gompd/","size":317,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fhs:master","ref":"master","sha":"53927b160430e1b592bb8cac9e788ae8a318d366","user":{"login":"fhs","id":183501,"avatar_url":"https://avatars.githubusercontent.com/u/183501?v=3","gravatar_id":"","url":"https://api.github.com/users/fhs","html_url":"https://github.com/fhs","followers_url":"https://api.github.com/users/fhs/followers","following_url":"https://api.github.com/users/fhs/following{/other_user}","gists_url":"https://api.github.com/users/fhs/gists{/gist_id}","starred_url":"https://api.github.com/users/fhs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fhs/subscriptions","organizations_url":"https://api.github.com/users/fhs/orgs","repos_url":"https://api.github.com/users/fhs/repos","events_url":"https://api.github.com/users/fhs/events{/privacy}","received_events_url":"https://api.github.com/users/fhs/received_events","type":"User","site_admin":false},"repo":{"id":2298667,"name":"gompd","full_name":"fhs/gompd","owner":{"login":"fhs","id":183501,"avatar_url":"https://avatars.githubusercontent.com/u/183501?v=3","gravatar_id":"","url":"https://api.github.com/users/fhs","html_url":"https://github.com/fhs","followers_url":"https://api.github.com/users/fhs/followers","following_url":"https://api.github.com/users/fhs/following{/other_user}","gists_url":"https://api.github.com/users/fhs/gists{/gist_id}","starred_url":"https://api.github.com/users/fhs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fhs/subscriptions","organizations_url":"https://api.github.com/users/fhs/orgs","repos_url":"https://api.github.com/users/fhs/repos","events_url":"https://api.github.com/users/fhs/events{/privacy}","received_events_url":"https://api.github.com/users/fhs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fhs/gompd","description":"Client side library for MPD (Music Player Daemon) for Go Programming Language.","fork":false,"url":"https://api.github.com/repos/fhs/gompd","forks_url":"https://api.github.com/repos/fhs/gompd/forks","keys_url":"https://api.github.com/repos/fhs/gompd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fhs/gompd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fhs/gompd/teams","hooks_url":"https://api.github.com/repos/fhs/gompd/hooks","issue_events_url":"https://api.github.com/repos/fhs/gompd/issues/events{/number}","events_url":"https://api.github.com/repos/fhs/gompd/events","assignees_url":"https://api.github.com/repos/fhs/gompd/assignees{/user}","branches_url":"https://api.github.com/repos/fhs/gompd/branches{/branch}","tags_url":"https://api.github.com/repos/fhs/gompd/tags","blobs_url":"https://api.github.com/repos/fhs/gompd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fhs/gompd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fhs/gompd/git/refs{/sha}","trees_url":"https://api.github.com/repos/fhs/gompd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fhs/gompd/statuses/{sha}","languages_url":"https://api.github.com/repos/fhs/gompd/languages","stargazers_url":"https://api.github.com/repos/fhs/gompd/stargazers","contributors_url":"https://api.github.com/repos/fhs/gompd/contributors","subscribers_url":"https://api.github.com/repos/fhs/gompd/subscribers","subscription_url":"https://api.github.com/repos/fhs/gompd/subscription","commits_url":"https://api.github.com/repos/fhs/gompd/commits{/sha}","git_commits_url":"https://api.github.com/repos/fhs/gompd/git/commits{/sha}","comments_url":"https://api.github.com/repos/fhs/gompd/comments{/number}","issue_comment_url":"https://api.github.com/repos/fhs/gompd/issues/comments/{number}","contents_url":"https://api.github.com/repos/fhs/gompd/contents/{+path}","compare_url":"https://api.github.com/repos/fhs/gompd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fhs/gompd/merges","archive_url":"https://api.github.com/repos/fhs/gompd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fhs/gompd/downloads","issues_url":"https://api.github.com/repos/fhs/gompd/issues{/number}","pulls_url":"https://api.github.com/repos/fhs/gompd/pulls{/number}","milestones_url":"https://api.github.com/repos/fhs/gompd/milestones{/number}","notifications_url":"https://api.github.com/repos/fhs/gompd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fhs/gompd/labels{/name}","releases_url":"https://api.github.com/repos/fhs/gompd/releases{/id}","created_at":"2011-08-31T00:23:50Z","updated_at":"2015-01-17T21:30:21Z","pushed_at":"2014-11-16T08:12:48Z","git_url":"git://github.com/fhs/gompd.git","ssh_url":"git@github.com:fhs/gompd.git","clone_url":"https://github.com/fhs/gompd.git","svn_url":"https://github.com/fhs/gompd","homepage":"","size":682,"stargazers_count":24,"watchers_count":24,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":3,"forks":11,"open_issues":3,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fhs/gompd/pulls/23"},"html":{"href":"https://github.com/fhs/gompd/pull/23"},"issue":{"href":"https://api.github.com/repos/fhs/gompd/issues/23"},"comments":{"href":"https://api.github.com/repos/fhs/gompd/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/fhs/gompd/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/fhs/gompd/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/fhs/gompd/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/fhs/gompd/statuses/9b53e12fb488b81c7702472cc53e17e6622b8155"}}}}