Built motion from commit cb845558.|2.6.34
[motion2.git] / server / config / schedule / transcribe.js
index 84aabee..ccf554d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8eba=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','lodash','aws-sdk','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript'];(function(_0x333bbf,_0x46babc){var _0x24e3ff=function(_0x22cd7f){while(--_0x22cd7f){_0x333bbf['push'](_0x333bbf['shift']());}};_0x24e3ff(++_0x46babc);}(_0x8eba,0xc3));var _0xa8eb=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x8eba[_0x1cd47d];return _0x29d52f;};var _=require(_0xa8eb('0x0'));var AWS=require(_0xa8eb('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0xa8eb('0x2'))['db'];var logger=require(_0xa8eb('0x3'))(_0xa8eb('0x4'));function getTranscriptionJob(_0x2cdf40,_0x52533a,_0x3a665b,_0x187bf0){return new Promise(function(_0x5abab9,_0x321f2f){var _0x5ece80=new AWS[(_0xa8eb('0x5'))]({'accessKeyId':_0x52533a,'secretAccessKey':_0x2cdf40,'region':_0x3a665b});_0x5ece80[_0xa8eb('0x6')]({'TranscriptionJobName':_0x187bf0},function(_0x509b54,_0x8b2ae9){if(_0x509b54){return _0x321f2f(_0x509b54);}else{return _0x5abab9(_0x8b2ae9);}});});}function sentiment(_0x5d6360,_0x21e416,_0x3010d0,_0x5eb605,_0x47032d){return new Promise(function(_0x796060,_0x3e45e7){var _0x4693d6=new AWS['Comprehend']({'accessKeyId':_0x21e416,'secretAccessKey':_0x5d6360,'region':_0x3010d0});_0x4693d6[_0xa8eb('0x7')]({'Text':_0x5eb605,'LanguageCode':_0x47032d['substring'](0x0,0x2)},function(_0x20a4ca,_0x501134){if(_0x20a4ca){return _0x3e45e7(_0x20a4ca);}else{return _0x796060(_0x501134);}});});}function checkTranscribeJob(_0x193a53,_0x47149c,_0x5b21fc){var _0x2c7cff;return new BPromise(function(_0x490c4f,_0x289ed3){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0xa'),_0x193a53['id'],_0x193a53['transcribeName']));return getTranscriptionJob(_0x5b21fc[_0xa8eb('0xb')],_0x5b21fc['data2'],_0x47149c[_0xa8eb('0xc')],_0x193a53[_0xa8eb('0xd')])[_0xa8eb('0xe')](function(_0x102a81){logger['info'](util[_0xa8eb('0x9')](_0xa8eb('0xf'),_0x193a53['id'],_0x193a53[_0xa8eb('0xd')],_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')]));if(!_0x193a53['fileText']){switch(_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')]){case _0xa8eb('0x12'):var _0x445cc6={'transcribeStatus':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')],'fileUri':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x13')]['TranscriptFileUri']};logger['info'](util['format'](_0xa8eb('0x14'),_0x193a53['id']));return rp({'uri':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x13')]['TranscriptFileUri'],'json':!![]})[_0xa8eb('0xe')](function(_0x1025ef){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x15'),_0x193a53['id']));if(_0x1025ef&&_0x1025ef[_0xa8eb('0x16')]&&_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')]&&_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')][_0xa8eb('0x18')]){_0x445cc6[_0xa8eb('0x19')]='';for(var _0xee9db2=0x0;_0xee9db2<_0x1025ef['results'][_0xa8eb('0x17')][_0xa8eb('0x18')];_0xee9db2++){_0x445cc6[_0xa8eb('0x19')]+=_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')][_0xee9db2]['transcript']+'';}}return _0x193a53[_0xa8eb('0x1a')](_0x445cc6);})[_0xa8eb('0xe')](function(){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x1b'),_0x193a53['id']));if(!_0x193a53['tempSentiment']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x1d'));}if(!_0x47149c[_0xa8eb('0x1e')]||!_0x47149c[_0xa8eb('0x1f')]||!_0x47149c[_0xa8eb('0x20')]||!_0x47149c['language']||!_0x47149c[_0xa8eb('0x21')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x23'));}if(!_0x445cc6[_0xa8eb('0x19')]){throw new Error(_0xa8eb('0x24'));}if(_0x47149c[_0xa8eb('0x1f')]===_0x5b21fc['id']){return _0x5b21fc;}else{return db['CloudProvider'][_0xa8eb('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xa8eb('0xe')](function(_0xdd5171){if(!_0xdd5171){throw new db['Sequelize'][(_0xa8eb('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xdd5171[_0xa8eb('0xb')]||!_0xdd5171[_0xa8eb('0x26')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0x2c7cff=_0xdd5171;logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x27'),_0x193a53['id']));return sentiment(_0x2c7cff[_0xa8eb('0xb')],_0x2c7cff[_0xa8eb('0x26')],_0x47149c[_0xa8eb('0x20')],_0x445cc6['fileText'],_0x47149c[_0xa8eb('0x28')]);})['then'](function(_0x4a2a65){logger['info'](util[_0xa8eb('0x9')](_0xa8eb('0x29'),_0x193a53['id']));return _0x193a53[_0xa8eb('0x1a')]({'sentiment':_0x4a2a65[_0xa8eb('0x2a')],'sPositive':_0x4a2a65[_0xa8eb('0x2b')]['Positive'],'sNegative':_0x4a2a65['SentimentScore'][_0xa8eb('0x2c')],'sMixed':_0x4a2a65[_0xa8eb('0x2b')][_0xa8eb('0x2d')],'sNeutral':_0x4a2a65[_0xa8eb('0x2b')][_0xa8eb('0x2e')]});})['then'](function(){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x1b'),_0x193a53['id']));_0x490c4f();});case'FAILED':return _0x193a53[_0xa8eb('0x1a')]({'transcribeStatus':_0xa8eb('0x2f'),'failureReason':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x30')]})['then'](function(){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x1b'),_0x193a53['id']));_0x490c4f();});default:logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x31'),_0x193a53['id']));break;}}else{return BPromise['resolve']()[_0xa8eb('0xe')](function(){if(!_0x193a53[_0xa8eb('0x32')]){throw new db['Sequelize'][(_0xa8eb('0x1c'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x47149c[_0xa8eb('0x1e')]||!_0x47149c[_0xa8eb('0x1f')]||!_0x47149c[_0xa8eb('0x20')]||!_0x47149c['language']||!_0x47149c[_0xa8eb('0x21')]){throw new db['Sequelize']['ValidationError'](_0xa8eb('0x23'));}if(!_0x193a53[_0xa8eb('0x19')]){throw new Error('Transcript\x20not\x20available');}if(_0x47149c[_0xa8eb('0x1f')]===_0x5b21fc['id']){return _0x5b21fc;}else{return db[_0xa8eb('0x33')][_0xa8eb('0x25')]({'where':{'id':_settings[_0xa8eb('0x1f')]}});}})[_0xa8eb('0xe')](function(_0x141986){if(!_0x141986){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x34'));}if(!_0x141986[_0xa8eb('0xb')]||!_0x141986['data2']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x35'));}_0x2c7cff=_0x141986;logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x27'),_0x193a53['id']));return sentiment(_0x2c7cff[_0xa8eb('0xb')],_0x2c7cff[_0xa8eb('0x26')],_0x47149c[_0xa8eb('0x20')],_0x193a53['fileText'],_0x47149c['language']);})[_0xa8eb('0xe')](function(_0x1548b5){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x29'),_0x193a53['id']));return _0x193a53[_0xa8eb('0x1a')]({'sentiment':_0x1548b5[_0xa8eb('0x2a')],'sPositive':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x36')],'sNegative':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x2c')],'sMixed':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x2d')],'sNeutral':_0x1548b5['SentimentScore'][_0xa8eb('0x2e')],'transcribeStatus':'COMPLETED'});})[_0xa8eb('0xe')](function(){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x193a53['id']));_0x490c4f();});}})[_0xa8eb('0x37')](function(_0x1b3c2b){if(_0x1b3c2b){if(!_0x1b3c2b[_0xa8eb('0x38')]||_0x1b3c2b[_0xa8eb('0x38')]!==_0xa8eb('0x39')){logger[_0xa8eb('0x3a')](util[_0xa8eb('0x9')](_0xa8eb('0x3b'),_0x193a53['id']),util[_0xa8eb('0x3c')](_0x1b3c2b,{'showHidden':![],'depth':null}));}}_0x490c4f();});});}function checkTranscribe(){var _0x54ae6b;var _0x481560;var _0x273fd0;return db[_0xa8eb('0x3d')][_0xa8eb('0x3e')]({'where':{'transcribeStatus':_0xa8eb('0x3f')}})['then'](function(_0x53dc8a){if(!_0x53dc8a||!_0x53dc8a['length']){throw new db[(_0xa8eb('0x22'))]['ValidationError'](_0xa8eb('0x40'));}_0x54ae6b=_0x53dc8a;return db[_0xa8eb('0x41')][_0xa8eb('0x25')]({'where':{'id':0x1}});})[_0xa8eb('0xe')](function(_0x31b4f7){if(!_0x31b4f7){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x42'));}_0x481560=_0x31b4f7;if(!_0x481560[_0xa8eb('0x4')]||!_0x481560[_0xa8eb('0x43')]||!_0x481560[_0xa8eb('0xc')]||!_0x481560[_0xa8eb('0x28')]||!_0x481560[_0xa8eb('0x21')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x44'));}return db[_0xa8eb('0x33')]['findOne']({'where':{'id':_0x481560['transcribeAccountId']}});})[_0xa8eb('0xe')](function(_0x5edfbe){if(!_0x5edfbe){throw new db[(_0xa8eb('0x22'))]['ValidationError'](_0xa8eb('0x34'));}if(!_0x5edfbe[_0xa8eb('0xb')]||!_0x5edfbe['data2']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x35'));}_0x273fd0=_0x5edfbe;var _0x1251cd=[];_0x54ae6b[_0xa8eb('0x45')](function(_0x3a52d2){_0x1251cd[_0xa8eb('0x46')](checkTranscribeJob(_0x3a52d2,_0x481560,_0x273fd0));});return BPromise[_0xa8eb('0x47')](_0x1251cd);})[_0xa8eb('0x37')](function(_0x18e535){if(_0x18e535){if(!_0x18e535[_0xa8eb('0x38')]||_0x18e535[_0xa8eb('0x38')]!==_0xa8eb('0x39')){logger[_0xa8eb('0x3a')](util[_0xa8eb('0x3c')](_0x18e535,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
+var _0xe6d7=['IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','findOne','transcribeAccountId','transcribeRegion','forEach','push','all','SequelizeValidationError','start','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentimentRegion','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x2ced2c,_0x2aa7a5){_0x2ced2c=_0x2ced2c-0x0;var _0x1b10f6=_0xe6d7[_0x2ced2c];return _0x1b10f6;};var _=require('lodash');var AWS=require(_0x7e6d('0x0'));var rp=require('request-promise');var util=require(_0x7e6d('0x1'));var BPromise=require(_0x7e6d('0x2'));var db=require(_0x7e6d('0x3'))['db'];var logger=require(_0x7e6d('0x4'))('transcribe');function getTranscriptionJob(_0xcef693,_0x4edd64,_0x4b0ffd,_0x1c4de4){return new Promise(function(_0x23c09e,_0x4faafe){var _0x344697=new AWS[(_0x7e6d('0x5'))]({'accessKeyId':_0x4edd64,'secretAccessKey':_0xcef693,'region':_0x4b0ffd});_0x344697[_0x7e6d('0x6')]({'TranscriptionJobName':_0x1c4de4},function(_0x30eb06,_0x44d906){if(_0x30eb06){return _0x4faafe(_0x30eb06);}else{return _0x23c09e(_0x44d906);}});});}function sentiment(_0x285e8e,_0x215c69,_0x2ffe91,_0x456776,_0x544ba5){return new Promise(function(_0x4a01c2,_0x4147f9){var _0x3c892f=new AWS[(_0x7e6d('0x7'))]({'accessKeyId':_0x215c69,'secretAccessKey':_0x285e8e,'region':_0x2ffe91});_0x3c892f[_0x7e6d('0x8')]({'Text':_0x456776,'LanguageCode':_0x544ba5['substring'](0x0,0x2)},function(_0x3ef08e,_0x24b89b){if(_0x3ef08e){return _0x4147f9(_0x3ef08e);}else{return _0x4a01c2(_0x24b89b);}});});}function checkTranscribeJob(_0x5bc7b5,_0x314a07,_0x20ef11){var _0x39fc7d;return new BPromise(function(_0x3e47fc,_0x154045){logger[_0x7e6d('0x9')](util[_0x7e6d('0xa')](_0x7e6d('0xb'),_0x5bc7b5['id'],_0x5bc7b5[_0x7e6d('0xc')]));return getTranscriptionJob(_0x20ef11[_0x7e6d('0xd')],_0x20ef11['data2'],_0x314a07['transcribeRegion'],_0x5bc7b5[_0x7e6d('0xc')])[_0x7e6d('0xe')](function(_0x5ef607){logger[_0x7e6d('0x9')](util['format'](_0x7e6d('0xf'),_0x5bc7b5['id'],_0x5bc7b5[_0x7e6d('0xc')],_0x5ef607[_0x7e6d('0x10')][_0x7e6d('0x11')]));if(!_0x5bc7b5['fileText']){switch(_0x5ef607[_0x7e6d('0x10')][_0x7e6d('0x11')]){case'COMPLETED':var _0x201382={'transcribeStatus':_0x5ef607[_0x7e6d('0x10')][_0x7e6d('0x11')],'fileUri':_0x5ef607[_0x7e6d('0x10')]['Transcript'][_0x7e6d('0x12')]};logger[_0x7e6d('0x9')](util[_0x7e6d('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x5bc7b5['id']));return rp({'uri':_0x5ef607[_0x7e6d('0x10')][_0x7e6d('0x13')][_0x7e6d('0x12')],'json':!![]})[_0x7e6d('0xe')](function(_0x554768){logger[_0x7e6d('0x9')](util[_0x7e6d('0xa')](_0x7e6d('0x14'),_0x5bc7b5['id']));if(_0x554768&&_0x554768['results']&&_0x554768[_0x7e6d('0x15')][_0x7e6d('0x16')]&&_0x554768[_0x7e6d('0x15')][_0x7e6d('0x16')][_0x7e6d('0x17')]){_0x201382[_0x7e6d('0x18')]='';for(var _0x3edbef=0x0;_0x3edbef<_0x554768[_0x7e6d('0x15')][_0x7e6d('0x16')][_0x7e6d('0x17')];_0x3edbef++){_0x201382[_0x7e6d('0x18')]+=_0x554768[_0x7e6d('0x15')][_0x7e6d('0x16')][_0x3edbef][_0x7e6d('0x19')]+'';}}return _0x5bc7b5[_0x7e6d('0x1a')](_0x201382);})[_0x7e6d('0xe')](function(){logger['info'](util['format'](_0x7e6d('0x1b'),_0x5bc7b5['id']));if(!_0x5bc7b5[_0x7e6d('0x1c')]){throw new db['Sequelize'][(_0x7e6d('0x1d'))](_0x7e6d('0x1e'));}if(!_0x314a07[_0x7e6d('0x1f')]||!_0x314a07[_0x7e6d('0x20')]||!_0x314a07['sentimentRegion']||!_0x314a07[_0x7e6d('0x21')]||!_0x314a07[_0x7e6d('0x22')]){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))](_0x7e6d('0x24'));}if(!_0x201382[_0x7e6d('0x18')]){throw new Error(_0x7e6d('0x25'));}if(_0x314a07[_0x7e6d('0x20')]===_0x20ef11['id']){return _0x20ef11;}else{return db[_0x7e6d('0x26')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x7e6d('0xe')](function(_0x159e7d){if(!_0x159e7d){throw new db['Sequelize']['ValidationError'](_0x7e6d('0x27'));}if(!_0x159e7d[_0x7e6d('0xd')]||!_0x159e7d['data2']){throw new db['Sequelize']['ValidationError'](_0x7e6d('0x28'));}_0x39fc7d=_0x159e7d;logger[_0x7e6d('0x9')](util[_0x7e6d('0xa')](_0x7e6d('0x29'),_0x5bc7b5['id']));return sentiment(_0x39fc7d[_0x7e6d('0xd')],_0x39fc7d[_0x7e6d('0x2a')],_0x314a07['sentimentRegion'],_0x201382['fileText'],_0x314a07[_0x7e6d('0x21')]);})[_0x7e6d('0xe')](function(_0x1e4a5f){logger['info'](util[_0x7e6d('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5bc7b5['id']));return _0x5bc7b5[_0x7e6d('0x1a')]({'sentiment':_0x1e4a5f[_0x7e6d('0x2b')],'sPositive':_0x1e4a5f[_0x7e6d('0x2c')][_0x7e6d('0x2d')],'sNegative':_0x1e4a5f[_0x7e6d('0x2c')][_0x7e6d('0x2e')],'sMixed':_0x1e4a5f[_0x7e6d('0x2c')][_0x7e6d('0x2f')],'sNeutral':_0x1e4a5f['SentimentScore'][_0x7e6d('0x30')]});})[_0x7e6d('0xe')](function(){logger[_0x7e6d('0x9')](util[_0x7e6d('0xa')](_0x7e6d('0x1b'),_0x5bc7b5['id']));_0x3e47fc();});case _0x7e6d('0x31'):return _0x5bc7b5['update']({'transcribeStatus':_0x7e6d('0x31'),'failureReason':_0x5ef607['TranscriptionJob']['FailureReason']})['then'](function(){logger['info'](util[_0x7e6d('0xa')](_0x7e6d('0x1b'),_0x5bc7b5['id']));_0x3e47fc();});default:logger[_0x7e6d('0x9')](util['format'](_0x7e6d('0x32'),_0x5bc7b5['id']));break;}}else{return BPromise[_0x7e6d('0x33')]()['then'](function(){if(!_0x5bc7b5['tempSentiment']){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))](_0x7e6d('0x1e'));}if(!_0x314a07[_0x7e6d('0x1f')]||!_0x314a07[_0x7e6d('0x20')]||!_0x314a07[_0x7e6d('0x34')]||!_0x314a07['language']||!_0x314a07['bucket']){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))](_0x7e6d('0x24'));}if(!_0x5bc7b5[_0x7e6d('0x18')]){throw new Error(_0x7e6d('0x25'));}if(_0x314a07[_0x7e6d('0x20')]===_0x20ef11['id']){return _0x20ef11;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x7e6d('0x20')]}});}})[_0x7e6d('0xe')](function(_0x4d6953){if(!_0x4d6953){throw new db['Sequelize'][(_0x7e6d('0x1d'))](_0x7e6d('0x27'));}if(!_0x4d6953[_0x7e6d('0xd')]||!_0x4d6953[_0x7e6d('0x2a')]){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))](_0x7e6d('0x28'));}_0x39fc7d=_0x4d6953;logger['info'](util[_0x7e6d('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5bc7b5['id']));return sentiment(_0x39fc7d[_0x7e6d('0xd')],_0x39fc7d[_0x7e6d('0x2a')],_0x314a07[_0x7e6d('0x34')],_0x5bc7b5['fileText'],_0x314a07[_0x7e6d('0x21')]);})[_0x7e6d('0xe')](function(_0x474cac){logger[_0x7e6d('0x9')](util[_0x7e6d('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5bc7b5['id']));return _0x5bc7b5[_0x7e6d('0x1a')]({'sentiment':_0x474cac['Sentiment'],'sPositive':_0x474cac['SentimentScore'][_0x7e6d('0x2d')],'sNegative':_0x474cac['SentimentScore'][_0x7e6d('0x2e')],'sMixed':_0x474cac['SentimentScore'][_0x7e6d('0x2f')],'sNeutral':_0x474cac[_0x7e6d('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x7e6d('0xe')](function(){logger['info'](util[_0x7e6d('0xa')](_0x7e6d('0x1b'),_0x5bc7b5['id']));_0x3e47fc();});}})[_0x7e6d('0x35')](function(_0x4d8f2c){if(_0x4d8f2c){if(!_0x4d8f2c[_0x7e6d('0x36')]||_0x4d8f2c[_0x7e6d('0x36')]!=='SequelizeValidationError'){logger[_0x7e6d('0x37')](util[_0x7e6d('0xa')](_0x7e6d('0x38'),_0x5bc7b5['id']),util[_0x7e6d('0x39')](_0x4d8f2c,{'showHidden':![],'depth':null}));}}_0x3e47fc();});});}function checkTranscribe(){var _0x20edeb;var _0x28c5db;var _0x541e20;return db[_0x7e6d('0x3a')][_0x7e6d('0x3b')]({'where':{'transcribeStatus':_0x7e6d('0x3c')}})[_0x7e6d('0xe')](function(_0x54157d){if(!_0x54157d||!_0x54157d['length']){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))](_0x7e6d('0x3d'));}_0x20edeb=_0x54157d;return db['Setting'][_0x7e6d('0x3e')]({'where':{'id':0x1}});})[_0x7e6d('0xe')](function(_0xf8361a){if(!_0xf8361a){throw new db['Sequelize'][(_0x7e6d('0x1d'))]('Settings\x20not\x20available');}_0x28c5db=_0xf8361a;if(!_0x28c5db['transcribe']||!_0x28c5db[_0x7e6d('0x3f')]||!_0x28c5db[_0x7e6d('0x40')]||!_0x28c5db[_0x7e6d('0x21')]||!_0x28c5db[_0x7e6d('0x22')]){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0x7e6d('0x26')][_0x7e6d('0x3e')]({'where':{'id':_0x28c5db[_0x7e6d('0x3f')]}});})[_0x7e6d('0xe')](function(_0x4ad938){if(!_0x4ad938){throw new db[(_0x7e6d('0x23'))][(_0x7e6d('0x1d'))](_0x7e6d('0x27'));}if(!_0x4ad938[_0x7e6d('0xd')]||!_0x4ad938[_0x7e6d('0x2a')]){throw new db[(_0x7e6d('0x23'))]['ValidationError'](_0x7e6d('0x28'));}_0x541e20=_0x4ad938;var _0x19f652=[];_0x20edeb[_0x7e6d('0x41')](function(_0x5a4c45){_0x19f652[_0x7e6d('0x42')](checkTranscribeJob(_0x5a4c45,_0x28c5db,_0x541e20));});return BPromise[_0x7e6d('0x43')](_0x19f652);})[_0x7e6d('0x35')](function(_0x18f572){if(_0x18f572){if(!_0x18f572['name']||_0x18f572[_0x7e6d('0x36')]!==_0x7e6d('0x44')){logger['error'](util[_0x7e6d('0x39')](_0x18f572,{'showHidden':![],'depth':null}));}}});}exports[_0x7e6d('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file