Built motion from commit (unavailable).|2.6.0
[motion2.git] / server / config / schedule / transcribe.js
index f68f7df..934a82e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x99b1=['data2','transcribeRegion','transcribeName','then','format','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Sentiment','SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Neutral','catch','name','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','forEach','push','all','SequelizeValidationError','error','start','lodash','aws-sdk','util','bluebird','../../config/logger','transcribe','TranscribeService','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x99b1,0x1ca));var _0x199b=function(_0x1c1ef3,_0x1ad6d1){_0x1c1ef3=_0x1c1ef3-0x0;var _0x4435c3=_0x99b1[_0x1c1ef3];return _0x4435c3;};var _=require(_0x199b('0x0'));var AWS=require(_0x199b('0x1'));var rp=require('request-promise');var util=require(_0x199b('0x2'));var BPromise=require(_0x199b('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x199b('0x4'))(_0x199b('0x5'));function getTranscriptionJob(_0x1d5d17,_0x1dd897,_0x4d5a64,_0x599855){return new Promise(function(_0x3e2a7f,_0x5b521d){var _0xa1131=new AWS[(_0x199b('0x6'))]({'accessKeyId':_0x1dd897,'secretAccessKey':_0x1d5d17,'region':_0x4d5a64});_0xa1131['getTranscriptionJob']({'TranscriptionJobName':_0x599855},function(_0x4e925b,_0x37c425){if(_0x4e925b){return _0x5b521d(_0x4e925b);}else{return _0x3e2a7f(_0x37c425);}});});}function sentiment(_0x13e5eb,_0x3f76d3,_0x3e13ea,_0x56c2a7,_0x4cf43a){return new Promise(function(_0x104cb2,_0x23c8ab){var _0x7bef03=new AWS['Comprehend']({'accessKeyId':_0x3f76d3,'secretAccessKey':_0x13e5eb,'region':_0x3e13ea});_0x7bef03['detectSentiment']({'Text':_0x56c2a7,'LanguageCode':_0x4cf43a[_0x199b('0x7')](0x0,0x2)},function(_0xa8281d,_0x3f8823){if(_0xa8281d){return _0x23c8ab(_0xa8281d);}else{return _0x104cb2(_0x3f8823);}});});}function checkTranscribeJob(_0x25dd0e,_0x2ad32e,_0xceac67){var _0x35bc22;return new BPromise(function(_0x5d5916,_0x13d680){logger[_0x199b('0x8')](util['format'](_0x199b('0x9'),_0x25dd0e['id'],_0x25dd0e['transcribeName']));return getTranscriptionJob(_0xceac67[_0x199b('0xa')],_0xceac67[_0x199b('0xb')],_0x2ad32e[_0x199b('0xc')],_0x25dd0e[_0x199b('0xd')])[_0x199b('0xe')](function(_0x17759b){logger[_0x199b('0x8')](util[_0x199b('0xf')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x25dd0e['id'],_0x25dd0e[_0x199b('0xd')],_0x17759b[_0x199b('0x10')][_0x199b('0x11')]));if(!_0x25dd0e[_0x199b('0x12')]){switch(_0x17759b[_0x199b('0x10')][_0x199b('0x11')]){case _0x199b('0x13'):var _0x1366c9={'transcribeStatus':_0x17759b[_0x199b('0x10')][_0x199b('0x11')],'fileUri':_0x17759b['TranscriptionJob'][_0x199b('0x14')][_0x199b('0x15')]};logger[_0x199b('0x8')](util['format'](_0x199b('0x16'),_0x25dd0e['id']));return rp({'uri':_0x17759b[_0x199b('0x10')][_0x199b('0x14')][_0x199b('0x15')],'json':!![]})[_0x199b('0xe')](function(_0x322635){logger[_0x199b('0x8')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x25dd0e['id']));if(_0x322635&&_0x322635[_0x199b('0x17')]&&_0x322635[_0x199b('0x17')][_0x199b('0x18')]&&_0x322635['results']['transcripts'][_0x199b('0x19')]){_0x1366c9[_0x199b('0x12')]='';for(var _0x423e12=0x0;_0x423e12<_0x322635['results'][_0x199b('0x18')][_0x199b('0x19')];_0x423e12++){_0x1366c9[_0x199b('0x12')]+=_0x322635[_0x199b('0x17')][_0x199b('0x18')][_0x423e12]['transcript']+'';}}return _0x25dd0e[_0x199b('0x1a')](_0x1366c9);})['then'](function(){logger[_0x199b('0x8')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x25dd0e['id']));if(!_0x25dd0e[_0x199b('0x1b')]){throw new db['Sequelize'][(_0x199b('0x1c'))](_0x199b('0x1d'));}if(!_0x2ad32e[_0x199b('0x1e')]||!_0x2ad32e[_0x199b('0x1f')]||!_0x2ad32e[_0x199b('0x20')]||!_0x2ad32e[_0x199b('0x21')]||!_0x2ad32e[_0x199b('0x22')]){throw new db[(_0x199b('0x23'))][(_0x199b('0x1c'))](_0x199b('0x24'));}if(!_0x1366c9[_0x199b('0x12')]){throw new Error(_0x199b('0x25'));}if(_0x2ad32e[_0x199b('0x1f')]===_0xceac67['id']){return _0xceac67;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x199b('0xe')](function(_0x53976b){if(!_0x53976b){throw new db[(_0x199b('0x23'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x53976b['data1']||!_0x53976b[_0x199b('0xb')]){throw new db[(_0x199b('0x23'))]['ValidationError'](_0x199b('0x26'));}_0x35bc22=_0x53976b;logger[_0x199b('0x8')](util[_0x199b('0xf')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x25dd0e['id']));return sentiment(_0x35bc22['data1'],_0x35bc22[_0x199b('0xb')],_0x2ad32e['sentimentRegion'],_0x1366c9['fileText'],_0x2ad32e[_0x199b('0x21')]);})[_0x199b('0xe')](function(_0x196c20){logger[_0x199b('0x8')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x25dd0e['id']));return _0x25dd0e[_0x199b('0x1a')]({'sentiment':_0x196c20[_0x199b('0x27')],'sPositive':_0x196c20[_0x199b('0x28')][_0x199b('0x29')],'sNegative':_0x196c20[_0x199b('0x28')][_0x199b('0x2a')],'sMixed':_0x196c20[_0x199b('0x28')][_0x199b('0x2b')],'sNeutral':_0x196c20[_0x199b('0x28')]['Neutral']});})[_0x199b('0xe')](function(){logger[_0x199b('0x8')](util[_0x199b('0xf')](_0x199b('0x2c'),_0x25dd0e['id']));_0x5d5916();});case'FAILED':return _0x25dd0e[_0x199b('0x1a')]({'transcribeStatus':_0x199b('0x2d'),'failureReason':_0x17759b[_0x199b('0x10')]['FailureReason']})[_0x199b('0xe')](function(){logger['info'](util[_0x199b('0xf')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x25dd0e['id']));_0x5d5916();});default:logger[_0x199b('0x8')](util[_0x199b('0xf')](_0x199b('0x2e'),_0x25dd0e['id']));break;}}else{return BPromise[_0x199b('0x2f')]()[_0x199b('0xe')](function(){if(!_0x25dd0e[_0x199b('0x1b')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2ad32e['sentiment']||!_0x2ad32e[_0x199b('0x1f')]||!_0x2ad32e[_0x199b('0x20')]||!_0x2ad32e[_0x199b('0x21')]||!_0x2ad32e[_0x199b('0x22')]){throw new db[(_0x199b('0x23'))][(_0x199b('0x1c'))](_0x199b('0x24'));}if(!_0x25dd0e[_0x199b('0x12')]){throw new Error(_0x199b('0x25'));}if(_0x2ad32e[_0x199b('0x1f')]===_0xceac67['id']){return _0xceac67;}else{return db[_0x199b('0x30')][_0x199b('0x31')]({'where':{'id':_settings[_0x199b('0x1f')]}});}})[_0x199b('0xe')](function(_0x51654b){if(!_0x51654b){throw new db[(_0x199b('0x23'))][(_0x199b('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x51654b[_0x199b('0xa')]||!_0x51654b['data2']){throw new db[(_0x199b('0x23'))][(_0x199b('0x1c'))](_0x199b('0x26'));}_0x35bc22=_0x51654b;logger['info'](util[_0x199b('0xf')](_0x199b('0x32'),_0x25dd0e['id']));return sentiment(_0x35bc22[_0x199b('0xa')],_0x35bc22[_0x199b('0xb')],_0x2ad32e[_0x199b('0x20')],_0x25dd0e['fileText'],_0x2ad32e['language']);})[_0x199b('0xe')](function(_0x59e954){logger[_0x199b('0x8')](util[_0x199b('0xf')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x25dd0e['id']));return _0x25dd0e[_0x199b('0x1a')]({'sentiment':_0x59e954[_0x199b('0x27')],'sPositive':_0x59e954['SentimentScore'][_0x199b('0x29')],'sNegative':_0x59e954[_0x199b('0x28')][_0x199b('0x2a')],'sMixed':_0x59e954[_0x199b('0x28')][_0x199b('0x2b')],'sNeutral':_0x59e954[_0x199b('0x28')][_0x199b('0x33')],'transcribeStatus':_0x199b('0x13')});})[_0x199b('0xe')](function(){logger['info'](util[_0x199b('0xf')](_0x199b('0x2c'),_0x25dd0e['id']));_0x5d5916();});}})[_0x199b('0x34')](function(_0x4d51f0){if(_0x4d51f0){if(!_0x4d51f0[_0x199b('0x35')]||_0x4d51f0[_0x199b('0x35')]!=='SequelizeValidationError'){logger['error'](util[_0x199b('0xf')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x25dd0e['id']),util[_0x199b('0x36')](_0x4d51f0,{'showHidden':![],'depth':null}));}}_0x5d5916();});});}function checkTranscribe(){var _0xbc236d;var _0x33228a;var _0x524e6e;return db[_0x199b('0x37')][_0x199b('0x38')]({'where':{'transcribeStatus':_0x199b('0x39')}})[_0x199b('0xe')](function(_0x1bbd28){if(!_0x1bbd28||!_0x1bbd28[_0x199b('0x19')]){throw new db['Sequelize']['ValidationError'](_0x199b('0x3a'));}_0xbc236d=_0x1bbd28;return db[_0x199b('0x3b')][_0x199b('0x31')]({'where':{'id':0x1}});})[_0x199b('0xe')](function(_0x3235a6){if(!_0x3235a6){throw new db[(_0x199b('0x23'))][(_0x199b('0x1c'))]('Settings\x20not\x20available');}_0x33228a=_0x3235a6;if(!_0x33228a['transcribe']||!_0x33228a[_0x199b('0x3c')]||!_0x33228a['transcribeRegion']||!_0x33228a[_0x199b('0x21')]||!_0x33228a[_0x199b('0x22')]){throw new db[(_0x199b('0x23'))]['ValidationError']('Transcribe\x20not\x20configured');}return db['CloudProvider']['findOne']({'where':{'id':_0x33228a[_0x199b('0x3c')]}});})['then'](function(_0x347301){if(!_0x347301){throw new db[(_0x199b('0x23'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x347301[_0x199b('0xa')]||!_0x347301[_0x199b('0xb')]){throw new db[(_0x199b('0x23'))][(_0x199b('0x1c'))](_0x199b('0x26'));}_0x524e6e=_0x347301;var _0x326643=[];_0xbc236d[_0x199b('0x3d')](function(_0x4a37e1){_0x326643[_0x199b('0x3e')](checkTranscribeJob(_0x4a37e1,_0x33228a,_0x524e6e));});return BPromise[_0x199b('0x3f')](_0x326643);})[_0x199b('0x34')](function(_0x3aa919){if(_0x3aa919){if(!_0x3aa919['name']||_0x3aa919[_0x199b('0x35')]!==_0x199b('0x40')){logger[_0x199b('0x41')](util[_0x199b('0x36')](_0x3aa919,{'showHidden':![],'depth':null}));}}});}exports[_0x199b('0x42')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
+var _0x574f=['sentimentAccountId','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Positive','catch','name','SequelizeValidationError','error','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','inspect','start','lodash','request-promise','bluebird','../../config/logger','Comprehend','detectSentiment','transcribeName','data1','transcribeRegion','info','format','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment'];(function(_0x5e57c0,_0x1e25cb){var _0x3155ca=function(_0x20602b){while(--_0x20602b){_0x5e57c0['push'](_0x5e57c0['shift']());}};_0x3155ca(++_0x1e25cb);}(_0x574f,0x1c1));var _0xf574=function(_0x4efcfb,_0x1b5467){_0x4efcfb=_0x4efcfb-0x0;var _0x4e9472=_0x574f[_0x4efcfb];return _0x4e9472;};var _=require(_0xf574('0x0'));var AWS=require('aws-sdk');var rp=require(_0xf574('0x1'));var util=require('util');var BPromise=require(_0xf574('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xf574('0x3'))('transcribe');function getTranscriptionJob(_0x283ccc,_0x4569bf,_0x1295b5,_0x5d9204){return new Promise(function(_0x2a8f6d,_0x378536){var _0x55c1b3=new AWS['TranscribeService']({'accessKeyId':_0x4569bf,'secretAccessKey':_0x283ccc,'region':_0x1295b5});_0x55c1b3['getTranscriptionJob']({'TranscriptionJobName':_0x5d9204},function(_0x4f57c4,_0x291611){if(_0x4f57c4){return _0x378536(_0x4f57c4);}else{return _0x2a8f6d(_0x291611);}});});}function sentiment(_0x4dd52d,_0x395779,_0x1fb9ce,_0x11bd1e,_0x5ec7aa){return new Promise(function(_0x2ab7ef,_0xca0bbf){var _0x2adb57=new AWS[(_0xf574('0x4'))]({'accessKeyId':_0x395779,'secretAccessKey':_0x4dd52d,'region':_0x1fb9ce});_0x2adb57[_0xf574('0x5')]({'Text':_0x11bd1e,'LanguageCode':_0x5ec7aa['substring'](0x0,0x2)},function(_0x48c382,_0x4f8373){if(_0x48c382){return _0xca0bbf(_0x48c382);}else{return _0x2ab7ef(_0x4f8373);}});});}function checkTranscribeJob(_0x223636,_0x3d48f0,_0x2be1a1){var _0x4d2b6d;return new BPromise(function(_0x31292e,_0x4905ad){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x223636['id'],_0x223636[_0xf574('0x6')]));return getTranscriptionJob(_0x2be1a1[_0xf574('0x7')],_0x2be1a1['data2'],_0x3d48f0[_0xf574('0x8')],_0x223636[_0xf574('0x6')])['then'](function(_0x122a1e){logger[_0xf574('0x9')](util[_0xf574('0xa')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x223636['id'],_0x223636[_0xf574('0x6')],_0x122a1e['TranscriptionJob'][_0xf574('0xb')]));if(!_0x223636[_0xf574('0xc')]){switch(_0x122a1e[_0xf574('0xd')][_0xf574('0xb')]){case _0xf574('0xe'):var _0x292f2b={'transcribeStatus':_0x122a1e[_0xf574('0xd')][_0xf574('0xb')],'fileUri':_0x122a1e['TranscriptionJob'][_0xf574('0xf')]['TranscriptFileUri']};logger[_0xf574('0x9')](util['format'](_0xf574('0x10'),_0x223636['id']));return rp({'uri':_0x122a1e[_0xf574('0xd')]['Transcript']['TranscriptFileUri'],'json':!![]})['then'](function(_0x5f00d6){logger[_0xf574('0x9')](util[_0xf574('0xa')](_0xf574('0x11'),_0x223636['id']));if(_0x5f00d6&&_0x5f00d6[_0xf574('0x12')]&&_0x5f00d6['results']['transcripts']&&_0x5f00d6['results']['transcripts'][_0xf574('0x13')]){_0x292f2b['fileText']='';for(var _0x333277=0x0;_0x333277<_0x5f00d6['results'][_0xf574('0x14')][_0xf574('0x13')];_0x333277++){_0x292f2b[_0xf574('0xc')]+=_0x5f00d6[_0xf574('0x12')][_0xf574('0x14')][_0x333277]['transcript']+'';}}return _0x223636[_0xf574('0x15')](_0x292f2b);})[_0xf574('0x16')](function(){logger[_0xf574('0x9')](util[_0xf574('0xa')](_0xf574('0x17'),_0x223636['id']));if(!_0x223636['tempSentiment']){throw new db[(_0xf574('0x18'))]['ValidationError'](_0xf574('0x19'));}if(!_0x3d48f0[_0xf574('0x1a')]||!_0x3d48f0[_0xf574('0x1b')]||!_0x3d48f0['sentimentRegion']||!_0x3d48f0[_0xf574('0x1c')]||!_0x3d48f0[_0xf574('0x1d')]){throw new db['Sequelize'][(_0xf574('0x1e'))](_0xf574('0x1f'));}if(!_0x292f2b[_0xf574('0xc')]){throw new Error('Transcript\x20not\x20available');}if(_0x3d48f0['sentimentAccountId']===_0x2be1a1['id']){return _0x2be1a1;}else{return db[_0xf574('0x20')][_0xf574('0x21')]({'where':{'id':_settings[_0xf574('0x1b')]}});}})[_0xf574('0x16')](function(_0x58bf83){if(!_0x58bf83){throw new db[(_0xf574('0x18'))][(_0xf574('0x1e'))](_0xf574('0x22'));}if(!_0x58bf83[_0xf574('0x7')]||!_0x58bf83[_0xf574('0x23')]){throw new db[(_0xf574('0x18'))][(_0xf574('0x1e'))](_0xf574('0x24'));}_0x4d2b6d=_0x58bf83;logger[_0xf574('0x9')](util[_0xf574('0xa')](_0xf574('0x25'),_0x223636['id']));return sentiment(_0x4d2b6d[_0xf574('0x7')],_0x4d2b6d[_0xf574('0x23')],_0x3d48f0[_0xf574('0x26')],_0x292f2b[_0xf574('0xc')],_0x3d48f0['language']);})['then'](function(_0x5b32c3){logger[_0xf574('0x9')](util[_0xf574('0xa')](_0xf574('0x27'),_0x223636['id']));return _0x223636[_0xf574('0x15')]({'sentiment':_0x5b32c3[_0xf574('0x28')],'sPositive':_0x5b32c3[_0xf574('0x29')]['Positive'],'sNegative':_0x5b32c3['SentimentScore'][_0xf574('0x2a')],'sMixed':_0x5b32c3[_0xf574('0x29')][_0xf574('0x2b')],'sNeutral':_0x5b32c3[_0xf574('0x29')][_0xf574('0x2c')]});})[_0xf574('0x16')](function(){logger['info'](util[_0xf574('0xa')](_0xf574('0x17'),_0x223636['id']));_0x31292e();});case _0xf574('0x2d'):return _0x223636[_0xf574('0x15')]({'transcribeStatus':_0xf574('0x2d'),'failureReason':_0x122a1e[_0xf574('0xd')][_0xf574('0x2e')]})[_0xf574('0x16')](function(){logger[_0xf574('0x9')](util[_0xf574('0xa')](_0xf574('0x17'),_0x223636['id']));_0x31292e();});default:logger[_0xf574('0x9')](util[_0xf574('0xa')](_0xf574('0x2f'),_0x223636['id']));break;}}else{return BPromise[_0xf574('0x30')]()[_0xf574('0x16')](function(){if(!_0x223636[_0xf574('0x31')]){throw new db['Sequelize']['ValidationError'](_0xf574('0x19'));}if(!_0x3d48f0[_0xf574('0x1a')]||!_0x3d48f0[_0xf574('0x1b')]||!_0x3d48f0[_0xf574('0x26')]||!_0x3d48f0[_0xf574('0x1c')]||!_0x3d48f0[_0xf574('0x1d')]){throw new db[(_0xf574('0x18'))][(_0xf574('0x1e'))](_0xf574('0x1f'));}if(!_0x223636[_0xf574('0xc')]){throw new Error('Transcript\x20not\x20available');}if(_0x3d48f0[_0xf574('0x1b')]===_0x2be1a1['id']){return _0x2be1a1;}else{return db[_0xf574('0x20')][_0xf574('0x21')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf574('0x16')](function(_0x5430b7){if(!_0x5430b7){throw new db['Sequelize'][(_0xf574('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5430b7[_0xf574('0x7')]||!_0x5430b7['data2']){throw new db[(_0xf574('0x18'))]['ValidationError'](_0xf574('0x24'));}_0x4d2b6d=_0x5430b7;logger[_0xf574('0x9')](util[_0xf574('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x223636['id']));return sentiment(_0x4d2b6d[_0xf574('0x7')],_0x4d2b6d[_0xf574('0x23')],_0x3d48f0[_0xf574('0x26')],_0x223636['fileText'],_0x3d48f0[_0xf574('0x1c')]);})[_0xf574('0x16')](function(_0x4d022b){logger[_0xf574('0x9')](util[_0xf574('0xa')](_0xf574('0x27'),_0x223636['id']));return _0x223636[_0xf574('0x15')]({'sentiment':_0x4d022b[_0xf574('0x28')],'sPositive':_0x4d022b[_0xf574('0x29')][_0xf574('0x32')],'sNegative':_0x4d022b[_0xf574('0x29')][_0xf574('0x2a')],'sMixed':_0x4d022b['SentimentScore']['Mixed'],'sNeutral':_0x4d022b['SentimentScore'][_0xf574('0x2c')],'transcribeStatus':_0xf574('0xe')});})[_0xf574('0x16')](function(){logger[_0xf574('0x9')](util[_0xf574('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x223636['id']));_0x31292e();});}})[_0xf574('0x33')](function(_0xfadee5){if(_0xfadee5){if(!_0xfadee5[_0xf574('0x34')]||_0xfadee5[_0xf574('0x34')]!==_0xf574('0x35')){logger[_0xf574('0x36')](util[_0xf574('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x223636['id']),util['inspect'](_0xfadee5,{'showHidden':![],'depth':null}));}}_0x31292e();});});}function checkTranscribe(){var _0x3eab16;var _0x461b23;var _0x595202;return db[_0xf574('0x37')][_0xf574('0x38')]({'where':{'transcribeStatus':_0xf574('0x39')}})[_0xf574('0x16')](function(_0x5cc5ed){if(!_0x5cc5ed||!_0x5cc5ed[_0xf574('0x13')]){throw new db[(_0xf574('0x18'))][(_0xf574('0x1e'))](_0xf574('0x3a'));}_0x3eab16=_0x5cc5ed;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](function(_0x4cf6d0){if(!_0x4cf6d0){throw new db[(_0xf574('0x18'))][(_0xf574('0x1e'))](_0xf574('0x3b'));}_0x461b23=_0x4cf6d0;if(!_0x461b23[_0xf574('0x3c')]||!_0x461b23[_0xf574('0x3d')]||!_0x461b23['transcribeRegion']||!_0x461b23[_0xf574('0x1c')]||!_0x461b23[_0xf574('0x1d')]){throw new db[(_0xf574('0x18'))]['ValidationError'](_0xf574('0x3e'));}return db['CloudProvider'][_0xf574('0x21')]({'where':{'id':_0x461b23['transcribeAccountId']}});})[_0xf574('0x16')](function(_0x2c9c59){if(!_0x2c9c59){throw new db[(_0xf574('0x18'))]['ValidationError'](_0xf574('0x22'));}if(!_0x2c9c59[_0xf574('0x7')]||!_0x2c9c59['data2']){throw new db['Sequelize'][(_0xf574('0x1e'))](_0xf574('0x24'));}_0x595202=_0x2c9c59;var _0x4ab522=[];_0x3eab16[_0xf574('0x3f')](function(_0xdeabf9){_0x4ab522[_0xf574('0x40')](checkTranscribeJob(_0xdeabf9,_0x461b23,_0x595202));});return BPromise[_0xf574('0x41')](_0x4ab522);})[_0xf574('0x33')](function(_0x52b494){if(_0x52b494){if(!_0x52b494[_0xf574('0x34')]||_0x52b494[_0xf574('0x34')]!==_0xf574('0x35')){logger[_0xf574('0x36')](util[_0xf574('0x42')](_0x52b494,{'showHidden':![],'depth':null}));}}});}exports[_0xf574('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file