Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / config / schedule / transcribe.js
index e2b8933..3df395f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc43d=['[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','Sentiment','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','error','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info'];(function(_0x17df7f,_0x1cd9e4){var _0x3ba5b0=function(_0x34fad9){while(--_0x34fad9){_0x17df7f['push'](_0x17df7f['shift']());}};_0x3ba5b0(++_0x1cd9e4);}(_0xc43d,0x1b0));var _0xdc43=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xc43d[_0x2f5a22];return _0x326b70;};var _=require(_0xdc43('0x0'));var AWS=require(_0xdc43('0x1'));var rp=require(_0xdc43('0x2'));var util=require(_0xdc43('0x3'));var BPromise=require('bluebird');var db=require(_0xdc43('0x4'))['db'];var logger=require(_0xdc43('0x5'))(_0xdc43('0x6'));function getTranscriptionJob(_0x1c534e,_0x3fe7ed,_0x154d41,_0x2dcf16){return new Promise(function(_0x521e53,_0x88e1ea){var _0x1c30f1=new AWS[(_0xdc43('0x7'))]({'accessKeyId':_0x3fe7ed,'secretAccessKey':_0x1c534e,'region':_0x154d41});_0x1c30f1[_0xdc43('0x8')]({'TranscriptionJobName':_0x2dcf16},function(_0x482bc5,_0x5b1824){if(_0x482bc5){return _0x88e1ea(_0x482bc5);}else{return _0x521e53(_0x5b1824);}});});}function sentiment(_0x3f2d4d,_0x47ea56,_0x30095b,_0x40f8c9,_0x4f14bd){return new Promise(function(_0x5d5a26,_0x16d9dc){var _0x263ee3=new AWS[(_0xdc43('0x9'))]({'accessKeyId':_0x47ea56,'secretAccessKey':_0x3f2d4d,'region':_0x30095b});_0x263ee3[_0xdc43('0xa')]({'Text':_0x40f8c9,'LanguageCode':_0x4f14bd['substring'](0x0,0x2)},function(_0x2efb56,_0x1721bc){if(_0x2efb56){return _0x16d9dc(_0x2efb56);}else{return _0x5d5a26(_0x1721bc);}});});}function checkTranscribeJob(_0x4ca6a5,_0x7f010f,_0x198087){var _0x4739ed;return new BPromise(function(_0x4e8a00,_0x20e266){logger[_0xdc43('0xb')](util['format'](_0xdc43('0xc'),_0x4ca6a5['id'],_0x4ca6a5['transcribeName']));return getTranscriptionJob(_0x198087[_0xdc43('0xd')],_0x198087['data2'],_0x7f010f[_0xdc43('0xe')],_0x4ca6a5['transcribeName'])[_0xdc43('0xf')](function(_0x2d53c3){logger['info'](util[_0xdc43('0x10')](_0xdc43('0x11'),_0x4ca6a5['id'],_0x4ca6a5[_0xdc43('0x12')],_0x2d53c3[_0xdc43('0x13')][_0xdc43('0x14')]));if(!_0x4ca6a5[_0xdc43('0x15')]){switch(_0x2d53c3[_0xdc43('0x13')][_0xdc43('0x14')]){case _0xdc43('0x16'):var _0x22742e={'transcribeStatus':_0x2d53c3[_0xdc43('0x13')][_0xdc43('0x14')],'fileUri':_0x2d53c3[_0xdc43('0x13')]['Transcript'][_0xdc43('0x17')]};logger[_0xdc43('0xb')](util[_0xdc43('0x10')](_0xdc43('0x18'),_0x4ca6a5['id']));return rp({'uri':_0x2d53c3[_0xdc43('0x13')]['Transcript'][_0xdc43('0x17')],'json':!![]})[_0xdc43('0xf')](function(_0x4e5f2a){logger[_0xdc43('0xb')](util['format'](_0xdc43('0x19'),_0x4ca6a5['id']));if(_0x4e5f2a&&_0x4e5f2a['results']&&_0x4e5f2a['results'][_0xdc43('0x1a')]&&_0x4e5f2a[_0xdc43('0x1b')]['transcripts'][_0xdc43('0x1c')]){_0x22742e[_0xdc43('0x15')]='';for(var _0x22f5f4=0x0;_0x22f5f4<_0x4e5f2a[_0xdc43('0x1b')][_0xdc43('0x1a')][_0xdc43('0x1c')];_0x22f5f4++){_0x22742e[_0xdc43('0x15')]+=_0x4e5f2a['results'][_0xdc43('0x1a')][_0x22f5f4][_0xdc43('0x1d')]+'';}}return _0x4ca6a5['update'](_0x22742e);})[_0xdc43('0xf')](function(){logger[_0xdc43('0xb')](util[_0xdc43('0x10')](_0xdc43('0x1e'),_0x4ca6a5['id']));if(!_0x4ca6a5[_0xdc43('0x1f')]){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))](_0xdc43('0x22'));}if(!_0x7f010f[_0xdc43('0x23')]||!_0x7f010f[_0xdc43('0x24')]||!_0x7f010f[_0xdc43('0x25')]||!_0x7f010f[_0xdc43('0x26')]||!_0x7f010f[_0xdc43('0x27')]){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x22742e[_0xdc43('0x15')]){throw new Error(_0xdc43('0x28'));}if(_0x7f010f[_0xdc43('0x24')]===_0x198087['id']){return _0x198087;}else{return db[_0xdc43('0x29')][_0xdc43('0x2a')]({'where':{'id':_settings[_0xdc43('0x24')]}});}})['then'](function(_0x158ac0){if(!_0x158ac0){throw new db['Sequelize'][(_0xdc43('0x21'))](_0xdc43('0x2b'));}if(!_0x158ac0[_0xdc43('0xd')]||!_0x158ac0[_0xdc43('0x2c')]){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))](_0xdc43('0x2d'));}_0x4739ed=_0x158ac0;logger['info'](util[_0xdc43('0x10')](_0xdc43('0x2e'),_0x4ca6a5['id']));return sentiment(_0x4739ed[_0xdc43('0xd')],_0x4739ed[_0xdc43('0x2c')],_0x7f010f['sentimentRegion'],_0x22742e['fileText'],_0x7f010f['language']);})[_0xdc43('0xf')](function(_0xddfb9b){logger[_0xdc43('0xb')](util[_0xdc43('0x10')](_0xdc43('0x2f'),_0x4ca6a5['id']));return _0x4ca6a5[_0xdc43('0x30')]({'sentiment':_0xddfb9b['Sentiment'],'sPositive':_0xddfb9b[_0xdc43('0x31')][_0xdc43('0x32')],'sNegative':_0xddfb9b['SentimentScore'][_0xdc43('0x33')],'sMixed':_0xddfb9b[_0xdc43('0x31')][_0xdc43('0x34')],'sNeutral':_0xddfb9b['SentimentScore']['Neutral']});})['then'](function(){logger['info'](util[_0xdc43('0x10')](_0xdc43('0x1e'),_0x4ca6a5['id']));_0x4e8a00();});case _0xdc43('0x35'):return _0x4ca6a5[_0xdc43('0x30')]({'transcribeStatus':_0xdc43('0x35'),'failureReason':_0x2d53c3[_0xdc43('0x13')][_0xdc43('0x36')]})['then'](function(){logger[_0xdc43('0xb')](util['format'](_0xdc43('0x1e'),_0x4ca6a5['id']));_0x4e8a00();});default:logger[_0xdc43('0xb')](util[_0xdc43('0x10')](_0xdc43('0x37'),_0x4ca6a5['id']));break;}}else{return BPromise[_0xdc43('0x38')]()['then'](function(){if(!_0x4ca6a5[_0xdc43('0x1f')]){throw new db[(_0xdc43('0x20'))]['ValidationError'](_0xdc43('0x22'));}if(!_0x7f010f['sentiment']||!_0x7f010f['sentimentAccountId']||!_0x7f010f['sentimentRegion']||!_0x7f010f['language']||!_0x7f010f[_0xdc43('0x27')]){throw new db[(_0xdc43('0x20'))]['ValidationError'](_0xdc43('0x39'));}if(!_0x4ca6a5[_0xdc43('0x15')]){throw new Error(_0xdc43('0x28'));}if(_0x7f010f[_0xdc43('0x24')]===_0x198087['id']){return _0x198087;}else{return db[_0xdc43('0x29')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xdc43('0xf')](function(_0x12754b){if(!_0x12754b){throw new db['Sequelize'][(_0xdc43('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x12754b[_0xdc43('0xd')]||!_0x12754b[_0xdc43('0x2c')]){throw new db['Sequelize'][(_0xdc43('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x4739ed=_0x12754b;logger[_0xdc43('0xb')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4ca6a5['id']));return sentiment(_0x4739ed['data1'],_0x4739ed[_0xdc43('0x2c')],_0x7f010f[_0xdc43('0x25')],_0x4ca6a5[_0xdc43('0x15')],_0x7f010f[_0xdc43('0x26')]);})['then'](function(_0x4fe721){logger[_0xdc43('0xb')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4ca6a5['id']));return _0x4ca6a5['update']({'sentiment':_0x4fe721[_0xdc43('0x3a')],'sPositive':_0x4fe721['SentimentScore'][_0xdc43('0x32')],'sNegative':_0x4fe721[_0xdc43('0x31')][_0xdc43('0x33')],'sMixed':_0x4fe721[_0xdc43('0x31')][_0xdc43('0x34')],'sNeutral':_0x4fe721[_0xdc43('0x31')]['Neutral'],'transcribeStatus':_0xdc43('0x16')});})['then'](function(){logger['info'](util[_0xdc43('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4ca6a5['id']));_0x4e8a00();});}})[_0xdc43('0x3b')](function(_0xb80021){if(_0xb80021){if(!_0xb80021[_0xdc43('0x3c')]||_0xb80021['name']!==_0xdc43('0x3d')){logger['error'](util[_0xdc43('0x10')](_0xdc43('0x3e'),_0x4ca6a5['id']),util[_0xdc43('0x3f')](_0xb80021,{'showHidden':![],'depth':null}));}}_0x4e8a00();});});}function checkTranscribe(){var _0x3be710;var _0x3bb236;var _0x31525c;return db[_0xdc43('0x40')][_0xdc43('0x41')]({'where':{'transcribeStatus':_0xdc43('0x42')}})[_0xdc43('0xf')](function(_0x5c1df0){if(!_0x5c1df0||!_0x5c1df0['length']){throw new db[(_0xdc43('0x20'))]['ValidationError'](_0xdc43('0x43'));}_0x3be710=_0x5c1df0;return db['Setting'][_0xdc43('0x2a')]({'where':{'id':0x1}});})[_0xdc43('0xf')](function(_0x275faf){if(!_0x275faf){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))](_0xdc43('0x44'));}_0x3bb236=_0x275faf;if(!_0x3bb236[_0xdc43('0x6')]||!_0x3bb236[_0xdc43('0x45')]||!_0x3bb236['transcribeRegion']||!_0x3bb236[_0xdc43('0x26')]||!_0x3bb236[_0xdc43('0x27')]){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))](_0xdc43('0x46'));}return db[_0xdc43('0x29')][_0xdc43('0x2a')]({'where':{'id':_0x3bb236[_0xdc43('0x45')]}});})[_0xdc43('0xf')](function(_0x190bfc){if(!_0x190bfc){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))](_0xdc43('0x2b'));}if(!_0x190bfc['data1']||!_0x190bfc[_0xdc43('0x2c')]){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))](_0xdc43('0x2d'));}_0x31525c=_0x190bfc;var _0x210c0c=[];_0x3be710['forEach'](function(_0xdc4597){_0x210c0c[_0xdc43('0x47')](checkTranscribeJob(_0xdc4597,_0x3bb236,_0x31525c));});return BPromise['all'](_0x210c0c);})[_0xdc43('0x3b')](function(_0x5f948a){if(_0x5f948a){if(!_0x5f948a[_0xdc43('0x3c')]||_0x5f948a[_0xdc43('0x3c')]!==_0xdc43('0x3d')){logger[_0xdc43('0x48')](util['inspect'](_0x5f948a,{'showHidden':![],'depth':null}));}}});}exports[_0xdc43('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
+var _0x9812=['transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','Mixed','Neutral','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','catch','name','error','start','lodash','aws-sdk','request-promise','util','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','transcribeName','data1','data2'];(function(_0x412ac2,_0xc8dc0b){var _0x39b24d=function(_0x3df919){while(--_0x3df919){_0x412ac2['push'](_0x412ac2['shift']());}};_0x39b24d(++_0xc8dc0b);}(_0x9812,0x159));var _0x2981=function(_0x175395,_0x8bed5b){_0x175395=_0x175395-0x0;var _0x178161=_0x9812[_0x175395];return _0x178161;};var _=require(_0x2981('0x0'));var AWS=require(_0x2981('0x1'));var rp=require(_0x2981('0x2'));var util=require(_0x2981('0x3'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x2981('0x4'))(_0x2981('0x5'));function getTranscriptionJob(_0x4801db,_0x77ef1d,_0x14492b,_0x4a99fc){return new Promise(function(_0xffdceb,_0x109b9e){var _0x7dd589=new AWS[(_0x2981('0x6'))]({'accessKeyId':_0x77ef1d,'secretAccessKey':_0x4801db,'region':_0x14492b});_0x7dd589[_0x2981('0x7')]({'TranscriptionJobName':_0x4a99fc},function(_0x5b8775,_0x31afe0){if(_0x5b8775){return _0x109b9e(_0x5b8775);}else{return _0xffdceb(_0x31afe0);}});});}function sentiment(_0x3654c9,_0x4abe4f,_0x29534d,_0x3ae072,_0xe7f5cc){return new Promise(function(_0x4bbe34,_0x57c1c0){var _0x5df3e5=new AWS[(_0x2981('0x8'))]({'accessKeyId':_0x4abe4f,'secretAccessKey':_0x3654c9,'region':_0x29534d});_0x5df3e5['detectSentiment']({'Text':_0x3ae072,'LanguageCode':_0xe7f5cc[_0x2981('0x9')](0x0,0x2)},function(_0x2aa8be,_0x2c1165){if(_0x2aa8be){return _0x57c1c0(_0x2aa8be);}else{return _0x4bbe34(_0x2c1165);}});});}function checkTranscribeJob(_0x5aabb4,_0x350df8,_0x4f113a){var _0x5a5441;return new BPromise(function(_0x191629,_0x4cab8c){logger[_0x2981('0xa')](util[_0x2981('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5aabb4['id'],_0x5aabb4[_0x2981('0xc')]));return getTranscriptionJob(_0x4f113a[_0x2981('0xd')],_0x4f113a[_0x2981('0xe')],_0x350df8[_0x2981('0xf')],_0x5aabb4[_0x2981('0xc')])['then'](function(_0x1be7ac){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x10'),_0x5aabb4['id'],_0x5aabb4[_0x2981('0xc')],_0x1be7ac[_0x2981('0x11')][_0x2981('0x12')]));if(!_0x5aabb4[_0x2981('0x13')]){switch(_0x1be7ac[_0x2981('0x11')][_0x2981('0x12')]){case _0x2981('0x14'):var _0x4600de={'transcribeStatus':_0x1be7ac[_0x2981('0x11')]['TranscriptionJobStatus'],'fileUri':_0x1be7ac[_0x2981('0x11')][_0x2981('0x15')]['TranscriptFileUri']};logger[_0x2981('0xa')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x5aabb4['id']));return rp({'uri':_0x1be7ac['TranscriptionJob'][_0x2981('0x15')][_0x2981('0x16')],'json':!![]})[_0x2981('0x17')](function(_0x216c1f){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x18'),_0x5aabb4['id']));if(_0x216c1f&&_0x216c1f['results']&&_0x216c1f[_0x2981('0x19')][_0x2981('0x1a')]&&_0x216c1f[_0x2981('0x19')][_0x2981('0x1a')][_0x2981('0x1b')]){_0x4600de[_0x2981('0x13')]='';for(var _0x4bdb8d=0x0;_0x4bdb8d<_0x216c1f[_0x2981('0x19')][_0x2981('0x1a')]['length'];_0x4bdb8d++){_0x4600de[_0x2981('0x13')]+=_0x216c1f[_0x2981('0x19')][_0x2981('0x1a')][_0x4bdb8d]['transcript']+'';}}return _0x5aabb4[_0x2981('0x1c')](_0x4600de);})[_0x2981('0x17')](function(){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x1d'),_0x5aabb4['id']));if(!_0x5aabb4[_0x2981('0x1e')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x21'));}if(!_0x350df8[_0x2981('0x22')]||!_0x350df8[_0x2981('0x23')]||!_0x350df8[_0x2981('0x24')]||!_0x350df8['language']||!_0x350df8[_0x2981('0x25')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4600de[_0x2981('0x13')]){throw new Error(_0x2981('0x26'));}if(_0x350df8[_0x2981('0x23')]===_0x4f113a['id']){return _0x4f113a;}else{return db[_0x2981('0x27')][_0x2981('0x28')]({'where':{'id':_settings[_0x2981('0x23')]}});}})[_0x2981('0x17')](function(_0x4b791d){if(!_0x4b791d){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x29'));}if(!_0x4b791d[_0x2981('0xd')]||!_0x4b791d[_0x2981('0xe')]){throw new db['Sequelize']['ValidationError'](_0x2981('0x2a'));}_0x5a5441=_0x4b791d;logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x2b'),_0x5aabb4['id']));return sentiment(_0x5a5441['data1'],_0x5a5441[_0x2981('0xe')],_0x350df8[_0x2981('0x24')],_0x4600de['fileText'],_0x350df8[_0x2981('0x2c')]);})[_0x2981('0x17')](function(_0x782735){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x2d'),_0x5aabb4['id']));return _0x5aabb4[_0x2981('0x1c')]({'sentiment':_0x782735[_0x2981('0x2e')],'sPositive':_0x782735['SentimentScore'][_0x2981('0x2f')],'sNegative':_0x782735[_0x2981('0x30')][_0x2981('0x31')],'sMixed':_0x782735[_0x2981('0x30')]['Mixed'],'sNeutral':_0x782735[_0x2981('0x30')]['Neutral']});})[_0x2981('0x17')](function(){logger[_0x2981('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5aabb4['id']));_0x191629();});case _0x2981('0x32'):return _0x5aabb4[_0x2981('0x1c')]({'transcribeStatus':_0x2981('0x32'),'failureReason':_0x1be7ac[_0x2981('0x11')][_0x2981('0x33')]})['then'](function(){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x1d'),_0x5aabb4['id']));_0x191629();});default:logger[_0x2981('0xa')](util['format'](_0x2981('0x34'),_0x5aabb4['id']));break;}}else{return BPromise[_0x2981('0x35')]()[_0x2981('0x17')](function(){if(!_0x5aabb4[_0x2981('0x1e')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x21'));}if(!_0x350df8['sentiment']||!_0x350df8[_0x2981('0x23')]||!_0x350df8[_0x2981('0x24')]||!_0x350df8['language']||!_0x350df8[_0x2981('0x25')]){throw new db[(_0x2981('0x1f'))]['ValidationError'](_0x2981('0x36'));}if(!_0x5aabb4[_0x2981('0x13')]){throw new Error(_0x2981('0x26'));}if(_0x350df8[_0x2981('0x23')]===_0x4f113a['id']){return _0x4f113a;}else{return db[_0x2981('0x27')][_0x2981('0x28')]({'where':{'id':_settings[_0x2981('0x23')]}});}})[_0x2981('0x17')](function(_0x213bd2){if(!_0x213bd2){throw new db[(_0x2981('0x1f'))]['ValidationError'](_0x2981('0x29'));}if(!_0x213bd2['data1']||!_0x213bd2['data2']){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x2a'));}_0x5a5441=_0x213bd2;logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x2b'),_0x5aabb4['id']));return sentiment(_0x5a5441['data1'],_0x5a5441[_0x2981('0xe')],_0x350df8[_0x2981('0x24')],_0x5aabb4['fileText'],_0x350df8[_0x2981('0x2c')]);})['then'](function(_0x106c0a){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x2d'),_0x5aabb4['id']));return _0x5aabb4['update']({'sentiment':_0x106c0a[_0x2981('0x2e')],'sPositive':_0x106c0a['SentimentScore'][_0x2981('0x2f')],'sNegative':_0x106c0a['SentimentScore']['Negative'],'sMixed':_0x106c0a['SentimentScore'][_0x2981('0x37')],'sNeutral':_0x106c0a[_0x2981('0x30')][_0x2981('0x38')],'transcribeStatus':_0x2981('0x14')});})[_0x2981('0x17')](function(){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x1d'),_0x5aabb4['id']));_0x191629();});}})['catch'](function(_0x111dad){if(_0x111dad){if(!_0x111dad['name']||_0x111dad['name']!==_0x2981('0x39')){logger['error'](util[_0x2981('0xb')](_0x2981('0x3a'),_0x5aabb4['id']),util[_0x2981('0x3b')](_0x111dad,{'showHidden':![],'depth':null}));}}_0x191629();});});}function checkTranscribe(){var _0x337fa9;var _0xbb2dc8;var _0x36af38;return db[_0x2981('0x3c')]['findAll']({'where':{'transcribeStatus':_0x2981('0x3d')}})['then'](function(_0x522362){if(!_0x522362||!_0x522362[_0x2981('0x1b')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x3e'));}_0x337fa9=_0x522362;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](function(_0x4d9724){if(!_0x4d9724){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x3f'));}_0xbb2dc8=_0x4d9724;if(!_0xbb2dc8['transcribe']||!_0xbb2dc8[_0x2981('0x40')]||!_0xbb2dc8[_0x2981('0xf')]||!_0xbb2dc8[_0x2981('0x2c')]||!_0xbb2dc8[_0x2981('0x25')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x41'));}return db['CloudProvider'][_0x2981('0x28')]({'where':{'id':_0xbb2dc8[_0x2981('0x40')]}});})[_0x2981('0x17')](function(_0x48bbf4){if(!_0x48bbf4){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x48bbf4[_0x2981('0xd')]||!_0x48bbf4['data2']){throw new db[(_0x2981('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x36af38=_0x48bbf4;var _0x25f493=[];_0x337fa9[_0x2981('0x42')](function(_0x17ab4f){_0x25f493['push'](checkTranscribeJob(_0x17ab4f,_0xbb2dc8,_0x36af38));});return BPromise[_0x2981('0x43')](_0x25f493);})[_0x2981('0x44')](function(_0x436951){if(_0x436951){if(!_0x436951[_0x2981('0x45')]||_0x436951[_0x2981('0x45')]!==_0x2981('0x39')){logger[_0x2981('0x46')](util[_0x2981('0x3b')](_0x436951,{'showHidden':![],'depth':null}));}}});}exports[_0x2981('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file