Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / config / schedule / transcribe.js
index 1bd4153..b2b8188 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe91d=['info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentimentRegion','language','bucket','ValidationError','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Neutral','catch','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20configured','forEach','push','all','name','start','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then'];(function(_0x4eafde,_0x42e36b){var _0xeb7a07=function(_0x55a2c4){while(--_0x55a2c4){_0x4eafde['push'](_0x4eafde['shift']());}};_0xeb7a07(++_0x42e36b);}(_0xe91d,0x159));var _0xde91=function(_0x10a187,_0xd916cd){_0x10a187=_0x10a187-0x0;var _0x505e94=_0xe91d[_0x10a187];return _0x505e94;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xde91('0x0'));var util=require(_0xde91('0x1'));var BPromise=require(_0xde91('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xde91('0x3'));function getTranscriptionJob(_0x56e454,_0x890eb,_0x1f1844,_0x50971b){return new Promise(function(_0x38ba48,_0x56267b){var _0x368bb7=new AWS[(_0xde91('0x4'))]({'accessKeyId':_0x890eb,'secretAccessKey':_0x56e454,'region':_0x1f1844});_0x368bb7[_0xde91('0x5')]({'TranscriptionJobName':_0x50971b},function(_0x2109e2,_0x3711b8){if(_0x2109e2){return _0x56267b(_0x2109e2);}else{return _0x38ba48(_0x3711b8);}});});}function sentiment(_0x1a2e94,_0x4c3446,_0x45bea3,_0x35bd5e,_0x409ee0){return new Promise(function(_0x3c9b8e,_0x5f7f13){var _0x1283f5=new AWS[(_0xde91('0x6'))]({'accessKeyId':_0x4c3446,'secretAccessKey':_0x1a2e94,'region':_0x45bea3});_0x1283f5[_0xde91('0x7')]({'Text':_0x35bd5e,'LanguageCode':_0x409ee0['substring'](0x0,0x2)},function(_0xcd000b,_0x555e85){if(_0xcd000b){return _0x5f7f13(_0xcd000b);}else{return _0x3c9b8e(_0x555e85);}});});}function checkTranscribeJob(_0x6356e7,_0x3a09ef,_0x182514){var _0x2e4ba3;return new BPromise(function(_0x216b3c,_0x4d60c2){logger['info'](util[_0xde91('0x8')](_0xde91('0x9'),_0x6356e7['id'],_0x6356e7[_0xde91('0xa')]));return getTranscriptionJob(_0x182514[_0xde91('0xb')],_0x182514[_0xde91('0xc')],_0x3a09ef[_0xde91('0xd')],_0x6356e7[_0xde91('0xa')])[_0xde91('0xe')](function(_0x4abcef){logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x10'),_0x6356e7['id'],_0x6356e7[_0xde91('0xa')],_0x4abcef[_0xde91('0x11')][_0xde91('0x12')]));if(!_0x6356e7[_0xde91('0x13')]){switch(_0x4abcef[_0xde91('0x11')]['TranscriptionJobStatus']){case'COMPLETED':var _0x1aa20d={'transcribeStatus':_0x4abcef['TranscriptionJob'][_0xde91('0x12')],'fileUri':_0x4abcef[_0xde91('0x11')][_0xde91('0x14')][_0xde91('0x15')]};logger[_0xde91('0xf')](util['format'](_0xde91('0x16'),_0x6356e7['id']));return rp({'uri':_0x4abcef[_0xde91('0x11')][_0xde91('0x14')][_0xde91('0x15')],'json':!![]})[_0xde91('0xe')](function(_0x4cd437){logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x17'),_0x6356e7['id']));if(_0x4cd437&&_0x4cd437[_0xde91('0x18')]&&_0x4cd437[_0xde91('0x18')][_0xde91('0x19')]&&_0x4cd437['results']['transcripts'][_0xde91('0x1a')]){_0x1aa20d[_0xde91('0x13')]='';for(var _0x1a3889=0x0;_0x1a3889<_0x4cd437[_0xde91('0x18')][_0xde91('0x19')]['length'];_0x1a3889++){_0x1aa20d[_0xde91('0x13')]+=_0x4cd437['results'][_0xde91('0x19')][_0x1a3889][_0xde91('0x1b')]+'';}}return _0x6356e7[_0xde91('0x1c')](_0x1aa20d);})['then'](function(){logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x1d'),_0x6356e7['id']));if(!_0x6356e7[_0xde91('0x1e')]){throw new db[(_0xde91('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3a09ef['sentiment']||!_0x3a09ef['sentimentAccountId']||!_0x3a09ef[_0xde91('0x20')]||!_0x3a09ef[_0xde91('0x21')]||!_0x3a09ef[_0xde91('0x22')]){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1aa20d[_0xde91('0x13')]){throw new Error(_0xde91('0x24'));}if(_0x3a09ef[_0xde91('0x25')]===_0x182514['id']){return _0x182514;}else{return db[_0xde91('0x26')][_0xde91('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xde91('0xe')](function(_0x584348){if(!_0x584348){throw new db['Sequelize'][(_0xde91('0x23'))](_0xde91('0x28'));}if(!_0x584348[_0xde91('0xb')]||!_0x584348['data2']){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x2e4ba3=_0x584348;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x6356e7['id']));return sentiment(_0x2e4ba3['data1'],_0x2e4ba3['data2'],_0x3a09ef['sentimentRegion'],_0x1aa20d[_0xde91('0x13')],_0x3a09ef[_0xde91('0x21')]);})[_0xde91('0xe')](function(_0x3d31ae){logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x29'),_0x6356e7['id']));return _0x6356e7['update']({'sentiment':_0x3d31ae['Sentiment'],'sPositive':_0x3d31ae[_0xde91('0x2a')][_0xde91('0x2b')],'sNegative':_0x3d31ae[_0xde91('0x2a')][_0xde91('0x2c')],'sMixed':_0x3d31ae[_0xde91('0x2a')][_0xde91('0x2d')],'sNeutral':_0x3d31ae[_0xde91('0x2a')]['Neutral']});})[_0xde91('0xe')](function(){logger['info'](util['format'](_0xde91('0x1d'),_0x6356e7['id']));_0x216b3c();});case _0xde91('0x2e'):return _0x6356e7['update']({'transcribeStatus':_0xde91('0x2e'),'failureReason':_0x4abcef[_0xde91('0x11')]['FailureReason']})[_0xde91('0xe')](function(){logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x1d'),_0x6356e7['id']));_0x216b3c();});default:logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x2f'),_0x6356e7['id']));break;}}else{return BPromise[_0xde91('0x30')]()[_0xde91('0xe')](function(){if(!_0x6356e7['tempSentiment']){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))](_0xde91('0x31'));}if(!_0x3a09ef['sentiment']||!_0x3a09ef[_0xde91('0x25')]||!_0x3a09ef[_0xde91('0x20')]||!_0x3a09ef['language']||!_0x3a09ef[_0xde91('0x22')]){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))](_0xde91('0x32'));}if(!_0x6356e7[_0xde91('0x13')]){throw new Error(_0xde91('0x24'));}if(_0x3a09ef[_0xde91('0x25')]===_0x182514['id']){return _0x182514;}else{return db[_0xde91('0x26')]['findOne']({'where':{'id':_settings[_0xde91('0x25')]}});}})[_0xde91('0xe')](function(_0x26e68b){if(!_0x26e68b){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x26e68b[_0xde91('0xb')]||!_0x26e68b[_0xde91('0xc')]){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x2e4ba3=_0x26e68b;logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x33'),_0x6356e7['id']));return sentiment(_0x2e4ba3[_0xde91('0xb')],_0x2e4ba3[_0xde91('0xc')],_0x3a09ef[_0xde91('0x20')],_0x6356e7[_0xde91('0x13')],_0x3a09ef[_0xde91('0x21')]);})[_0xde91('0xe')](function(_0x4d392c){logger['info'](util[_0xde91('0x8')](_0xde91('0x29'),_0x6356e7['id']));return _0x6356e7[_0xde91('0x1c')]({'sentiment':_0x4d392c[_0xde91('0x34')],'sPositive':_0x4d392c[_0xde91('0x2a')][_0xde91('0x2b')],'sNegative':_0x4d392c[_0xde91('0x2a')][_0xde91('0x2c')],'sMixed':_0x4d392c[_0xde91('0x2a')][_0xde91('0x2d')],'sNeutral':_0x4d392c[_0xde91('0x2a')][_0xde91('0x35')],'transcribeStatus':'COMPLETED'});})[_0xde91('0xe')](function(){logger[_0xde91('0xf')](util['format'](_0xde91('0x1d'),_0x6356e7['id']));_0x216b3c();});}})[_0xde91('0x36')](function(_0x22275d){if(_0x22275d){if(!_0x22275d['name']||_0x22275d['name']!==_0xde91('0x37')){logger[_0xde91('0x38')](util[_0xde91('0x8')](_0xde91('0x39'),_0x6356e7['id']),util[_0xde91('0x3a')](_0x22275d,{'showHidden':![],'depth':null}));}}_0x216b3c();});});}function checkTranscribe(){var _0x445e86;var _0xdd7222;var _0x2bbfb1;return db['VoiceRecording'][_0xde91('0x3b')]({'where':{'transcribeStatus':_0xde91('0x3c')}})[_0xde91('0xe')](function(_0x1dcc8e){if(!_0x1dcc8e||!_0x1dcc8e['length']){throw new db['Sequelize']['ValidationError'](_0xde91('0x3d'));}_0x445e86=_0x1dcc8e;return db[_0xde91('0x3e')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x511dbb){if(!_0x511dbb){throw new db['Sequelize'][(_0xde91('0x23'))](_0xde91('0x3f'));}_0xdd7222=_0x511dbb;if(!_0xdd7222[_0xde91('0x3')]||!_0xdd7222['transcribeAccountId']||!_0xdd7222['transcribeRegion']||!_0xdd7222['language']||!_0xdd7222['bucket']){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))](_0xde91('0x40'));}return db[_0xde91('0x26')][_0xde91('0x27')]({'where':{'id':_0xdd7222[_0xde91('0x41')]}});})['then'](function(_0x102557){if(!_0x102557){throw new db['Sequelize'][(_0xde91('0x23'))](_0xde91('0x28'));}if(!_0x102557[_0xde91('0xb')]||!_0x102557[_0xde91('0xc')]){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))](_0xde91('0x42'));}_0x2bbfb1=_0x102557;var _0x3b5eae=[];_0x445e86[_0xde91('0x43')](function(_0x308193){_0x3b5eae[_0xde91('0x44')](checkTranscribeJob(_0x308193,_0xdd7222,_0x2bbfb1));});return BPromise[_0xde91('0x45')](_0x3b5eae);})[_0xde91('0x36')](function(_0x548743){if(_0x548743){if(!_0x548743[_0xde91('0x46')]||_0x548743[_0xde91('0x46')]!==_0xde91('0x37')){logger['error'](util['inspect'](_0x548743,{'showHidden':![],'depth':null}));}}});}exports[_0xde91('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
+var _0xb1f8=['Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','Positive','COMPLETED','catch','SequelizeValidationError','error','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','name','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','format','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2'];(function(_0x812c96,_0x52d4d2){var _0x5f3304=function(_0xedcd6b){while(--_0xedcd6b){_0x812c96['push'](_0x812c96['shift']());}};_0x5f3304(++_0x52d4d2);}(_0xb1f8,0xa6));var _0x8b1f=function(_0x2194b7,_0x4eb021){_0x2194b7=_0x2194b7-0x0;var _0x5dc049=_0xb1f8[_0x2194b7];return _0x5dc049;};var _=require(_0x8b1f('0x0'));var AWS=require(_0x8b1f('0x1'));var rp=require(_0x8b1f('0x2'));var util=require(_0x8b1f('0x3'));var BPromise=require('bluebird');var db=require(_0x8b1f('0x4'))['db'];var logger=require(_0x8b1f('0x5'))(_0x8b1f('0x6'));function getTranscriptionJob(_0x3f2b7b,_0x33c5f0,_0xd14fa0,_0x4ad31a){return new Promise(function(_0x47ae75,_0x1f7b16){var _0x4d667d=new AWS[(_0x8b1f('0x7'))]({'accessKeyId':_0x33c5f0,'secretAccessKey':_0x3f2b7b,'region':_0xd14fa0});_0x4d667d[_0x8b1f('0x8')]({'TranscriptionJobName':_0x4ad31a},function(_0x3701fa,_0x189176){if(_0x3701fa){return _0x1f7b16(_0x3701fa);}else{return _0x47ae75(_0x189176);}});});}function sentiment(_0x3bd180,_0x3b0ad4,_0x483b19,_0x81445f,_0xd54027){return new Promise(function(_0x5b8d17,_0x377abe){var _0x2ddaa6=new AWS['Comprehend']({'accessKeyId':_0x3b0ad4,'secretAccessKey':_0x3bd180,'region':_0x483b19});_0x2ddaa6[_0x8b1f('0x9')]({'Text':_0x81445f,'LanguageCode':_0xd54027[_0x8b1f('0xa')](0x0,0x2)},function(_0x34c59b,_0x2d7c56){if(_0x34c59b){return _0x377abe(_0x34c59b);}else{return _0x5b8d17(_0x2d7c56);}});});}function checkTranscribeJob(_0x1641fb,_0x539be3,_0x5d991c){var _0x429976;return new BPromise(function(_0x205773,_0x24b749){logger[_0x8b1f('0xb')](util['format'](_0x8b1f('0xc'),_0x1641fb['id'],_0x1641fb[_0x8b1f('0xd')]));return getTranscriptionJob(_0x5d991c[_0x8b1f('0xe')],_0x5d991c['data2'],_0x539be3[_0x8b1f('0xf')],_0x1641fb[_0x8b1f('0xd')])[_0x8b1f('0x10')](function(_0x591251){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x1641fb['id'],_0x1641fb[_0x8b1f('0xd')],_0x591251['TranscriptionJob'][_0x8b1f('0x12')]));if(!_0x1641fb[_0x8b1f('0x13')]){switch(_0x591251['TranscriptionJob']['TranscriptionJobStatus']){case'COMPLETED':var _0x2bb47c={'transcribeStatus':_0x591251[_0x8b1f('0x14')][_0x8b1f('0x12')],'fileUri':_0x591251[_0x8b1f('0x14')][_0x8b1f('0x15')][_0x8b1f('0x16')]};logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x17'),_0x1641fb['id']));return rp({'uri':_0x591251[_0x8b1f('0x14')]['Transcript'][_0x8b1f('0x16')],'json':!![]})[_0x8b1f('0x10')](function(_0x4aa6a4){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x1641fb['id']));if(_0x4aa6a4&&_0x4aa6a4[_0x8b1f('0x18')]&&_0x4aa6a4['results']['transcripts']&&_0x4aa6a4[_0x8b1f('0x18')][_0x8b1f('0x19')][_0x8b1f('0x1a')]){_0x2bb47c[_0x8b1f('0x13')]='';for(var _0x5e9d86=0x0;_0x5e9d86<_0x4aa6a4[_0x8b1f('0x18')][_0x8b1f('0x19')]['length'];_0x5e9d86++){_0x2bb47c[_0x8b1f('0x13')]+=_0x4aa6a4[_0x8b1f('0x18')][_0x8b1f('0x19')][_0x5e9d86][_0x8b1f('0x1b')]+'';}}return _0x1641fb[_0x8b1f('0x1c')](_0x2bb47c);})[_0x8b1f('0x10')](function(){logger['info'](util[_0x8b1f('0x11')](_0x8b1f('0x1d'),_0x1641fb['id']));if(!_0x1641fb[_0x8b1f('0x1e')]){throw new db['Sequelize'][(_0x8b1f('0x1f'))](_0x8b1f('0x20'));}if(!_0x539be3['sentiment']||!_0x539be3['sentimentAccountId']||!_0x539be3[_0x8b1f('0x21')]||!_0x539be3[_0x8b1f('0x22')]||!_0x539be3[_0x8b1f('0x23')]){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))](_0x8b1f('0x25'));}if(!_0x2bb47c[_0x8b1f('0x13')]){throw new Error(_0x8b1f('0x26'));}if(_0x539be3[_0x8b1f('0x27')]===_0x5d991c['id']){return _0x5d991c;}else{return db[_0x8b1f('0x28')][_0x8b1f('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x8b1f('0x10')](function(_0x3e5f1f){if(!_0x3e5f1f){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))](_0x8b1f('0x2a'));}if(!_0x3e5f1f[_0x8b1f('0xe')]||!_0x3e5f1f[_0x8b1f('0x2b')]){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))](_0x8b1f('0x2c'));}_0x429976=_0x3e5f1f;logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x2d'),_0x1641fb['id']));return sentiment(_0x429976[_0x8b1f('0xe')],_0x429976['data2'],_0x539be3[_0x8b1f('0x21')],_0x2bb47c['fileText'],_0x539be3[_0x8b1f('0x22')]);})[_0x8b1f('0x10')](function(_0x1bc0cb){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x2e'),_0x1641fb['id']));return _0x1641fb['update']({'sentiment':_0x1bc0cb[_0x8b1f('0x2f')],'sPositive':_0x1bc0cb[_0x8b1f('0x30')]['Positive'],'sNegative':_0x1bc0cb[_0x8b1f('0x30')][_0x8b1f('0x31')],'sMixed':_0x1bc0cb[_0x8b1f('0x30')][_0x8b1f('0x32')],'sNeutral':_0x1bc0cb[_0x8b1f('0x30')][_0x8b1f('0x33')]});})[_0x8b1f('0x10')](function(){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x1d'),_0x1641fb['id']));_0x205773();});case'FAILED':return _0x1641fb['update']({'transcribeStatus':_0x8b1f('0x34'),'failureReason':_0x591251[_0x8b1f('0x14')]['FailureReason']})['then'](function(){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x1d'),_0x1641fb['id']));_0x205773();});default:logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x35'),_0x1641fb['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x1641fb[_0x8b1f('0x1e')]){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x539be3[_0x8b1f('0x36')]||!_0x539be3[_0x8b1f('0x27')]||!_0x539be3[_0x8b1f('0x21')]||!_0x539be3[_0x8b1f('0x22')]||!_0x539be3['bucket']){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))](_0x8b1f('0x25'));}if(!_0x1641fb['fileText']){throw new Error(_0x8b1f('0x26'));}if(_0x539be3[_0x8b1f('0x27')]===_0x5d991c['id']){return _0x5d991c;}else{return db[_0x8b1f('0x28')]['findOne']({'where':{'id':_settings[_0x8b1f('0x27')]}});}})[_0x8b1f('0x10')](function(_0xa3bc90){if(!_0xa3bc90){throw new db['Sequelize'][(_0x8b1f('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xa3bc90[_0x8b1f('0xe')]||!_0xa3bc90[_0x8b1f('0x2b')]){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x429976=_0xa3bc90;logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x2d'),_0x1641fb['id']));return sentiment(_0x429976[_0x8b1f('0xe')],_0x429976[_0x8b1f('0x2b')],_0x539be3[_0x8b1f('0x21')],_0x1641fb[_0x8b1f('0x13')],_0x539be3[_0x8b1f('0x22')]);})[_0x8b1f('0x10')](function(_0x28a840){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x2e'),_0x1641fb['id']));return _0x1641fb[_0x8b1f('0x1c')]({'sentiment':_0x28a840[_0x8b1f('0x2f')],'sPositive':_0x28a840[_0x8b1f('0x30')][_0x8b1f('0x37')],'sNegative':_0x28a840[_0x8b1f('0x30')][_0x8b1f('0x31')],'sMixed':_0x28a840[_0x8b1f('0x30')][_0x8b1f('0x32')],'sNeutral':_0x28a840[_0x8b1f('0x30')][_0x8b1f('0x33')],'transcribeStatus':_0x8b1f('0x38')});})['then'](function(){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x1d'),_0x1641fb['id']));_0x205773();});}})[_0x8b1f('0x39')](function(_0x3ae8a3){if(_0x3ae8a3){if(!_0x3ae8a3['name']||_0x3ae8a3['name']!==_0x8b1f('0x3a')){logger[_0x8b1f('0x3b')](util[_0x8b1f('0x11')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x1641fb['id']),util[_0x8b1f('0x3c')](_0x3ae8a3,{'showHidden':![],'depth':null}));}}_0x205773();});});}function checkTranscribe(){var _0x441f8e;var _0x13f9f7;var _0x3e6231;return db['VoiceRecording'][_0x8b1f('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x8b1f('0x10')](function(_0xb51603){if(!_0xb51603||!_0xb51603[_0x8b1f('0x1a')]){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))](_0x8b1f('0x3e'));}_0x441f8e=_0xb51603;return db['Setting'][_0x8b1f('0x29')]({'where':{'id':0x1}});})[_0x8b1f('0x10')](function(_0x2b2754){if(!_0x2b2754){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))](_0x8b1f('0x3f'));}_0x13f9f7=_0x2b2754;if(!_0x13f9f7['transcribe']||!_0x13f9f7[_0x8b1f('0x40')]||!_0x13f9f7['transcribeRegion']||!_0x13f9f7[_0x8b1f('0x22')]||!_0x13f9f7[_0x8b1f('0x23')]){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))]('Transcribe\x20not\x20configured');}return db[_0x8b1f('0x28')][_0x8b1f('0x29')]({'where':{'id':_0x13f9f7[_0x8b1f('0x40')]}});})['then'](function(_0x170693){if(!_0x170693){throw new db['Sequelize'][(_0x8b1f('0x1f'))](_0x8b1f('0x2a'));}if(!_0x170693[_0x8b1f('0xe')]||!_0x170693[_0x8b1f('0x2b')]){throw new db['Sequelize']['ValidationError'](_0x8b1f('0x2c'));}_0x3e6231=_0x170693;var _0x417dc9=[];_0x441f8e[_0x8b1f('0x41')](function(_0x502eef){_0x417dc9[_0x8b1f('0x42')](checkTranscribeJob(_0x502eef,_0x13f9f7,_0x3e6231));});return BPromise[_0x8b1f('0x43')](_0x417dc9);})[_0x8b1f('0x39')](function(_0x45d0c8){if(_0x45d0c8){if(!_0x45d0c8[_0x8b1f('0x44')]||_0x45d0c8[_0x8b1f('0x44')]!=='SequelizeValidationError'){logger[_0x8b1f('0x3b')](util[_0x8b1f('0x3c')](_0x45d0c8,{'showHidden':![],'depth':null}));}}});}exports[_0x8b1f('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file