Built motion from commit b517aaa2a6638133380e4d135c64a80893061362. Version 3.0.0...
[motion-next.git] / server / config / schedule / transcribe.js
index 5f06993..5e2e603 100644 (file)
@@ -1 +1 @@
-const a852_0x5d1c=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','detectSentiment','update','TranscribeService','Settings\x20not\x20available','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Mixed','fileText','data1','transcript','error','FAILED','data2','language','format','../../mysqldb','Comprehend','Sentiment','Sentiment\x20Analysis\x20not\x20configured','sentimentRegion','Cloud\x20Provider\x20not\x20available','findOne','transcribe','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','TranscriptionJob','TranscriptFileUri','TranscriptionJobStatus','ValidationError','sentiment','push','inspect','[RECORDING:%d]\x20Transcript\x20downloaded','name','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured','info','catch','length','SentimentScore','Sequelize','No\x20transcribe\x20job\x20to\x20check','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Setting','bucket','Positive','transcribeName','sentimentAccountId','Negative','resolve','transcribeRegion','forEach','results','then','Neutral','CloudProvider','util','findAll','tempSentiment','transcribeAccountId','SequelizeValidationError','getTranscriptionJob','transcripts','Sentiment\x20Analysis\x20not\x20requested'];(function(_0x532c5f,_0x5d1cf9){const _0xb82ab7=function(_0x287ccf){while(--_0x287ccf){_0x532c5f['push'](_0x532c5f['shift']());}};_0xb82ab7(++_0x5d1cf9);}(a852_0x5d1c,0x141));const a852_0xb82a=function(_0x532c5f,_0x5d1cf9){_0x532c5f=_0x532c5f-0x0;let _0xb82ab7=a852_0x5d1c[_0x532c5f];return _0xb82ab7;};const _0xfe8a78=a852_0xb82a,AWS=require('aws-sdk'),rp=require('request-promise-native'),util=require(_0xfe8a78('0x3d')),db=require(_0xfe8a78('0x14'))['db'],logger=require('../../config/logger')(_0xfe8a78('0x1b'));function getTranscriptionJob(_0x287ccf,_0x3fd7be,_0x4484cb,_0x3c7dc5){return new Promise(function(_0x5ad39f,_0xbee316){const _0x570e16=a852_0xb82a,_0x16c930=new AWS[(_0x570e16('0x7'))]({'accessKeyId':_0x3fd7be,'secretAccessKey':_0x287ccf,'region':_0x4484cb});_0x16c930[_0x570e16('0x1')]({'TranscriptionJobName':_0x3c7dc5},function(_0x5f6340,_0x307829){return _0x5f6340?_0xbee316(_0x5f6340):_0x5ad39f(_0x307829);});});}function sentiment(_0x50beb5,_0x5232c6,_0xf5905b,_0x126114,_0x5e06e9){return new Promise(function(_0xd7d6c9,_0x10bb2e){const _0x5123ee=a852_0xb82a,_0xc36e78=new AWS[(_0x5123ee('0x15'))]({'accessKeyId':_0x5232c6,'secretAccessKey':_0x50beb5,'region':_0xf5905b});_0xc36e78[_0x5123ee('0x5')]({'Text':_0x126114,'LanguageCode':_0x5e06e9['substring'](0x0,0x2)},function(_0x383980,_0x1af759){return _0x383980?_0x10bb2e(_0x383980):_0xd7d6c9(_0x1af759);});});}function checkTranscribeJob(_0x5982e6,_0x30d883,_0xd6dd26){let _0x2f2ce7;return new Promise(function(_0x414408){const _0xcc6f26=a852_0xb82a;return logger[_0xcc6f26('0x29')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5982e6['id'],_0x5982e6[_0xcc6f26('0x33')])),getTranscriptionJob(_0xd6dd26['data1'],_0xd6dd26['data2'],_0x30d883[_0xcc6f26('0x37')],_0x5982e6['transcribeName'])['then'](function(_0x5c3708){const _0x28034b=_0xcc6f26;logger[_0x28034b('0x29')](util[_0x28034b('0x13')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5982e6['id'],_0x5982e6[_0x28034b('0x33')],_0x5c3708[_0x28034b('0x1e')][_0x28034b('0x20')]));if(!_0x5982e6['fileText'])switch(_0x5c3708[_0x28034b('0x1e')][_0x28034b('0x20')]){case'COMPLETED':{const _0x2d7eb1={'transcribeStatus':_0x5c3708[_0x28034b('0x1e')][_0x28034b('0x20')],'fileUri':_0x5c3708[_0x28034b('0x1e')]['Transcript'][_0x28034b('0x1f')]};return logger[_0x28034b('0x29')](util[_0x28034b('0x13')](_0x28034b('0x9'),_0x5982e6['id'])),rp({'uri':_0x5c3708['TranscriptionJob']['Transcript']['TranscriptFileUri'],'json':!![]})[_0x28034b('0x3a')](function(_0x49e6ea){const _0x553b57=_0x28034b;logger['info'](util[_0x553b57('0x13')](_0x553b57('0x25'),_0x5982e6['id']));if(_0x49e6ea&&_0x49e6ea['results']&&_0x49e6ea['results']['transcripts']&&_0x49e6ea[_0x553b57('0x39')][_0x553b57('0x2')][_0x553b57('0x2b')]){_0x2d7eb1[_0x553b57('0xc')]='';for(let _0x282082=0x0;_0x282082<_0x49e6ea['results'][_0x553b57('0x2')]['length'];_0x282082++){_0x2d7eb1['fileText']+=_0x49e6ea[_0x553b57('0x39')][_0x553b57('0x2')][_0x282082][_0x553b57('0xe')]+'';}}return _0x5982e6[_0x553b57('0x6')](_0x2d7eb1);})[_0x28034b('0x3a')](function(){const _0x4c2efd=_0x28034b;logger[_0x4c2efd('0x29')](util[_0x4c2efd('0x13')](_0x4c2efd('0x2f'),_0x5982e6['id']));if(!_0x5982e6['tempSentiment'])throw new db[(_0x4c2efd('0x2d'))][(_0x4c2efd('0x21'))](_0x4c2efd('0x3'));if(!_0x30d883[_0x4c2efd('0x22')]||!_0x30d883[_0x4c2efd('0x34')]||!_0x30d883[_0x4c2efd('0x18')]||!_0x30d883['language']||!_0x30d883['bucket'])throw new db['Sequelize'][(_0x4c2efd('0x21'))](_0x4c2efd('0x17'));if(!_0x2d7eb1[_0x4c2efd('0xc')])throw new Error(_0x4c2efd('0x27'));return _0x30d883[_0x4c2efd('0x34')]===_0xd6dd26['id']?_0xd6dd26:db[_0x4c2efd('0x3c')][_0x4c2efd('0x1a')]({'where':{'id':_0x30d883['sentimentAccountId']}});})[_0x28034b('0x3a')](function(_0xeb5c88){const _0x4d24c5=_0x28034b;if(!_0xeb5c88)throw new db[(_0x4d24c5('0x2d'))][(_0x4d24c5('0x21'))](_0x4d24c5('0x19'));if(!_0xeb5c88['data1']||!_0xeb5c88[_0x4d24c5('0x11')])throw new db[(_0x4d24c5('0x2d'))][(_0x4d24c5('0x21'))]('Cloud\x20Provider\x20not\x20configured');return _0x2f2ce7=_0xeb5c88,logger[_0x4d24c5('0x29')](util[_0x4d24c5('0x13')](_0x4d24c5('0x4'),_0x5982e6['id'])),sentiment(_0x2f2ce7[_0x4d24c5('0xd')],_0x2f2ce7[_0x4d24c5('0x11')],_0x30d883[_0x4d24c5('0x18')],_0x2d7eb1['fileText'],_0x30d883['language']);})[_0x28034b('0x3a')](function(_0x1f3fe4){const _0x13e2a8=_0x28034b;return logger[_0x13e2a8('0x29')](util[_0x13e2a8('0x13')](_0x13e2a8('0x1c'),_0x5982e6['id'])),_0x5982e6[_0x13e2a8('0x6')]({'sentiment':_0x1f3fe4['Sentiment'],'sPositive':_0x1f3fe4[_0x13e2a8('0x2c')][_0x13e2a8('0x32')],'sNegative':_0x1f3fe4['SentimentScore'][_0x13e2a8('0x35')],'sMixed':_0x1f3fe4[_0x13e2a8('0x2c')][_0x13e2a8('0xb')],'sNeutral':_0x1f3fe4[_0x13e2a8('0x2c')]['Neutral']});})[_0x28034b('0x3a')](function(){const _0x270fa8=_0x28034b;logger[_0x270fa8('0x29')](util[_0x270fa8('0x13')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5982e6['id'])),_0x414408();});}case'FAILED':return _0x5982e6[_0x28034b('0x6')]({'transcribeStatus':_0x28034b('0x10'),'failureReason':_0x5c3708['TranscriptionJob']['FailureReason']})['then'](function(){const _0x43a881=_0x28034b;logger[_0x43a881('0x29')](util[_0x43a881('0x13')](_0x43a881('0x2f'),_0x5982e6['id'])),_0x414408();});default:logger[_0x28034b('0x29')](util['format'](_0x28034b('0xa'),_0x5982e6['id']));break;}else return Promise[_0x28034b('0x36')]()['then'](function(){const _0x1eefd4=_0x28034b;if(!_0x5982e6[_0x1eefd4('0x3f')])throw new db[(_0x1eefd4('0x2d'))][(_0x1eefd4('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');if(!_0x30d883[_0x1eefd4('0x22')]||!_0x30d883[_0x1eefd4('0x34')]||!_0x30d883['sentimentRegion']||!_0x30d883[_0x1eefd4('0x12')]||!_0x30d883[_0x1eefd4('0x31')])throw new db['Sequelize'][(_0x1eefd4('0x21'))](_0x1eefd4('0x17'));if(!_0x5982e6[_0x1eefd4('0xc')])throw new Error(_0x1eefd4('0x27'));return _0x30d883['sentimentAccountId']===_0xd6dd26['id']?_0xd6dd26:db[_0x1eefd4('0x3c')]['findOne']({'where':{'id':_0x30d883['sentimentAccountId']}});})['then'](function(_0x37a3){const _0x1e32f9=_0x28034b;if(!_0x37a3)throw new db[(_0x1e32f9('0x2d'))]['ValidationError'](_0x1e32f9('0x19'));if(!_0x37a3[_0x1e32f9('0xd')]||!_0x37a3[_0x1e32f9('0x11')])throw new db['Sequelize']['ValidationError'](_0x1e32f9('0x28'));return _0x2f2ce7=_0x37a3,logger[_0x1e32f9('0x29')](util[_0x1e32f9('0x13')](_0x1e32f9('0x4'),_0x5982e6['id'])),sentiment(_0x2f2ce7[_0x1e32f9('0xd')],_0x2f2ce7['data2'],_0x30d883[_0x1e32f9('0x18')],_0x5982e6[_0x1e32f9('0xc')],_0x30d883[_0x1e32f9('0x12')]);})[_0x28034b('0x3a')](function(_0x41ea2d){const _0x20bfa3=_0x28034b;return logger[_0x20bfa3('0x29')](util[_0x20bfa3('0x13')](_0x20bfa3('0x1c'),_0x5982e6['id'])),_0x5982e6[_0x20bfa3('0x6')]({'sentiment':_0x41ea2d[_0x20bfa3('0x16')],'sPositive':_0x41ea2d[_0x20bfa3('0x2c')][_0x20bfa3('0x32')],'sNegative':_0x41ea2d[_0x20bfa3('0x2c')][_0x20bfa3('0x35')],'sMixed':_0x41ea2d[_0x20bfa3('0x2c')][_0x20bfa3('0xb')],'sNeutral':_0x41ea2d[_0x20bfa3('0x2c')][_0x20bfa3('0x3b')],'transcribeStatus':'COMPLETED'});})['then'](function(){const _0x1d3088=_0x28034b;logger['info'](util[_0x1d3088('0x13')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5982e6['id'])),_0x414408();});})['catch'](function(_0x107eeb){const _0x24f2ef=_0xcc6f26;_0x107eeb&&((!_0x107eeb['name']||_0x107eeb[_0x24f2ef('0x26')]!==_0x24f2ef('0x0'))&&logger[_0x24f2ef('0xf')](util[_0x24f2ef('0x13')](_0x24f2ef('0x1d'),_0x5982e6['id']),util[_0x24f2ef('0x24')](_0x107eeb,{'showHidden':![],'depth':null}))),_0x414408();});});}function checkTranscribe(){const _0x12e5eb=_0xfe8a78;let _0x3d518c,_0x543cf6,_0x8f5c73;return db['VoiceRecording'][_0x12e5eb('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x5d911b){const _0x27d808=_0x12e5eb;if(!_0x5d911b||!_0x5d911b['length'])throw new db[(_0x27d808('0x2d'))]['ValidationError'](_0x27d808('0x2e'));return _0x3d518c=_0x5d911b,db[_0x27d808('0x30')]['findOne']({'where':{'id':0x1}});})[_0x12e5eb('0x3a')](function(_0x559d63){const _0x56f0c9=_0x12e5eb;if(!_0x559d63)throw new db[(_0x56f0c9('0x2d'))]['ValidationError'](_0x56f0c9('0x8'));_0x543cf6=_0x559d63;if(!_0x543cf6[_0x56f0c9('0x1b')]||!_0x543cf6[_0x56f0c9('0x40')]||!_0x543cf6[_0x56f0c9('0x37')]||!_0x543cf6[_0x56f0c9('0x12')]||!_0x543cf6[_0x56f0c9('0x31')])throw new db[(_0x56f0c9('0x2d'))][(_0x56f0c9('0x21'))]('Transcribe\x20not\x20configured');return db[_0x56f0c9('0x3c')]['findOne']({'where':{'id':_0x543cf6[_0x56f0c9('0x40')]}});})[_0x12e5eb('0x3a')](function(_0x234ad4){const _0x215a8c=_0x12e5eb;if(!_0x234ad4)throw new db['Sequelize'][(_0x215a8c('0x21'))](_0x215a8c('0x19'));if(!_0x234ad4['data1']||!_0x234ad4['data2'])throw new db[(_0x215a8c('0x2d'))][(_0x215a8c('0x21'))](_0x215a8c('0x28'));_0x8f5c73=_0x234ad4;const _0x3214e8=[];return _0x3d518c[_0x215a8c('0x38')](function(_0x156407){const _0x341db0=_0x215a8c;_0x3214e8[_0x341db0('0x23')](checkTranscribeJob(_0x156407,_0x543cf6,_0x8f5c73));}),Promise['all'](_0x3214e8);})[_0x12e5eb('0x2a')](function(_0x5bf6f1){const _0x2998a6=_0x12e5eb;_0x5bf6f1&&((!_0x5bf6f1[_0x2998a6('0x26')]||_0x5bf6f1[_0x2998a6('0x26')]!==_0x2998a6('0x0'))&&logger[_0x2998a6('0xf')](util[_0x2998a6('0x24')](_0x5bf6f1,{'showHidden':![],'depth':null})));});}exports['start']=function(){return setInterval(function(){return checkTranscribe();},0x3c*0x3e8),checkTranscribe();};
\ No newline at end of file
+const a852_0x340b=['FAILED','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','TranscriptionJobStatus','Sequelize','Settings\x20not\x20available','Positive','COMPLETED','transcripts','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','sentimentAccountId','Sentiment\x20Analysis\x20not\x20requested','Transcript\x20not\x20available','inspect','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','Cloud\x20Provider\x20not\x20configured','../../config/logger','length','aws-sdk','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','TranscriptFileUri','push','TranscribeService','name','format','tempSentiment','TranscriptionJob','results','error','Cloud\x20Provider\x20not\x20available','info','CloudProvider','transcribeAccountId','findOne','Sentiment\x20Analysis\x20not\x20configured','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','Sentiment','../../mysqldb','sentiment','transcribe','forEach','Comprehend','catch','util','Negative','bucket','language','then','substring','VoiceRecording','SequelizeValidationError','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','data2','transcribeRegion','update','detectSentiment','SentimentScore','transcribeName','sentimentRegion','Neutral','IN_PROGRESS','ValidationError','request-promise-native','Setting','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','Mixed','fileText'];(function(_0x27767d,_0x340bf8){const _0x4101de=function(_0x160ff2){while(--_0x160ff2){_0x27767d['push'](_0x27767d['shift']());}};_0x4101de(++_0x340bf8);}(a852_0x340b,0x15a));const a852_0x4101=function(_0x27767d,_0x340bf8){_0x27767d=_0x27767d-0x0;let _0x4101de=a852_0x340b[_0x27767d];return _0x4101de;};const _0x166f7b=a852_0x4101,AWS=require(_0x166f7b('0xc')),rp=require(_0x166f7b('0x38')),util=require(_0x166f7b('0x25')),db=require(_0x166f7b('0x1f'))['db'],logger=require(_0x166f7b('0xa'))(_0x166f7b('0x21'));function getTranscriptionJob(_0x160ff2,_0x5e5ffd,_0x2759ab,_0x5e5609){return new Promise(function(_0x4e4942,_0x111d3d){const _0x5b7e03=a852_0x4101,_0x3acc19=new AWS[(_0x5b7e03('0x10'))]({'accessKeyId':_0x5e5ffd,'secretAccessKey':_0x160ff2,'region':_0x2759ab});_0x3acc19['getTranscriptionJob']({'TranscriptionJobName':_0x5e5609},function(_0x36b5ab,_0x852dbc){return _0x36b5ab?_0x111d3d(_0x36b5ab):_0x4e4942(_0x852dbc);});});}function sentiment(_0x14f306,_0xeef601,_0x40f103,_0x4ad69e,_0x41e987){return new Promise(function(_0x2d2e51,_0x4cec33){const _0x39bc1e=a852_0x4101,_0x5a292f=new AWS[(_0x39bc1e('0x23'))]({'accessKeyId':_0xeef601,'secretAccessKey':_0x14f306,'region':_0x40f103});_0x5a292f[_0x39bc1e('0x31')]({'Text':_0x4ad69e,'LanguageCode':_0x41e987[_0x39bc1e('0x2a')](0x0,0x2)},function(_0x4b866d,_0x14caf0){return _0x4b866d?_0x4cec33(_0x4b866d):_0x2d2e51(_0x14caf0);});});}function checkTranscribeJob(_0x5f09a,_0x525b1e,_0x6e2525){let _0x4ca6c6;return new Promise(function(_0x2bc0f4){const _0x50dad7=a852_0x4101;return logger['info'](util[_0x50dad7('0x12')](_0x50dad7('0x1d'),_0x5f09a['id'],_0x5f09a[_0x50dad7('0x33')])),getTranscriptionJob(_0x6e2525['data1'],_0x6e2525[_0x50dad7('0x2e')],_0x525b1e['transcribeRegion'],_0x5f09a[_0x50dad7('0x33')])[_0x50dad7('0x29')](function(_0x17e62f){const _0x5c90cf=_0x50dad7;logger[_0x5c90cf('0x18')](util['format'](_0x5c90cf('0x2'),_0x5f09a['id'],_0x5f09a[_0x5c90cf('0x33')],_0x17e62f[_0x5c90cf('0x14')]['TranscriptionJobStatus']));if(!_0x5f09a[_0x5c90cf('0x3d')])switch(_0x17e62f[_0x5c90cf('0x14')][_0x5c90cf('0x40')]){case _0x5c90cf('0x0'):{const _0x40ce50={'transcribeStatus':_0x17e62f[_0x5c90cf('0x14')][_0x5c90cf('0x40')],'fileUri':_0x17e62f['TranscriptionJob'][_0x5c90cf('0x3a')][_0x5c90cf('0xe')]};return logger[_0x5c90cf('0x18')](util[_0x5c90cf('0x12')]('[RECORDING:%d]\x20Get\x20transcript',_0x5f09a['id'])),rp({'uri':_0x17e62f[_0x5c90cf('0x14')][_0x5c90cf('0x3a')][_0x5c90cf('0xe')],'json':!![]})['then'](function(_0xd5c9d8){const _0x1bb544=_0x5c90cf;logger[_0x1bb544('0x18')](util[_0x1bb544('0x12')](_0x1bb544('0x3b'),_0x5f09a['id']));if(_0xd5c9d8&&_0xd5c9d8[_0x1bb544('0x15')]&&_0xd5c9d8[_0x1bb544('0x15')][_0x1bb544('0x1')]&&_0xd5c9d8[_0x1bb544('0x15')][_0x1bb544('0x1')][_0x1bb544('0xb')]){_0x40ce50['fileText']='';for(let _0x584efe=0x0;_0x584efe<_0xd5c9d8[_0x1bb544('0x15')]['transcripts'][_0x1bb544('0xb')];_0x584efe++){_0x40ce50[_0x1bb544('0x3d')]+=_0xd5c9d8[_0x1bb544('0x15')][_0x1bb544('0x1')][_0x584efe]['transcript']+'';}}return _0x5f09a['update'](_0x40ce50);})['then'](function(){const _0x14b410=_0x5c90cf;logger[_0x14b410('0x18')](util[_0x14b410('0x12')](_0x14b410('0xd'),_0x5f09a['id']));if(!_0x5f09a[_0x14b410('0x13')])throw new db[(_0x14b410('0x41'))][(_0x14b410('0x37'))](_0x14b410('0x4'));if(!_0x525b1e[_0x14b410('0x20')]||!_0x525b1e['sentimentAccountId']||!_0x525b1e[_0x14b410('0x34')]||!_0x525b1e[_0x14b410('0x28')]||!_0x525b1e[_0x14b410('0x27')])throw new db[(_0x14b410('0x41'))]['ValidationError'](_0x14b410('0x1c'));if(!_0x40ce50[_0x14b410('0x3d')])throw new Error(_0x14b410('0x5'));return _0x525b1e['sentimentAccountId']===_0x6e2525['id']?_0x6e2525:db['CloudProvider'][_0x14b410('0x1b')]({'where':{'id':_0x525b1e['sentimentAccountId']}});})[_0x5c90cf('0x29')](function(_0x719b1f){const _0xab1f8a=_0x5c90cf;if(!_0x719b1f)throw new db[(_0xab1f8a('0x41'))][(_0xab1f8a('0x37'))](_0xab1f8a('0x17'));if(!_0x719b1f['data1']||!_0x719b1f[_0xab1f8a('0x2e')])throw new db['Sequelize'][(_0xab1f8a('0x37'))]('Cloud\x20Provider\x20not\x20configured');return _0x4ca6c6=_0x719b1f,logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5f09a['id'])),sentiment(_0x4ca6c6['data1'],_0x4ca6c6[_0xab1f8a('0x2e')],_0x525b1e[_0xab1f8a('0x34')],_0x40ce50['fileText'],_0x525b1e[_0xab1f8a('0x28')]);})['then'](function(_0x45c288){const _0x8cbc6a=_0x5c90cf;return logger[_0x8cbc6a('0x18')](util[_0x8cbc6a('0x12')](_0x8cbc6a('0x3f'),_0x5f09a['id'])),_0x5f09a[_0x8cbc6a('0x30')]({'sentiment':_0x45c288[_0x8cbc6a('0x1e')],'sPositive':_0x45c288[_0x8cbc6a('0x32')][_0x8cbc6a('0x43')],'sNegative':_0x45c288['SentimentScore'][_0x8cbc6a('0x26')],'sMixed':_0x45c288[_0x8cbc6a('0x32')][_0x8cbc6a('0x3c')],'sNeutral':_0x45c288[_0x8cbc6a('0x32')]['Neutral']});})[_0x5c90cf('0x29')](function(){const _0x457d64=_0x5c90cf;logger['info'](util[_0x457d64('0x12')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5f09a['id'])),_0x2bc0f4();});}case _0x5c90cf('0x3e'):return _0x5f09a[_0x5c90cf('0x30')]({'transcribeStatus':'FAILED','failureReason':_0x17e62f['TranscriptionJob']['FailureReason']})[_0x5c90cf('0x29')](function(){const _0x290adb=_0x5c90cf;logger[_0x290adb('0x18')](util[_0x290adb('0x12')](_0x290adb('0xd'),_0x5f09a['id'])),_0x2bc0f4();});default:logger[_0x5c90cf('0x18')](util[_0x5c90cf('0x12')](_0x5c90cf('0x2d'),_0x5f09a['id']));break;}else return Promise['resolve']()[_0x5c90cf('0x29')](function(){const _0x4872c0=_0x5c90cf;if(!_0x5f09a[_0x4872c0('0x13')])throw new db[(_0x4872c0('0x41'))][(_0x4872c0('0x37'))](_0x4872c0('0x4'));if(!_0x525b1e[_0x4872c0('0x20')]||!_0x525b1e[_0x4872c0('0x3')]||!_0x525b1e['sentimentRegion']||!_0x525b1e[_0x4872c0('0x28')]||!_0x525b1e['bucket'])throw new db[(_0x4872c0('0x41'))][(_0x4872c0('0x37'))](_0x4872c0('0x1c'));if(!_0x5f09a[_0x4872c0('0x3d')])throw new Error(_0x4872c0('0x5'));return _0x525b1e['sentimentAccountId']===_0x6e2525['id']?_0x6e2525:db[_0x4872c0('0x19')]['findOne']({'where':{'id':_0x525b1e[_0x4872c0('0x3')]}});})['then'](function(_0x48beb3){const _0x46c06a=_0x5c90cf;if(!_0x48beb3)throw new db[(_0x46c06a('0x41'))][(_0x46c06a('0x37'))](_0x46c06a('0x17'));if(!_0x48beb3[_0x46c06a('0x8')]||!_0x48beb3[_0x46c06a('0x2e')])throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');return _0x4ca6c6=_0x48beb3,logger[_0x46c06a('0x18')](util[_0x46c06a('0x12')](_0x46c06a('0x7'),_0x5f09a['id'])),sentiment(_0x4ca6c6['data1'],_0x4ca6c6[_0x46c06a('0x2e')],_0x525b1e['sentimentRegion'],_0x5f09a[_0x46c06a('0x3d')],_0x525b1e[_0x46c06a('0x28')]);})[_0x5c90cf('0x29')](function(_0x3a8f00){const _0x32be26=_0x5c90cf;return logger[_0x32be26('0x18')](util[_0x32be26('0x12')](_0x32be26('0x3f'),_0x5f09a['id'])),_0x5f09a[_0x32be26('0x30')]({'sentiment':_0x3a8f00['Sentiment'],'sPositive':_0x3a8f00[_0x32be26('0x32')][_0x32be26('0x43')],'sNegative':_0x3a8f00['SentimentScore'][_0x32be26('0x26')],'sMixed':_0x3a8f00[_0x32be26('0x32')][_0x32be26('0x3c')],'sNeutral':_0x3a8f00[_0x32be26('0x32')][_0x32be26('0x35')],'transcribeStatus':_0x32be26('0x0')});})[_0x5c90cf('0x29')](function(){const _0x5857d5=_0x5c90cf;logger[_0x5857d5('0x18')](util[_0x5857d5('0x12')](_0x5857d5('0xd'),_0x5f09a['id'])),_0x2bc0f4();});})[_0x50dad7('0x24')](function(_0x86d4bd){const _0x4e67d2=_0x50dad7;_0x86d4bd&&((!_0x86d4bd['name']||_0x86d4bd['name']!==_0x4e67d2('0x2c'))&&logger[_0x4e67d2('0x16')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x5f09a['id']),util[_0x4e67d2('0x6')](_0x86d4bd,{'showHidden':![],'depth':null}))),_0x2bc0f4();});});}function checkTranscribe(){const _0x52899d=_0x166f7b;let _0x37bd15,_0x487a47,_0x36ae9c;return db[_0x52899d('0x2b')]['findAll']({'where':{'transcribeStatus':_0x52899d('0x36')}})['then'](function(_0x2e1048){const _0x22f51a=_0x52899d;if(!_0x2e1048||!_0x2e1048[_0x22f51a('0xb')])throw new db[(_0x22f51a('0x41'))][(_0x22f51a('0x37'))]('No\x20transcribe\x20job\x20to\x20check');return _0x37bd15=_0x2e1048,db[_0x22f51a('0x39')]['findOne']({'where':{'id':0x1}});})[_0x52899d('0x29')](function(_0x2bad0f){const _0x4330ae=_0x52899d;if(!_0x2bad0f)throw new db[(_0x4330ae('0x41'))][(_0x4330ae('0x37'))](_0x4330ae('0x42'));_0x487a47=_0x2bad0f;if(!_0x487a47['transcribe']||!_0x487a47[_0x4330ae('0x1a')]||!_0x487a47[_0x4330ae('0x2f')]||!_0x487a47[_0x4330ae('0x28')]||!_0x487a47[_0x4330ae('0x27')])throw new db[(_0x4330ae('0x41'))][(_0x4330ae('0x37'))]('Transcribe\x20not\x20configured');return db[_0x4330ae('0x19')][_0x4330ae('0x1b')]({'where':{'id':_0x487a47[_0x4330ae('0x1a')]}});})[_0x52899d('0x29')](function(_0x3337a0){const _0x5b8d2b=_0x52899d;if(!_0x3337a0)throw new db['Sequelize'][(_0x5b8d2b('0x37'))](_0x5b8d2b('0x17'));if(!_0x3337a0[_0x5b8d2b('0x8')]||!_0x3337a0[_0x5b8d2b('0x2e')])throw new db[(_0x5b8d2b('0x41'))][(_0x5b8d2b('0x37'))](_0x5b8d2b('0x9'));_0x36ae9c=_0x3337a0;const _0x4dbb5a=[];return _0x37bd15[_0x5b8d2b('0x22')](function(_0x14415e){const _0x48055b=_0x5b8d2b;_0x4dbb5a[_0x48055b('0xf')](checkTranscribeJob(_0x14415e,_0x487a47,_0x36ae9c));}),Promise['all'](_0x4dbb5a);})[_0x52899d('0x24')](function(_0x3da20a){const _0x3f003e=_0x52899d;_0x3da20a&&((!_0x3da20a['name']||_0x3da20a[_0x3f003e('0x11')]!==_0x3f003e('0x2c'))&&logger[_0x3f003e('0x16')](util[_0x3f003e('0x6')](_0x3da20a,{'showHidden':![],'depth':null})));});}exports['start']=function(){return setInterval(function(){return checkTranscribe();},0x3c*0x3e8),checkTranscribe();};
\ No newline at end of file