Built motion from commit 44377920.|2.6.11
[motion2.git] / server / config / schedule / transcribe.js
index 82c5b58..631793b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f72=['Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','update','SentimentScore','Positive','Negative','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment','Mixed','Neutral','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','catch','SequelizeValidationError','start','lodash','aws-sdk','request-promise','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available'];(function(_0x42c2ad,_0x1368a2){var _0x1170cc=function(_0x5a8f81){while(--_0x5a8f81){_0x42c2ad['push'](_0x42c2ad['shift']());}};_0x1170cc(++_0x1368a2);}(_0x3f72,0xaf));var _0x23f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f72[_0x3dd15e];return _0x231fd0;};var _=require(_0x23f7('0x0'));var AWS=require(_0x23f7('0x1'));var rp=require(_0x23f7('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x23f7('0x3'))['db'];var logger=require(_0x23f7('0x4'))(_0x23f7('0x5'));function getTranscriptionJob(_0x2cfaf0,_0x174f4f,_0x4cfd91,_0x3dcbeb){return new Promise(function(_0x4d8274,_0xac4499){var _0x5cc54a=new AWS[(_0x23f7('0x6'))]({'accessKeyId':_0x174f4f,'secretAccessKey':_0x2cfaf0,'region':_0x4cfd91});_0x5cc54a[_0x23f7('0x7')]({'TranscriptionJobName':_0x3dcbeb},function(_0x412d29,_0x258026){if(_0x412d29){return _0xac4499(_0x412d29);}else{return _0x4d8274(_0x258026);}});});}function sentiment(_0xccd3c0,_0x1cdd69,_0x3a048c,_0x34f4e7,_0x175823){return new Promise(function(_0x32301c,_0x5db601){var _0x71dd7e=new AWS[(_0x23f7('0x8'))]({'accessKeyId':_0x1cdd69,'secretAccessKey':_0xccd3c0,'region':_0x3a048c});_0x71dd7e[_0x23f7('0x9')]({'Text':_0x34f4e7,'LanguageCode':_0x175823['substring'](0x0,0x2)},function(_0x54f8e1,_0xaa0464){if(_0x54f8e1){return _0x5db601(_0x54f8e1);}else{return _0x32301c(_0xaa0464);}});});}function checkTranscribeJob(_0x401ced,_0x35c62e,_0x304748){var _0x37510b;return new BPromise(function(_0x5515f6,_0x416a12){logger[_0x23f7('0xa')](util[_0x23f7('0xb')](_0x23f7('0xc'),_0x401ced['id'],_0x401ced['transcribeName']));return getTranscriptionJob(_0x304748[_0x23f7('0xd')],_0x304748[_0x23f7('0xe')],_0x35c62e[_0x23f7('0xf')],_0x401ced[_0x23f7('0x10')])[_0x23f7('0x11')](function(_0x436512){logger[_0x23f7('0xa')](util['format'](_0x23f7('0x12'),_0x401ced['id'],_0x401ced[_0x23f7('0x10')],_0x436512['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x401ced[_0x23f7('0x13')]){switch(_0x436512[_0x23f7('0x14')][_0x23f7('0x15')]){case _0x23f7('0x16'):var _0x5a110a={'transcribeStatus':_0x436512[_0x23f7('0x14')][_0x23f7('0x15')],'fileUri':_0x436512[_0x23f7('0x14')]['Transcript'][_0x23f7('0x17')]};logger[_0x23f7('0xa')](util[_0x23f7('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x401ced['id']));return rp({'uri':_0x436512['TranscriptionJob'][_0x23f7('0x18')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x1f82d4){logger[_0x23f7('0xa')](util['format'](_0x23f7('0x19'),_0x401ced['id']));if(_0x1f82d4&&_0x1f82d4[_0x23f7('0x1a')]&&_0x1f82d4['results'][_0x23f7('0x1b')]&&_0x1f82d4[_0x23f7('0x1a')][_0x23f7('0x1b')]['length']){_0x5a110a['fileText']='';for(var _0x2f84c3=0x0;_0x2f84c3<_0x1f82d4[_0x23f7('0x1a')][_0x23f7('0x1b')]['length'];_0x2f84c3++){_0x5a110a[_0x23f7('0x13')]+=_0x1f82d4['results'][_0x23f7('0x1b')][_0x2f84c3][_0x23f7('0x1c')]+'';}}return _0x401ced['update'](_0x5a110a);})[_0x23f7('0x11')](function(){logger[_0x23f7('0xa')](util[_0x23f7('0xb')](_0x23f7('0x1d'),_0x401ced['id']));if(!_0x401ced[_0x23f7('0x1e')]){throw new db['Sequelize'][(_0x23f7('0x1f'))](_0x23f7('0x20'));}if(!_0x35c62e[_0x23f7('0x21')]||!_0x35c62e[_0x23f7('0x22')]||!_0x35c62e[_0x23f7('0x23')]||!_0x35c62e[_0x23f7('0x24')]||!_0x35c62e[_0x23f7('0x25')]){throw new db[(_0x23f7('0x26'))][(_0x23f7('0x1f'))](_0x23f7('0x27'));}if(!_0x5a110a[_0x23f7('0x13')]){throw new Error(_0x23f7('0x28'));}if(_0x35c62e['sentimentAccountId']===_0x304748['id']){return _0x304748;}else{return db[_0x23f7('0x29')][_0x23f7('0x2a')]({'where':{'id':_settings[_0x23f7('0x22')]}});}})['then'](function(_0x378e88){if(!_0x378e88){throw new db[(_0x23f7('0x26'))][(_0x23f7('0x1f'))](_0x23f7('0x2b'));}if(!_0x378e88[_0x23f7('0xd')]||!_0x378e88[_0x23f7('0xe')]){throw new db['Sequelize'][(_0x23f7('0x1f'))](_0x23f7('0x2c'));}_0x37510b=_0x378e88;logger[_0x23f7('0xa')](util[_0x23f7('0xb')](_0x23f7('0x2d'),_0x401ced['id']));return sentiment(_0x37510b[_0x23f7('0xd')],_0x37510b[_0x23f7('0xe')],_0x35c62e[_0x23f7('0x23')],_0x5a110a['fileText'],_0x35c62e[_0x23f7('0x24')]);})[_0x23f7('0x11')](function(_0x39bf46){logger[_0x23f7('0xa')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x401ced['id']));return _0x401ced[_0x23f7('0x2e')]({'sentiment':_0x39bf46['Sentiment'],'sPositive':_0x39bf46[_0x23f7('0x2f')][_0x23f7('0x30')],'sNegative':_0x39bf46[_0x23f7('0x2f')][_0x23f7('0x31')],'sMixed':_0x39bf46['SentimentScore']['Mixed'],'sNeutral':_0x39bf46[_0x23f7('0x2f')]['Neutral']});})['then'](function(){logger[_0x23f7('0xa')](util[_0x23f7('0xb')](_0x23f7('0x1d'),_0x401ced['id']));_0x5515f6();});case _0x23f7('0x32'):return _0x401ced[_0x23f7('0x2e')]({'transcribeStatus':_0x23f7('0x32'),'failureReason':_0x436512[_0x23f7('0x14')][_0x23f7('0x33')]})['then'](function(){logger[_0x23f7('0xa')](util[_0x23f7('0xb')](_0x23f7('0x1d'),_0x401ced['id']));_0x5515f6();});default:logger[_0x23f7('0xa')](util[_0x23f7('0xb')](_0x23f7('0x34'),_0x401ced['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x401ced[_0x23f7('0x1e')]){throw new db[(_0x23f7('0x26'))][(_0x23f7('0x1f'))](_0x23f7('0x20'));}if(!_0x35c62e[_0x23f7('0x21')]||!_0x35c62e[_0x23f7('0x22')]||!_0x35c62e['sentimentRegion']||!_0x35c62e[_0x23f7('0x24')]||!_0x35c62e[_0x23f7('0x25')]){throw new db[(_0x23f7('0x26'))][(_0x23f7('0x1f'))](_0x23f7('0x27'));}if(!_0x401ced[_0x23f7('0x13')]){throw new Error(_0x23f7('0x28'));}if(_0x35c62e[_0x23f7('0x22')]===_0x304748['id']){return _0x304748;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x23f7('0x11')](function(_0x9c5615){if(!_0x9c5615){throw new db[(_0x23f7('0x26'))][(_0x23f7('0x1f'))](_0x23f7('0x2b'));}if(!_0x9c5615[_0x23f7('0xd')]||!_0x9c5615[_0x23f7('0xe')]){throw new db['Sequelize'][(_0x23f7('0x1f'))](_0x23f7('0x2c'));}_0x37510b=_0x9c5615;logger[_0x23f7('0xa')](util[_0x23f7('0xb')](_0x23f7('0x2d'),_0x401ced['id']));return sentiment(_0x37510b[_0x23f7('0xd')],_0x37510b['data2'],_0x35c62e[_0x23f7('0x23')],_0x401ced[_0x23f7('0x13')],_0x35c62e['language']);})[_0x23f7('0x11')](function(_0x259863){logger[_0x23f7('0xa')](util[_0x23f7('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x401ced['id']));return _0x401ced[_0x23f7('0x2e')]({'sentiment':_0x259863[_0x23f7('0x35')],'sPositive':_0x259863[_0x23f7('0x2f')][_0x23f7('0x30')],'sNegative':_0x259863[_0x23f7('0x2f')]['Negative'],'sMixed':_0x259863[_0x23f7('0x2f')][_0x23f7('0x36')],'sNeutral':_0x259863[_0x23f7('0x2f')][_0x23f7('0x37')],'transcribeStatus':'COMPLETED'});})[_0x23f7('0x11')](function(){logger[_0x23f7('0xa')](util['format'](_0x23f7('0x1d'),_0x401ced['id']));_0x5515f6();});}})['catch'](function(_0x465ef7){if(_0x465ef7){if(!_0x465ef7['name']||_0x465ef7[_0x23f7('0x38')]!=='SequelizeValidationError'){logger[_0x23f7('0x39')](util[_0x23f7('0xb')](_0x23f7('0x3a'),_0x401ced['id']),util[_0x23f7('0x3b')](_0x465ef7,{'showHidden':![],'depth':null}));}}_0x5515f6();});});}function checkTranscribe(){var _0x425d72;var _0x528f96;var _0x3066f9;return db[_0x23f7('0x3c')][_0x23f7('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x23f7('0x11')](function(_0x121435){if(!_0x121435||!_0x121435[_0x23f7('0x3e')]){throw new db[(_0x23f7('0x26'))][(_0x23f7('0x1f'))](_0x23f7('0x3f'));}_0x425d72=_0x121435;return db[_0x23f7('0x40')]['findOne']({'where':{'id':0x1}});})[_0x23f7('0x11')](function(_0x1a5a4f){if(!_0x1a5a4f){throw new db[(_0x23f7('0x26'))]['ValidationError'](_0x23f7('0x41'));}_0x528f96=_0x1a5a4f;if(!_0x528f96[_0x23f7('0x5')]||!_0x528f96[_0x23f7('0x42')]||!_0x528f96[_0x23f7('0xf')]||!_0x528f96[_0x23f7('0x24')]||!_0x528f96[_0x23f7('0x25')]){throw new db[(_0x23f7('0x26'))][(_0x23f7('0x1f'))](_0x23f7('0x43'));}return db[_0x23f7('0x29')][_0x23f7('0x2a')]({'where':{'id':_0x528f96[_0x23f7('0x42')]}});})['then'](function(_0x2531e7){if(!_0x2531e7){throw new db['Sequelize']['ValidationError'](_0x23f7('0x2b'));}if(!_0x2531e7[_0x23f7('0xd')]||!_0x2531e7[_0x23f7('0xe')]){throw new db['Sequelize'][(_0x23f7('0x1f'))](_0x23f7('0x2c'));}_0x3066f9=_0x2531e7;var _0x16a0b3=[];_0x425d72[_0x23f7('0x44')](function(_0x1fe08e){_0x16a0b3['push'](checkTranscribeJob(_0x1fe08e,_0x528f96,_0x3066f9));});return BPromise[_0x23f7('0x45')](_0x16a0b3);})[_0x23f7('0x46')](function(_0x225b1e){if(_0x225b1e){if(!_0x225b1e[_0x23f7('0x38')]||_0x225b1e[_0x23f7('0x38')]!==_0x23f7('0x47')){logger[_0x23f7('0x39')](util[_0x23f7('0x3b')](_0x225b1e,{'showHidden':![],'depth':null}));}}});}exports[_0x23f7('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
+var _0xcd31=['TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','info','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','sentiment','sentimentRegion','findOne','Mixed','catch','SequelizeValidationError','error','[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','Cloud\x20Provider\x20not\x20configured','forEach','push','all','name','start','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','fileText','TranscriptionJob'];(function(_0xf76903,_0x266c90){var _0x5a0085=function(_0x19d395){while(--_0x19d395){_0xf76903['push'](_0xf76903['shift']());}};_0x5a0085(++_0x266c90);}(_0xcd31,0x15d));var _0x1cd3=function(_0x45fc52,_0x5d7015){_0x45fc52=_0x45fc52-0x0;var _0x4a2d8f=_0xcd31[_0x45fc52];return _0x4a2d8f;};var _=require('lodash');var AWS=require(_0x1cd3('0x0'));var rp=require(_0x1cd3('0x1'));var util=require(_0x1cd3('0x2'));var BPromise=require('bluebird');var db=require(_0x1cd3('0x3'))['db'];var logger=require(_0x1cd3('0x4'))(_0x1cd3('0x5'));function getTranscriptionJob(_0x28c67f,_0x295933,_0xf9f49b,_0x5bc77d){return new Promise(function(_0x26ffcb,_0x1ca151){var _0xedb6d1=new AWS['TranscribeService']({'accessKeyId':_0x295933,'secretAccessKey':_0x28c67f,'region':_0xf9f49b});_0xedb6d1[_0x1cd3('0x6')]({'TranscriptionJobName':_0x5bc77d},function(_0x11b139,_0x124659){if(_0x11b139){return _0x1ca151(_0x11b139);}else{return _0x26ffcb(_0x124659);}});});}function sentiment(_0x4a2204,_0x1af2c4,_0x3953d3,_0x17d5c8,_0xb3159f){return new Promise(function(_0x406bc8,_0x3eb8af){var _0x7e5c1a=new AWS['Comprehend']({'accessKeyId':_0x1af2c4,'secretAccessKey':_0x4a2204,'region':_0x3953d3});_0x7e5c1a[_0x1cd3('0x7')]({'Text':_0x17d5c8,'LanguageCode':_0xb3159f[_0x1cd3('0x8')](0x0,0x2)},function(_0x2e460d,_0x44010d){if(_0x2e460d){return _0x3eb8af(_0x2e460d);}else{return _0x406bc8(_0x44010d);}});});}function checkTranscribeJob(_0x5102af,_0xfe288e,_0x4c9c6d){var _0x41016f;return new BPromise(function(_0x35a9ae,_0x3fcc45){logger['info'](util['format'](_0x1cd3('0x9'),_0x5102af['id'],_0x5102af[_0x1cd3('0xa')]));return getTranscriptionJob(_0x4c9c6d[_0x1cd3('0xb')],_0x4c9c6d['data2'],_0xfe288e[_0x1cd3('0xc')],_0x5102af[_0x1cd3('0xa')])[_0x1cd3('0xd')](function(_0x418da3){logger['info'](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5102af['id'],_0x5102af['transcribeName'],_0x418da3['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x5102af[_0x1cd3('0xe')]){switch(_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x10')]){case _0x1cd3('0x11'):var _0x359899={'transcribeStatus':_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x10')],'fileUri':_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x12')][_0x1cd3('0x13')]};logger['info'](util[_0x1cd3('0x14')](_0x1cd3('0x15'),_0x5102af['id']));return rp({'uri':_0x418da3['TranscriptionJob'][_0x1cd3('0x12')][_0x1cd3('0x13')],'json':!![]})['then'](function(_0x20cda5){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x17'),_0x5102af['id']));if(_0x20cda5&&_0x20cda5['results']&&_0x20cda5['results'][_0x1cd3('0x18')]&&_0x20cda5[_0x1cd3('0x19')]['transcripts']['length']){_0x359899[_0x1cd3('0xe')]='';for(var _0x44b162=0x0;_0x44b162<_0x20cda5['results']['transcripts'][_0x1cd3('0x1a')];_0x44b162++){_0x359899[_0x1cd3('0xe')]+=_0x20cda5['results']['transcripts'][_0x44b162][_0x1cd3('0x1b')]+'';}}return _0x5102af[_0x1cd3('0x1c')](_0x359899);})[_0x1cd3('0xd')](function(){logger['info'](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));if(!_0x5102af['tempSentiment']){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x20'));}if(!_0xfe288e['sentiment']||!_0xfe288e[_0x1cd3('0x21')]||!_0xfe288e['sentimentRegion']||!_0xfe288e[_0x1cd3('0x22')]||!_0xfe288e[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError'](_0x1cd3('0x24'));}if(!_0x359899[_0x1cd3('0xe')]){throw new Error(_0x1cd3('0x25'));}if(_0xfe288e[_0x1cd3('0x21')]===_0x4c9c6d['id']){return _0x4c9c6d;}else{return db[_0x1cd3('0x26')]['findOne']({'where':{'id':_settings[_0x1cd3('0x21')]}});}})[_0x1cd3('0xd')](function(_0x1412cb){if(!_0x1412cb){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x27'));}if(!_0x1412cb['data1']||!_0x1412cb[_0x1cd3('0x28')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x41016f=_0x1412cb;logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x29'),_0x5102af['id']));return sentiment(_0x41016f[_0x1cd3('0xb')],_0x41016f[_0x1cd3('0x28')],_0xfe288e['sentimentRegion'],_0x359899[_0x1cd3('0xe')],_0xfe288e['language']);})['then'](function(_0x1633af){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x2a'),_0x5102af['id']));return _0x5102af['update']({'sentiment':_0x1633af[_0x1cd3('0x2b')],'sPositive':_0x1633af['SentimentScore'][_0x1cd3('0x2c')],'sNegative':_0x1633af[_0x1cd3('0x2d')][_0x1cd3('0x2e')],'sMixed':_0x1633af[_0x1cd3('0x2d')]['Mixed'],'sNeutral':_0x1633af['SentimentScore'][_0x1cd3('0x2f')]});})['then'](function(){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});case _0x1cd3('0x30'):return _0x5102af[_0x1cd3('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x418da3['TranscriptionJob']['FailureReason']})['then'](function(){logger[_0x1cd3('0x16')](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});default:logger['info'](util[_0x1cd3('0x14')](_0x1cd3('0x31'),_0x5102af['id']));break;}}else{return BPromise['resolve']()[_0x1cd3('0xd')](function(){if(!_0x5102af[_0x1cd3('0x32')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xfe288e[_0x1cd3('0x33')]||!_0xfe288e[_0x1cd3('0x21')]||!_0xfe288e[_0x1cd3('0x34')]||!_0xfe288e[_0x1cd3('0x22')]||!_0xfe288e[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x24'));}if(!_0x5102af[_0x1cd3('0xe')]){throw new Error('Transcript\x20not\x20available');}if(_0xfe288e['sentimentAccountId']===_0x4c9c6d['id']){return _0x4c9c6d;}else{return db['CloudProvider'][_0x1cd3('0x35')]({'where':{'id':_settings[_0x1cd3('0x21')]}});}})['then'](function(_0x2eeea6){if(!_0x2eeea6){throw new db['Sequelize'][(_0x1cd3('0x1f'))](_0x1cd3('0x27'));}if(!_0x2eeea6[_0x1cd3('0xb')]||!_0x2eeea6[_0x1cd3('0x28')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x41016f=_0x2eeea6;logger[_0x1cd3('0x16')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5102af['id']));return sentiment(_0x41016f[_0x1cd3('0xb')],_0x41016f['data2'],_0xfe288e[_0x1cd3('0x34')],_0x5102af[_0x1cd3('0xe')],_0xfe288e[_0x1cd3('0x22')]);})[_0x1cd3('0xd')](function(_0x326a80){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x2a'),_0x5102af['id']));return _0x5102af['update']({'sentiment':_0x326a80[_0x1cd3('0x2b')],'sPositive':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x2c')],'sNegative':_0x326a80['SentimentScore']['Negative'],'sMixed':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x36')],'sNeutral':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x2f')],'transcribeStatus':_0x1cd3('0x11')});})[_0x1cd3('0xd')](function(){logger[_0x1cd3('0x16')](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});}})[_0x1cd3('0x37')](function(_0xbc7fbe){if(_0xbc7fbe){if(!_0xbc7fbe['name']||_0xbc7fbe['name']!==_0x1cd3('0x38')){logger[_0x1cd3('0x39')](util[_0x1cd3('0x14')](_0x1cd3('0x3a'),_0x5102af['id']),util[_0x1cd3('0x3b')](_0xbc7fbe,{'showHidden':![],'depth':null}));}}_0x35a9ae();});});}function checkTranscribe(){var _0x4e746b;var _0x5da126;var _0x500fcf;return db[_0x1cd3('0x3c')][_0x1cd3('0x3d')]({'where':{'transcribeStatus':_0x1cd3('0x3e')}})[_0x1cd3('0xd')](function(_0x1ae177){if(!_0x1ae177||!_0x1ae177['length']){throw new db['Sequelize'][(_0x1cd3('0x1f'))](_0x1cd3('0x3f'));}_0x4e746b=_0x1ae177;return db['Setting'][_0x1cd3('0x35')]({'where':{'id':0x1}});})[_0x1cd3('0xd')](function(_0x2542f6){if(!_0x2542f6){throw new db['Sequelize']['ValidationError'](_0x1cd3('0x40'));}_0x5da126=_0x2542f6;if(!_0x5da126['transcribe']||!_0x5da126[_0x1cd3('0x41')]||!_0x5da126[_0x1cd3('0xc')]||!_0x5da126[_0x1cd3('0x22')]||!_0x5da126[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x42'));}return db[_0x1cd3('0x26')]['findOne']({'where':{'id':_0x5da126[_0x1cd3('0x41')]}});})[_0x1cd3('0xd')](function(_0xbd4ea2){if(!_0xbd4ea2){throw new db[(_0x1cd3('0x1e'))]['ValidationError'](_0x1cd3('0x27'));}if(!_0xbd4ea2[_0x1cd3('0xb')]||!_0xbd4ea2[_0x1cd3('0x28')]){throw new db['Sequelize']['ValidationError'](_0x1cd3('0x43'));}_0x500fcf=_0xbd4ea2;var _0x5e31b2=[];_0x4e746b[_0x1cd3('0x44')](function(_0x233ef5){_0x5e31b2[_0x1cd3('0x45')](checkTranscribeJob(_0x233ef5,_0x5da126,_0x500fcf));});return BPromise[_0x1cd3('0x46')](_0x5e31b2);})['catch'](function(_0x12a2d0){if(_0x12a2d0){if(!_0x12a2d0[_0x1cd3('0x47')]||_0x12a2d0[_0x1cd3('0x47')]!==_0x1cd3('0x38')){logger['error'](util[_0x1cd3('0x3b')](_0x12a2d0,{'showHidden':![],'depth':null}));}}});}exports[_0x1cd3('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file