{"action":"created","comment":{"url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls/comments/64667385","id":64667385,"diff_hunk":"@@ -74,121 +216,105 @@ module.exports = function (RED) {\n       }\n \n       if (!config.band) {\n-        var message_err_band = 'Missing audio band configuration, unable to process speech.';\n+        var message_err_band = 'Missing audio quality configuration, unable to process speech.';\n \n         node.error(message_err_band, msg)\n         return;\n-      }\n+      }  \n \n+      // Has to be there, as its a checkbox, but flows switching from the old (frankly \n+      // unbeliveable) select might not have it set.\n       if (!config.continuous) {\n         var message_err_continuous = 'Missing continuous details, unable to process speech.';\n \n         node.error(message_err_continuous, msg)\n         return;\n-      }\n+      }  \n \n-      var model = config.lang + '_' + config.band;\n+      // The input comes in on msg.payload, and can either be an audio file or a string \n+      // representing a URL.  \n+      if (!msg.payload instanceof Buffer || !typeof msg.payload === 'string') {\n+        var message = 'Invalid property: msg.payload, can only be a URL or a Buffer.';\n \n-      var speech_to_text = watson.speech_to_text({\n-        username: username,\n-        password: password,\n-        version: 'v1',\n-        url: 'https://stream.watsonplatform.net/speech-to-text/api'\n-      });\n+        node.error(message, msg)\n+        return;\n+      }\n \n-      var s2t = function (audio, format, cb) {\n-        if (format !== 'wav' && format !== 'flac' && format !== 'ogg') {\n-          var message_err_format = 'Audio format (' + format + ') not supported, must be encoded as WAV, FLAC or OGG.';\n+      // This check is repeated just before the call to the service, but \n+      // its also performed here as a double check. \n+      if (!(msg.payload instanceof Buffer)) {\n+        if (typeof msg.payload === 'string' && !urlCheck(msg.payload)) {\n+          var message = 'Invalid URL.';","path":"services/speech_to_text/v1.js","position":263,"original_position":263,"commit_id":"90a268a916fd2d5d7364a3196d600c858535fbd2","original_commit_id":"90a268a916fd2d5d7364a3196d600c858535fbd2","user":{"login":"yrezgui","id":1113976,"avatar_url":"https://avatars.githubusercontent.com/u/1113976?v=3","gravatar_id":"","url":"https://api.github.com/users/yrezgui","html_url":"https://github.com/yrezgui","followers_url":"https://api.github.com/users/yrezgui/followers","following_url":"https://api.github.com/users/yrezgui/following{/other_user}","gists_url":"https://api.github.com/users/yrezgui/gists{/gist_id}","starred_url":"https://api.github.com/users/yrezgui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yrezgui/subscriptions","organizations_url":"https://api.github.com/users/yrezgui/orgs","repos_url":"https://api.github.com/users/yrezgui/repos","events_url":"https://api.github.com/users/yrezgui/events{/privacy}","received_events_url":"https://api.github.com/users/yrezgui/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Variable 'message' is already declared in line 236.](https://www.codacy.com/app/rezgui-y/node-red-node-watson/file/2636145243/issues/source?bid=3225115&fileBranchId=3319654#l247)","created_at":"2016-05-25T22:55:08Z","updated_at":"2016-05-25T22:55:08Z","html_url":"https://github.com/watson-developer-cloud/node-red-node-watson/pull/88#discussion_r64667385","pull_request_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls/88","_links":{"self":{"href":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls/comments/64667385"},"html":{"href":"https://github.com/watson-developer-cloud/node-red-node-watson/pull/88#discussion_r64667385"},"pull_request":{"href":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls/88"}}},"pull_request":{"url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls/88","id":71474568,"html_url":"https://github.com/watson-developer-cloud/node-red-node-watson/pull/88","diff_url":"https://github.com/watson-developer-cloud/node-red-node-watson/pull/88.diff","patch_url":"https://github.com/watson-developer-cloud/node-red-node-watson/pull/88.patch","issue_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/issues/88","number":88,"state":"closed","locked":false,"title":"Dynamic Speech to Text node","user":{"login":"chughts","id":10371360,"avatar_url":"https://avatars.githubusercontent.com/u/10371360?v=3","gravatar_id":"","url":"https://api.github.com/users/chughts","html_url":"https://github.com/chughts","followers_url":"https://api.github.com/users/chughts/followers","following_url":"https://api.github.com/users/chughts/following{/other_user}","gists_url":"https://api.github.com/users/chughts/gists{/gist_id}","starred_url":"https://api.github.com/users/chughts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chughts/subscriptions","organizations_url":"https://api.github.com/users/chughts/orgs","repos_url":"https://api.github.com/users/chughts/repos","events_url":"https://api.github.com/users/chughts/events{/privacy}","received_events_url":"https://api.github.com/users/chughts/received_events","type":"User","site_admin":false},"body":"Modified the STT node to fetch models, so longer hard-coded in the node. Fixed transcription truncation problem.","created_at":"2016-05-25T22:39:01Z","updated_at":"2016-05-25T22:55:08Z","closed_at":"2016-05-25T22:53:43Z","merged_at":null,"merge_commit_sha":"2febf296097a8de8eb5503cf13a235a55d9c1506","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls/88/commits","review_comments_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls/88/comments","review_comment_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls/comments{/number}","comments_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/issues/88/comments","statuses_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/statuses/90a268a916fd2d5d7364a3196d600c858535fbd2","head":{"label":"chughts:master","ref":"master","sha":"90a268a916fd2d5d7364a3196d600c858535fbd2","user":{"login":"chughts","id":10371360,"avatar_url":"https://avatars.githubusercontent.com/u/10371360?v=3","gravatar_id":"","url":"https://api.github.com/users/chughts","html_url":"https://github.com/chughts","followers_url":"https://api.github.com/users/chughts/followers","following_url":"https://api.github.com/users/chughts/following{/other_user}","gists_url":"https://api.github.com/users/chughts/gists{/gist_id}","starred_url":"https://api.github.com/users/chughts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chughts/subscriptions","organizations_url":"https://api.github.com/users/chughts/orgs","repos_url":"https://api.github.com/users/chughts/repos","events_url":"https://api.github.com/users/chughts/events{/privacy}","received_events_url":"https://api.github.com/users/chughts/received_events","type":"User","site_admin":false},"repo":{"id":58115630,"name":"node-red-node-watson","full_name":"chughts/node-red-node-watson","owner":{"login":"chughts","id":10371360,"avatar_url":"https://avatars.githubusercontent.com/u/10371360?v=3","gravatar_id":"","url":"https://api.github.com/users/chughts","html_url":"https://github.com/chughts","followers_url":"https://api.github.com/users/chughts/followers","following_url":"https://api.github.com/users/chughts/following{/other_user}","gists_url":"https://api.github.com/users/chughts/gists{/gist_id}","starred_url":"https://api.github.com/users/chughts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chughts/subscriptions","organizations_url":"https://api.github.com/users/chughts/orgs","repos_url":"https://api.github.com/users/chughts/repos","events_url":"https://api.github.com/users/chughts/events{/privacy}","received_events_url":"https://api.github.com/users/chughts/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chughts/node-red-node-watson","description":"A collection of nodes for the IBM Watson services","fork":true,"url":"https://api.github.com/repos/chughts/node-red-node-watson","forks_url":"https://api.github.com/repos/chughts/node-red-node-watson/forks","keys_url":"https://api.github.com/repos/chughts/node-red-node-watson/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chughts/node-red-node-watson/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chughts/node-red-node-watson/teams","hooks_url":"https://api.github.com/repos/chughts/node-red-node-watson/hooks","issue_events_url":"https://api.github.com/repos/chughts/node-red-node-watson/issues/events{/number}","events_url":"https://api.github.com/repos/chughts/node-red-node-watson/events","assignees_url":"https://api.github.com/repos/chughts/node-red-node-watson/assignees{/user}","branches_url":"https://api.github.com/repos/chughts/node-red-node-watson/branches{/branch}","tags_url":"https://api.github.com/repos/chughts/node-red-node-watson/tags","blobs_url":"https://api.github.com/repos/chughts/node-red-node-watson/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chughts/node-red-node-watson/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chughts/node-red-node-watson/git/refs{/sha}","trees_url":"https://api.github.com/repos/chughts/node-red-node-watson/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chughts/node-red-node-watson/statuses/{sha}","languages_url":"https://api.github.com/repos/chughts/node-red-node-watson/languages","stargazers_url":"https://api.github.com/repos/chughts/node-red-node-watson/stargazers","contributors_url":"https://api.github.com/repos/chughts/node-red-node-watson/contributors","subscribers_url":"https://api.github.com/repos/chughts/node-red-node-watson/subscribers","subscription_url":"https://api.github.com/repos/chughts/node-red-node-watson/subscription","commits_url":"https://api.github.com/repos/chughts/node-red-node-watson/commits{/sha}","git_commits_url":"https://api.github.com/repos/chughts/node-red-node-watson/git/commits{/sha}","comments_url":"https://api.github.com/repos/chughts/node-red-node-watson/comments{/number}","issue_comment_url":"https://api.github.com/repos/chughts/node-red-node-watson/issues/comments{/number}","contents_url":"https://api.github.com/repos/chughts/node-red-node-watson/contents/{+path}","compare_url":"https://api.github.com/repos/chughts/node-red-node-watson/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chughts/node-red-node-watson/merges","archive_url":"https://api.github.com/repos/chughts/node-red-node-watson/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chughts/node-red-node-watson/downloads","issues_url":"https://api.github.com/repos/chughts/node-red-node-watson/issues{/number}","pulls_url":"https://api.github.com/repos/chughts/node-red-node-watson/pulls{/number}","milestones_url":"https://api.github.com/repos/chughts/node-red-node-watson/milestones{/number}","notifications_url":"https://api.github.com/repos/chughts/node-red-node-watson/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chughts/node-red-node-watson/labels{/name}","releases_url":"https://api.github.com/repos/chughts/node-red-node-watson/releases{/id}","deployments_url":"https://api.github.com/repos/chughts/node-red-node-watson/deployments","created_at":"2016-05-05T08:19:28Z","updated_at":"2016-05-14T07:16:53Z","pushed_at":"2016-05-25T22:53:21Z","git_url":"git://github.com/chughts/node-red-node-watson.git","ssh_url":"git@github.com:chughts/node-red-node-watson.git","clone_url":"https://github.com/chughts/node-red-node-watson.git","svn_url":"https://github.com/chughts/node-red-node-watson","homepage":null,"size":7702,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"watson-developer-cloud:master","ref":"master","sha":"e6e14fee13735822b9d1c5da27ee36f20044f6b9","user":{"login":"watson-developer-cloud","id":10017763,"avatar_url":"https://avatars.githubusercontent.com/u/10017763?v=3","gravatar_id":"","url":"https://api.github.com/users/watson-developer-cloud","html_url":"https://github.com/watson-developer-cloud","followers_url":"https://api.github.com/users/watson-developer-cloud/followers","following_url":"https://api.github.com/users/watson-developer-cloud/following{/other_user}","gists_url":"https://api.github.com/users/watson-developer-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/watson-developer-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/watson-developer-cloud/subscriptions","organizations_url":"https://api.github.com/users/watson-developer-cloud/orgs","repos_url":"https://api.github.com/users/watson-developer-cloud/repos","events_url":"https://api.github.com/users/watson-developer-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/watson-developer-cloud/received_events","type":"Organization","site_admin":false},"repo":{"id":55415107,"name":"node-red-node-watson","full_name":"watson-developer-cloud/node-red-node-watson","owner":{"login":"watson-developer-cloud","id":10017763,"avatar_url":"https://avatars.githubusercontent.com/u/10017763?v=3","gravatar_id":"","url":"https://api.github.com/users/watson-developer-cloud","html_url":"https://github.com/watson-developer-cloud","followers_url":"https://api.github.com/users/watson-developer-cloud/followers","following_url":"https://api.github.com/users/watson-developer-cloud/following{/other_user}","gists_url":"https://api.github.com/users/watson-developer-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/watson-developer-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/watson-developer-cloud/subscriptions","organizations_url":"https://api.github.com/users/watson-developer-cloud/orgs","repos_url":"https://api.github.com/users/watson-developer-cloud/repos","events_url":"https://api.github.com/users/watson-developer-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/watson-developer-cloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/watson-developer-cloud/node-red-node-watson","description":"A collection of nodes for the IBM Watson services","fork":true,"url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson","forks_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/forks","keys_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/keys{/key_id}","collaborators_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/teams","hooks_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/hooks","issue_events_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/issues/events{/number}","events_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/events","assignees_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/assignees{/user}","branches_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/branches{/branch}","tags_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/tags","blobs_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/git/refs{/sha}","trees_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/git/trees{/sha}","statuses_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/statuses/{sha}","languages_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/languages","stargazers_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/stargazers","contributors_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/contributors","subscribers_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/subscribers","subscription_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/subscription","commits_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/commits{/sha}","git_commits_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/git/commits{/sha}","comments_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/comments{/number}","issue_comment_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/issues/comments{/number}","contents_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/contents/{+path}","compare_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/compare/{base}...{head}","merges_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/merges","archive_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/downloads","issues_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/issues{/number}","pulls_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls{/number}","milestones_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/milestones{/number}","notifications_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/labels{/name}","releases_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/releases{/id}","deployments_url":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/deployments","created_at":"2016-04-04T13:51:28Z","updated_at":"2016-05-25T01:15:25Z","pushed_at":"2016-05-25T22:54:27Z","git_url":"git://github.com/watson-developer-cloud/node-red-node-watson.git","ssh_url":"git@github.com:watson-developer-cloud/node-red-node-watson.git","clone_url":"https://github.com/watson-developer-cloud/node-red-node-watson.git","svn_url":"https://github.com/watson-developer-cloud/node-red-node-watson","homepage":null,"size":7789,"stargazers_count":5,"watchers_count":5,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":7,"forks":12,"open_issues":7,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls/88"},"html":{"href":"https://github.com/watson-developer-cloud/node-red-node-watson/pull/88"},"issue":{"href":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/issues/88"},"comments":{"href":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/issues/88/comments"},"review_comments":{"href":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls/88/comments"},"review_comment":{"href":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/pulls/88/commits"},"statuses":{"href":"https://api.github.com/repos/watson-developer-cloud/node-red-node-watson/statuses/90a268a916fd2d5d7364a3196d600c858535fbd2"}}}}
{"actor":{"display_login":"yrezgui"}}