Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / config / schedule / transcribe.js
index 40701fc..604677d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xddae=['transcribe','TranscribeService','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','Sentiment','Positive','SentimentScore','Negative','Mixed','FAILED','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Neutral','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','push','all','start','lodash','request-promise','util','../../mysqldb'];(function(_0x3000c1,_0x3c9eb3){var _0x45e12c=function(_0x31651d){while(--_0x31651d){_0x3000c1['push'](_0x3000c1['shift']());}};_0x45e12c(++_0x3c9eb3);}(_0xddae,0xd7));var _0xedda=function(_0x500649,_0x669569){_0x500649=_0x500649-0x0;var _0xec40d8=_0xddae[_0x500649];return _0xec40d8;};var _=require(_0xedda('0x0'));var AWS=require('aws-sdk');var rp=require(_0xedda('0x1'));var util=require(_0xedda('0x2'));var BPromise=require('bluebird');var db=require(_0xedda('0x3'))['db'];var logger=require('../../config/logger')(_0xedda('0x4'));function getTranscriptionJob(_0x4a17d4,_0x49f4c4,_0x536984,_0x5b7cd2){return new Promise(function(_0x4ae8fd,_0x3c15c5){var _0x279373=new AWS[(_0xedda('0x5'))]({'accessKeyId':_0x49f4c4,'secretAccessKey':_0x4a17d4,'region':_0x536984});_0x279373['getTranscriptionJob']({'TranscriptionJobName':_0x5b7cd2},function(_0x5c0080,_0x697a73){if(_0x5c0080){return _0x3c15c5(_0x5c0080);}else{return _0x4ae8fd(_0x697a73);}});});}function sentiment(_0x44502d,_0x84bf49,_0x585315,_0xf4550b,_0xd7864a){return new Promise(function(_0x57d913,_0xe5e86b){var _0x3a1eed=new AWS[(_0xedda('0x6'))]({'accessKeyId':_0x84bf49,'secretAccessKey':_0x44502d,'region':_0x585315});_0x3a1eed[_0xedda('0x7')]({'Text':_0xf4550b,'LanguageCode':_0xd7864a[_0xedda('0x8')](0x0,0x2)},function(_0x1fe9e2,_0x133143){if(_0x1fe9e2){return _0xe5e86b(_0x1fe9e2);}else{return _0x57d913(_0x133143);}});});}function checkTranscribeJob(_0xfd4f6c,_0x2779f5,_0x3aae3a){var _0x51e14f;return new BPromise(function(_0x3e27ed,_0x2ba455){logger['info'](util[_0xedda('0x9')](_0xedda('0xa'),_0xfd4f6c['id'],_0xfd4f6c[_0xedda('0xb')]));return getTranscriptionJob(_0x3aae3a['data1'],_0x3aae3a[_0xedda('0xc')],_0x2779f5['transcribeRegion'],_0xfd4f6c['transcribeName'])[_0xedda('0xd')](function(_0x2bfacb){logger[_0xedda('0xe')](util[_0xedda('0x9')](_0xedda('0xf'),_0xfd4f6c['id'],_0xfd4f6c[_0xedda('0xb')],_0x2bfacb[_0xedda('0x10')]['TranscriptionJobStatus']));if(!_0xfd4f6c[_0xedda('0x11')]){switch(_0x2bfacb['TranscriptionJob'][_0xedda('0x12')]){case _0xedda('0x13'):var _0x41969c={'transcribeStatus':_0x2bfacb[_0xedda('0x10')][_0xedda('0x12')],'fileUri':_0x2bfacb['TranscriptionJob'][_0xedda('0x14')][_0xedda('0x15')]};logger[_0xedda('0xe')](util[_0xedda('0x9')](_0xedda('0x16'),_0xfd4f6c['id']));return rp({'uri':_0x2bfacb[_0xedda('0x10')][_0xedda('0x14')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x30232e){logger[_0xedda('0xe')](util[_0xedda('0x9')](_0xedda('0x17'),_0xfd4f6c['id']));if(_0x30232e&&_0x30232e['results']&&_0x30232e[_0xedda('0x18')][_0xedda('0x19')]&&_0x30232e[_0xedda('0x18')][_0xedda('0x19')]['length']){_0x41969c[_0xedda('0x11')]='';for(var _0x5f1c8b=0x0;_0x5f1c8b<_0x30232e['results'][_0xedda('0x19')][_0xedda('0x1a')];_0x5f1c8b++){_0x41969c[_0xedda('0x11')]+=_0x30232e['results']['transcripts'][_0x5f1c8b][_0xedda('0x1b')]+'';}}return _0xfd4f6c[_0xedda('0x1c')](_0x41969c);})[_0xedda('0xd')](function(){logger[_0xedda('0xe')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xfd4f6c['id']));if(!_0xfd4f6c[_0xedda('0x1d')]){throw new db[(_0xedda('0x1e'))][(_0xedda('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2779f5[_0xedda('0x20')]||!_0x2779f5[_0xedda('0x21')]||!_0x2779f5['sentimentRegion']||!_0x2779f5[_0xedda('0x22')]||!_0x2779f5[_0xedda('0x23')]){throw new db[(_0xedda('0x1e'))][(_0xedda('0x1f'))](_0xedda('0x24'));}if(!_0x41969c[_0xedda('0x11')]){throw new Error(_0xedda('0x25'));}if(_0x2779f5['sentimentAccountId']===_0x3aae3a['id']){return _0x3aae3a;}else{return db[_0xedda('0x26')][_0xedda('0x27')]({'where':{'id':_settings[_0xedda('0x21')]}});}})[_0xedda('0xd')](function(_0xc66885){if(!_0xc66885){throw new db[(_0xedda('0x1e'))]['ValidationError'](_0xedda('0x28'));}if(!_0xc66885['data1']||!_0xc66885[_0xedda('0xc')]){throw new db[(_0xedda('0x1e'))][(_0xedda('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x51e14f=_0xc66885;logger['info'](util[_0xedda('0x9')](_0xedda('0x29'),_0xfd4f6c['id']));return sentiment(_0x51e14f[_0xedda('0x2a')],_0x51e14f[_0xedda('0xc')],_0x2779f5['sentimentRegion'],_0x41969c[_0xedda('0x11')],_0x2779f5['language']);})[_0xedda('0xd')](function(_0x5c12bc){logger[_0xedda('0xe')](util[_0xedda('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xfd4f6c['id']));return _0xfd4f6c[_0xedda('0x1c')]({'sentiment':_0x5c12bc[_0xedda('0x2b')],'sPositive':_0x5c12bc['SentimentScore'][_0xedda('0x2c')],'sNegative':_0x5c12bc[_0xedda('0x2d')][_0xedda('0x2e')],'sMixed':_0x5c12bc[_0xedda('0x2d')][_0xedda('0x2f')],'sNeutral':_0x5c12bc[_0xedda('0x2d')]['Neutral']});})[_0xedda('0xd')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xfd4f6c['id']));_0x3e27ed();});case _0xedda('0x30'):return _0xfd4f6c[_0xedda('0x1c')]({'transcribeStatus':_0xedda('0x30'),'failureReason':_0x2bfacb[_0xedda('0x10')]['FailureReason']})[_0xedda('0xd')](function(){logger[_0xedda('0xe')](util[_0xedda('0x9')](_0xedda('0x31'),_0xfd4f6c['id']));_0x3e27ed();});default:logger['info'](util['format'](_0xedda('0x32'),_0xfd4f6c['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0xfd4f6c[_0xedda('0x1d')]){throw new db['Sequelize']['ValidationError'](_0xedda('0x33'));}if(!_0x2779f5[_0xedda('0x20')]||!_0x2779f5[_0xedda('0x21')]||!_0x2779f5[_0xedda('0x34')]||!_0x2779f5[_0xedda('0x22')]||!_0x2779f5[_0xedda('0x23')]){throw new db[(_0xedda('0x1e'))]['ValidationError'](_0xedda('0x24'));}if(!_0xfd4f6c[_0xedda('0x11')]){throw new Error(_0xedda('0x25'));}if(_0x2779f5['sentimentAccountId']===_0x3aae3a['id']){return _0x3aae3a;}else{return db[_0xedda('0x26')][_0xedda('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xedda('0xd')](function(_0x425f74){if(!_0x425f74){throw new db[(_0xedda('0x1e'))]['ValidationError'](_0xedda('0x28'));}if(!_0x425f74[_0xedda('0x2a')]||!_0x425f74['data2']){throw new db[(_0xedda('0x1e'))][(_0xedda('0x1f'))](_0xedda('0x35'));}_0x51e14f=_0x425f74;logger[_0xedda('0xe')](util['format'](_0xedda('0x29'),_0xfd4f6c['id']));return sentiment(_0x51e14f['data1'],_0x51e14f['data2'],_0x2779f5['sentimentRegion'],_0xfd4f6c[_0xedda('0x11')],_0x2779f5[_0xedda('0x22')]);})[_0xedda('0xd')](function(_0x992bf){logger[_0xedda('0xe')](util[_0xedda('0x9')](_0xedda('0x36'),_0xfd4f6c['id']));return _0xfd4f6c[_0xedda('0x1c')]({'sentiment':_0x992bf['Sentiment'],'sPositive':_0x992bf[_0xedda('0x2d')][_0xedda('0x2c')],'sNegative':_0x992bf[_0xedda('0x2d')]['Negative'],'sMixed':_0x992bf[_0xedda('0x2d')][_0xedda('0x2f')],'sNeutral':_0x992bf[_0xedda('0x2d')][_0xedda('0x37')],'transcribeStatus':_0xedda('0x13')});})['then'](function(){logger['info'](util[_0xedda('0x9')](_0xedda('0x31'),_0xfd4f6c['id']));_0x3e27ed();});}})[_0xedda('0x38')](function(_0x398e93){if(_0x398e93){if(!_0x398e93[_0xedda('0x39')]||_0x398e93[_0xedda('0x39')]!==_0xedda('0x3a')){logger[_0xedda('0x3b')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0xfd4f6c['id']),util[_0xedda('0x3c')](_0x398e93,{'showHidden':![],'depth':null}));}}_0x3e27ed();});});}function checkTranscribe(){var _0x2e25b9;var _0x4dc796;var _0x21645b;return db[_0xedda('0x3d')][_0xedda('0x3e')]({'where':{'transcribeStatus':_0xedda('0x3f')}})[_0xedda('0xd')](function(_0x164911){if(!_0x164911||!_0x164911[_0xedda('0x1a')]){throw new db[(_0xedda('0x1e'))][(_0xedda('0x1f'))](_0xedda('0x40'));}_0x2e25b9=_0x164911;return db[_0xedda('0x41')]['findOne']({'where':{'id':0x1}});})[_0xedda('0xd')](function(_0xd260a2){if(!_0xd260a2){throw new db[(_0xedda('0x1e'))]['ValidationError'](_0xedda('0x42'));}_0x4dc796=_0xd260a2;if(!_0x4dc796[_0xedda('0x4')]||!_0x4dc796[_0xedda('0x43')]||!_0x4dc796[_0xedda('0x44')]||!_0x4dc796[_0xedda('0x22')]||!_0x4dc796['bucket']){throw new db[(_0xedda('0x1e'))]['ValidationError'](_0xedda('0x45'));}return db[_0xedda('0x26')]['findOne']({'where':{'id':_0x4dc796[_0xedda('0x43')]}});})[_0xedda('0xd')](function(_0x8ffc1){if(!_0x8ffc1){throw new db[(_0xedda('0x1e'))]['ValidationError'](_0xedda('0x28'));}if(!_0x8ffc1[_0xedda('0x2a')]||!_0x8ffc1[_0xedda('0xc')]){throw new db['Sequelize']['ValidationError'](_0xedda('0x35'));}_0x21645b=_0x8ffc1;var _0x3bd6f9=[];_0x2e25b9['forEach'](function(_0x375d5e){_0x3bd6f9[_0xedda('0x46')](checkTranscribeJob(_0x375d5e,_0x4dc796,_0x21645b));});return BPromise[_0xedda('0x47')](_0x3bd6f9);})[_0xedda('0x38')](function(_0x3dd288){if(_0x3dd288){if(!_0x3dd288[_0xedda('0x39')]||_0x3dd288[_0xedda('0x39')]!==_0xedda('0x3a')){logger[_0xedda('0x3b')](util[_0xedda('0x3c')](_0x3dd288,{'showHidden':![],'depth':null}));}}});}exports[_0xedda('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
+var _0x56c8=['transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','error','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Neutral','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x56c8,0x12f));var _0x856c=function(_0x2f7dee,_0x27b0b1){_0x2f7dee=_0x2f7dee-0x0;var _0x5c48ee=_0x56c8[_0x2f7dee];return _0x5c48ee;};var _=require(_0x856c('0x0'));var AWS=require(_0x856c('0x1'));var rp=require(_0x856c('0x2'));var util=require(_0x856c('0x3'));var BPromise=require('bluebird');var db=require(_0x856c('0x4'))['db'];var logger=require(_0x856c('0x5'))(_0x856c('0x6'));function getTranscriptionJob(_0xd0f4b3,_0x2a1b07,_0x5888ad,_0x2608a5){return new Promise(function(_0x1922f4,_0x413964){var _0x15a17c=new AWS[(_0x856c('0x7'))]({'accessKeyId':_0x2a1b07,'secretAccessKey':_0xd0f4b3,'region':_0x5888ad});_0x15a17c[_0x856c('0x8')]({'TranscriptionJobName':_0x2608a5},function(_0x48d81b,_0x5064ef){if(_0x48d81b){return _0x413964(_0x48d81b);}else{return _0x1922f4(_0x5064ef);}});});}function sentiment(_0x2822ca,_0x17ac74,_0xa2bd07,_0x4c173b,_0x4b8bbc){return new Promise(function(_0x56217b,_0x619489){var _0x36e8ef=new AWS[(_0x856c('0x9'))]({'accessKeyId':_0x17ac74,'secretAccessKey':_0x2822ca,'region':_0xa2bd07});_0x36e8ef['detectSentiment']({'Text':_0x4c173b,'LanguageCode':_0x4b8bbc[_0x856c('0xa')](0x0,0x2)},function(_0xf65022,_0x4f7d31){if(_0xf65022){return _0x619489(_0xf65022);}else{return _0x56217b(_0x4f7d31);}});});}function checkTranscribeJob(_0x2539a6,_0x117c1a,_0x326656){var _0x28c3d4;return new BPromise(function(_0x3dad74,_0x288d44){logger[_0x856c('0xb')](util[_0x856c('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x2539a6['id'],_0x2539a6[_0x856c('0xd')]));return getTranscriptionJob(_0x326656['data1'],_0x326656[_0x856c('0xe')],_0x117c1a[_0x856c('0xf')],_0x2539a6[_0x856c('0xd')])[_0x856c('0x10')](function(_0x6856e5){logger[_0x856c('0xb')](util[_0x856c('0xc')](_0x856c('0x11'),_0x2539a6['id'],_0x2539a6[_0x856c('0xd')],_0x6856e5[_0x856c('0x12')][_0x856c('0x13')]));if(!_0x2539a6[_0x856c('0x14')]){switch(_0x6856e5[_0x856c('0x12')][_0x856c('0x13')]){case _0x856c('0x15'):var _0x27c7cc={'transcribeStatus':_0x6856e5[_0x856c('0x12')][_0x856c('0x13')],'fileUri':_0x6856e5[_0x856c('0x12')][_0x856c('0x16')][_0x856c('0x17')]};logger[_0x856c('0xb')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x2539a6['id']));return rp({'uri':_0x6856e5[_0x856c('0x12')][_0x856c('0x16')][_0x856c('0x17')],'json':!![]})['then'](function(_0x120bc2){logger['info'](util[_0x856c('0xc')](_0x856c('0x18'),_0x2539a6['id']));if(_0x120bc2&&_0x120bc2[_0x856c('0x19')]&&_0x120bc2['results'][_0x856c('0x1a')]&&_0x120bc2[_0x856c('0x19')][_0x856c('0x1a')][_0x856c('0x1b')]){_0x27c7cc[_0x856c('0x14')]='';for(var _0x3b2f35=0x0;_0x3b2f35<_0x120bc2['results'][_0x856c('0x1a')][_0x856c('0x1b')];_0x3b2f35++){_0x27c7cc[_0x856c('0x14')]+=_0x120bc2['results'][_0x856c('0x1a')][_0x3b2f35]['transcript']+'';}}return _0x2539a6[_0x856c('0x1c')](_0x27c7cc);})['then'](function(){logger[_0x856c('0xb')](util[_0x856c('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2539a6['id']));if(!_0x2539a6[_0x856c('0x1d')]){throw new db['Sequelize'][(_0x856c('0x1e'))](_0x856c('0x1f'));}if(!_0x117c1a[_0x856c('0x20')]||!_0x117c1a['sentimentAccountId']||!_0x117c1a[_0x856c('0x21')]||!_0x117c1a[_0x856c('0x22')]||!_0x117c1a[_0x856c('0x23')]){throw new db['Sequelize']['ValidationError'](_0x856c('0x24'));}if(!_0x27c7cc[_0x856c('0x14')]){throw new Error(_0x856c('0x25'));}if(_0x117c1a[_0x856c('0x26')]===_0x326656['id']){return _0x326656;}else{return db[_0x856c('0x27')][_0x856c('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x856c('0x10')](function(_0x866950){if(!_0x866950){throw new db[(_0x856c('0x29'))][(_0x856c('0x1e'))](_0x856c('0x2a'));}if(!_0x866950[_0x856c('0x2b')]||!_0x866950['data2']){throw new db[(_0x856c('0x29'))][(_0x856c('0x1e'))](_0x856c('0x2c'));}_0x28c3d4=_0x866950;logger['info'](util[_0x856c('0xc')](_0x856c('0x2d'),_0x2539a6['id']));return sentiment(_0x28c3d4['data1'],_0x28c3d4[_0x856c('0xe')],_0x117c1a[_0x856c('0x21')],_0x27c7cc[_0x856c('0x14')],_0x117c1a[_0x856c('0x22')]);})[_0x856c('0x10')](function(_0x592a4c){logger[_0x856c('0xb')](util[_0x856c('0xc')](_0x856c('0x2e'),_0x2539a6['id']));return _0x2539a6[_0x856c('0x1c')]({'sentiment':_0x592a4c[_0x856c('0x2f')],'sPositive':_0x592a4c[_0x856c('0x30')][_0x856c('0x31')],'sNegative':_0x592a4c[_0x856c('0x30')][_0x856c('0x32')],'sMixed':_0x592a4c[_0x856c('0x30')][_0x856c('0x33')],'sNeutral':_0x592a4c[_0x856c('0x30')]['Neutral']});})['then'](function(){logger[_0x856c('0xb')](util['format'](_0x856c('0x34'),_0x2539a6['id']));_0x3dad74();});case _0x856c('0x35'):return _0x2539a6[_0x856c('0x1c')]({'transcribeStatus':_0x856c('0x35'),'failureReason':_0x6856e5[_0x856c('0x12')]['FailureReason']})[_0x856c('0x10')](function(){logger[_0x856c('0xb')](util[_0x856c('0xc')](_0x856c('0x34'),_0x2539a6['id']));_0x3dad74();});default:logger[_0x856c('0xb')](util['format'](_0x856c('0x36'),_0x2539a6['id']));break;}}else{return BPromise[_0x856c('0x37')]()[_0x856c('0x10')](function(){if(!_0x2539a6[_0x856c('0x1d')]){throw new db[(_0x856c('0x29'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x117c1a[_0x856c('0x20')]||!_0x117c1a[_0x856c('0x26')]||!_0x117c1a[_0x856c('0x21')]||!_0x117c1a['language']||!_0x117c1a[_0x856c('0x23')]){throw new db[(_0x856c('0x29'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2539a6[_0x856c('0x14')]){throw new Error(_0x856c('0x25'));}if(_0x117c1a[_0x856c('0x26')]===_0x326656['id']){return _0x326656;}else{return db[_0x856c('0x27')][_0x856c('0x28')]({'where':{'id':_settings[_0x856c('0x26')]}});}})[_0x856c('0x10')](function(_0x4da144){if(!_0x4da144){throw new db['Sequelize'][(_0x856c('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4da144[_0x856c('0x2b')]||!_0x4da144[_0x856c('0xe')]){throw new db[(_0x856c('0x29'))][(_0x856c('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x28c3d4=_0x4da144;logger[_0x856c('0xb')](util[_0x856c('0xc')](_0x856c('0x2d'),_0x2539a6['id']));return sentiment(_0x28c3d4[_0x856c('0x2b')],_0x28c3d4[_0x856c('0xe')],_0x117c1a[_0x856c('0x21')],_0x2539a6[_0x856c('0x14')],_0x117c1a[_0x856c('0x22')]);})['then'](function(_0x145d20){logger[_0x856c('0xb')](util[_0x856c('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x2539a6['id']));return _0x2539a6[_0x856c('0x1c')]({'sentiment':_0x145d20[_0x856c('0x2f')],'sPositive':_0x145d20[_0x856c('0x30')]['Positive'],'sNegative':_0x145d20[_0x856c('0x30')][_0x856c('0x32')],'sMixed':_0x145d20['SentimentScore'][_0x856c('0x33')],'sNeutral':_0x145d20[_0x856c('0x30')][_0x856c('0x38')],'transcribeStatus':_0x856c('0x15')});})[_0x856c('0x10')](function(){logger[_0x856c('0xb')](util[_0x856c('0xc')](_0x856c('0x34'),_0x2539a6['id']));_0x3dad74();});}})[_0x856c('0x39')](function(_0x2826d7){if(_0x2826d7){if(!_0x2826d7[_0x856c('0x3a')]||_0x2826d7[_0x856c('0x3a')]!==_0x856c('0x3b')){logger['error'](util[_0x856c('0xc')](_0x856c('0x3c'),_0x2539a6['id']),util[_0x856c('0x3d')](_0x2826d7,{'showHidden':![],'depth':null}));}}_0x3dad74();});});}function checkTranscribe(){var _0x9e9f27;var _0x23d403;var _0x24d009;return db['VoiceRecording'][_0x856c('0x3e')]({'where':{'transcribeStatus':_0x856c('0x3f')}})[_0x856c('0x10')](function(_0x28e0b4){if(!_0x28e0b4||!_0x28e0b4['length']){throw new db[(_0x856c('0x29'))]['ValidationError'](_0x856c('0x40'));}_0x9e9f27=_0x28e0b4;return db[_0x856c('0x41')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x30fa12){if(!_0x30fa12){throw new db['Sequelize']['ValidationError'](_0x856c('0x42'));}_0x23d403=_0x30fa12;if(!_0x23d403[_0x856c('0x6')]||!_0x23d403[_0x856c('0x43')]||!_0x23d403[_0x856c('0xf')]||!_0x23d403[_0x856c('0x22')]||!_0x23d403[_0x856c('0x23')]){throw new db[(_0x856c('0x29'))][(_0x856c('0x1e'))](_0x856c('0x44'));}return db[_0x856c('0x27')]['findOne']({'where':{'id':_0x23d403[_0x856c('0x43')]}});})[_0x856c('0x10')](function(_0x4b1955){if(!_0x4b1955){throw new db[(_0x856c('0x29'))]['ValidationError'](_0x856c('0x2a'));}if(!_0x4b1955['data1']||!_0x4b1955[_0x856c('0xe')]){throw new db[(_0x856c('0x29'))][(_0x856c('0x1e'))](_0x856c('0x2c'));}_0x24d009=_0x4b1955;var _0xb4e351=[];_0x9e9f27[_0x856c('0x45')](function(_0x5c38dc){_0xb4e351[_0x856c('0x46')](checkTranscribeJob(_0x5c38dc,_0x23d403,_0x24d009));});return BPromise[_0x856c('0x47')](_0xb4e351);})[_0x856c('0x39')](function(_0x200547){if(_0x200547){if(!_0x200547[_0x856c('0x3a')]||_0x200547[_0x856c('0x3a')]!==_0x856c('0x3b')){logger[_0x856c('0x48')](util[_0x856c('0x3d')](_0x200547,{'showHidden':![],'depth':null}));}}});}exports[_0x856c('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file