Skip to content

Commit 0ae2b75

Browse files
committed
TTS and STT Nodes now use new url technique for service detection
1 parent ca596f2 commit 0ae2b75

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

services/speech_to_text/v1.js

+9-13
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,15 @@
1616

1717
module.exports = function (RED) {
1818
const SERVICE_IDENTIFIER = 'speech-to-text';
19-
var request = require('request');
20-
var cfenv = require('cfenv');
21-
var temp = require('temp');
22-
var url = require('url');
23-
var fs = require('fs');
24-
var fileType = require('file-type');
25-
//var watson = require('watson-developer-cloud');
26-
var serviceutils = require('../../utilities/service-utils');
27-
28-
var sttV1 = require('watson-developer-cloud/speech-to-text/v1');
29-
30-
//var service = cfenv.getAppEnv().getServiceCreds(/speech to text/i);
31-
var service = serviceutils.getServiceCreds(SERVICE_IDENTIFIER);
19+
var request = require('request'),
20+
cfenv = require('cfenv'),
21+
temp = require('temp'),
22+
url = require('url'),
23+
fs = require('fs'),
24+
fileType = require('file-type'),
25+
serviceutils = require('../../utilities/service-utils'),
26+
sttV1 = require('watson-developer-cloud/speech-to-text/v1'),
27+
service = serviceutils.getServiceCreds(SERVICE_IDENTIFIER);
3228

3329
// Require the Cloud Foundry Module to pull credentials from bound service
3430
// If they are found then the username and password will be stored in

services/text_to_speech/v1.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
module.exports = function(RED) {
1818
const SERVICE_IDENTIFIER = 'text-to-speech';
1919
var cfenv = require('cfenv');
20-
//var watson = require('watson-developer-cloud');
2120
var TextToSpeechV1 = require('watson-developer-cloud/text-to-speech/v1');
2221
var serviceutils = require('../../utilities/service-utils');
2322

@@ -48,12 +47,9 @@ module.exports = function(RED) {
4847

4948
// API used by widget to fetch available models
5049
RED.httpAdmin.get('/watson-text-to-speech/voices', function (req, res) {
51-
//var tts = watson.text_to_speech({
5250
var tts = new TextToSpeechV1({
5351
username: sUsername ? sUsername : req.query.un,
54-
password: sPassword ? sPassword : req.query.pwd //,
55-
//version: 'v1',
56-
//url: 'https://stream.watsonplatform.net/text-to-speech/api'
52+
password: sPassword ? sPassword : req.query.pwd
5753
});
5854

5955
tts.voices({}, function(err, voices){
@@ -88,12 +84,9 @@ module.exports = function(RED) {
8884
return;
8985
}
9086

91-
//var text_to_speech = watson.text_to_speech({
9287
var text_to_speech = new TextToSpeechV1({
9388
username: username,
94-
password: password //,
95-
//version: 'v1',
96-
//url: 'https://stream.watsonplatform.net/text-to-speech/api'
89+
password: password
9790
});
9891

9992
var params = {

0 commit comments

Comments
 (0)