c0e3fd1c7635c6518368618584455cf454d46ab0
[motion-next.git] / server / services / agi / scripts / aws / polly / lib / api.js
1 const a1037_0x463f=['synthesizeSpeech','No\x20data\x20response\x20from\x20aws\x20Polly!','text','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','mp3','exports'];(function(_0x3e4455,_0x463f11){const _0x2ae4ce=function(_0x7d4228){while(--_0x7d4228){_0x3e4455['push'](_0x3e4455['shift']());}};_0x2ae4ce(++_0x463f11);}(a1037_0x463f,0x8b));const a1037_0x2ae4=function(_0x3e4455,_0x463f11){_0x3e4455=_0x3e4455-0x0;let _0x2ae4ce=a1037_0x463f[_0x3e4455];return _0x2ae4ce;};const _0xaf17da=a1037_0x2ae4;'use strict';const fs=require('fs'),AWS=require('aws-sdk');function pollyResult(_0x7d4228,_0x188419,_0x50d95d){return new Promise(function(_0x29450a,_0x71d7ca){const _0x52d2f6=a1037_0x2ae4;_0x7d4228[_0x52d2f6('0x1')](_0x188419,function(_0x17a991,_0x3f5971){const _0x35b153=_0x52d2f6;if(_0x17a991)_0x71d7ca(_0x17a991);else _0x3f5971?_0x3f5971['AudioStream']instanceof Buffer?fs['writeFile'](_0x50d95d,_0x3f5971[_0x35b153('0x4')],function(_0x487c16){_0x487c16?_0x71d7ca(_0x487c16):_0x29450a();}):_0x71d7ca(new Error(_0x35b153('0x5'))):_0x71d7ca(new Error(_0x35b153('0x2')));});});}module[_0xaf17da('0x0')]=function(_0x54b88a,_0x2beb2d,_0x48a482,_0x471d5b,_0x2709d9,_0x176670,_0x39b30b){const _0x70b39=_0xaf17da,_0x22d2a8=new AWS['Polly']({'accessKeyId':_0x54b88a,'secretAccessKey':_0x2beb2d,'region':_0x48a482}),_0x3d2790={'Text':_0x2709d9,'TextType':_0x176670||_0x70b39('0x3'),'OutputFormat':_0x70b39('0x6'),'VoiceId':_0x471d5b};return pollyResult(_0x22d2a8,_0x3d2790,_0x39b30b);};