Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / config / schedule / transcribe.js
index deee3ab..09d2b22 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb81b=['../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','Negative','COMPLETED','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','CloudProvider','forEach','push','all','start','lodash','request-promise','util','bluebird'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xb81b,0x1be));var _0xbb81=function(_0x3a9d35,_0x1c60d6){_0x3a9d35=_0x3a9d35-0x0;var _0x2a7d47=_0xb81b[_0x3a9d35];return _0x2a7d47;};var _=require(_0xbb81('0x0'));var AWS=require('aws-sdk');var rp=require(_0xbb81('0x1'));var util=require(_0xbb81('0x2'));var BPromise=require(_0xbb81('0x3'));var db=require(_0xbb81('0x4'))['db'];var logger=require('../../config/logger')(_0xbb81('0x5'));function getTranscriptionJob(_0x27868f,_0x1ce31e,_0x9f5a23,_0x41ec2){return new Promise(function(_0x372910,_0x5e2ac6){var _0x33864d=new AWS[(_0xbb81('0x6'))]({'accessKeyId':_0x1ce31e,'secretAccessKey':_0x27868f,'region':_0x9f5a23});_0x33864d[_0xbb81('0x7')]({'TranscriptionJobName':_0x41ec2},function(_0x3236c3,_0x13bdeb){if(_0x3236c3){return _0x5e2ac6(_0x3236c3);}else{return _0x372910(_0x13bdeb);}});});}function sentiment(_0x2ee201,_0x166997,_0x2839ec,_0x256999,_0x393f7e){return new Promise(function(_0x4788c4,_0x47a6ad){var _0x5bb6a1=new AWS[(_0xbb81('0x8'))]({'accessKeyId':_0x166997,'secretAccessKey':_0x2ee201,'region':_0x2839ec});_0x5bb6a1[_0xbb81('0x9')]({'Text':_0x256999,'LanguageCode':_0x393f7e[_0xbb81('0xa')](0x0,0x2)},function(_0x57bb47,_0x34e650){if(_0x57bb47){return _0x47a6ad(_0x57bb47);}else{return _0x4788c4(_0x34e650);}});});}function checkTranscribeJob(_0x3c9a16,_0x2a2784,_0x5939f6){var _0x57dedf;return new BPromise(function(_0x5bc168,_0x1e7497){logger['info'](util[_0xbb81('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3c9a16['id'],_0x3c9a16[_0xbb81('0xc')]));return getTranscriptionJob(_0x5939f6[_0xbb81('0xd')],_0x5939f6[_0xbb81('0xe')],_0x2a2784[_0xbb81('0xf')],_0x3c9a16[_0xbb81('0xc')])[_0xbb81('0x10')](function(_0x3c55ce){logger[_0xbb81('0x11')](util[_0xbb81('0xb')](_0xbb81('0x12'),_0x3c9a16['id'],_0x3c9a16[_0xbb81('0xc')],_0x3c55ce[_0xbb81('0x13')][_0xbb81('0x14')]));if(!_0x3c9a16['fileText']){switch(_0x3c55ce['TranscriptionJob'][_0xbb81('0x14')]){case'COMPLETED':var _0x321f83={'transcribeStatus':_0x3c55ce[_0xbb81('0x13')][_0xbb81('0x14')],'fileUri':_0x3c55ce[_0xbb81('0x13')][_0xbb81('0x15')][_0xbb81('0x16')]};logger[_0xbb81('0x11')](util[_0xbb81('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x3c9a16['id']));return rp({'uri':_0x3c55ce[_0xbb81('0x13')][_0xbb81('0x15')][_0xbb81('0x16')],'json':!![]})['then'](function(_0x26bbef){logger['info'](util[_0xbb81('0xb')](_0xbb81('0x17'),_0x3c9a16['id']));if(_0x26bbef&&_0x26bbef[_0xbb81('0x18')]&&_0x26bbef[_0xbb81('0x18')][_0xbb81('0x19')]&&_0x26bbef[_0xbb81('0x18')][_0xbb81('0x19')]['length']){_0x321f83[_0xbb81('0x1a')]='';for(var _0x43feec=0x0;_0x43feec<_0x26bbef[_0xbb81('0x18')][_0xbb81('0x19')][_0xbb81('0x1b')];_0x43feec++){_0x321f83[_0xbb81('0x1a')]+=_0x26bbef[_0xbb81('0x18')][_0xbb81('0x19')][_0x43feec]['transcript']+'';}}return _0x3c9a16['update'](_0x321f83);})[_0xbb81('0x10')](function(){logger['info'](util[_0xbb81('0xb')](_0xbb81('0x1c'),_0x3c9a16['id']));if(!_0x3c9a16['tempSentiment']){throw new db['Sequelize'][(_0xbb81('0x1d'))](_0xbb81('0x1e'));}if(!_0x2a2784[_0xbb81('0x1f')]||!_0x2a2784[_0xbb81('0x20')]||!_0x2a2784[_0xbb81('0x21')]||!_0x2a2784[_0xbb81('0x22')]||!_0x2a2784[_0xbb81('0x23')]){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x321f83['fileText']){throw new Error(_0xbb81('0x25'));}if(_0x2a2784[_0xbb81('0x20')]===_0x5939f6['id']){return _0x5939f6;}else{return db['CloudProvider'][_0xbb81('0x26')]({'where':{'id':_settings[_0xbb81('0x20')]}});}})[_0xbb81('0x10')](function(_0x363e2a){if(!_0x363e2a){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))](_0xbb81('0x27'));}if(!_0x363e2a[_0xbb81('0xd')]||!_0x363e2a['data2']){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))](_0xbb81('0x28'));}_0x57dedf=_0x363e2a;logger[_0xbb81('0x11')](util[_0xbb81('0xb')](_0xbb81('0x29'),_0x3c9a16['id']));return sentiment(_0x57dedf['data1'],_0x57dedf['data2'],_0x2a2784[_0xbb81('0x21')],_0x321f83[_0xbb81('0x1a')],_0x2a2784[_0xbb81('0x22')]);})[_0xbb81('0x10')](function(_0x4836e2){logger[_0xbb81('0x11')](util['format'](_0xbb81('0x2a'),_0x3c9a16['id']));return _0x3c9a16[_0xbb81('0x2b')]({'sentiment':_0x4836e2[_0xbb81('0x2c')],'sPositive':_0x4836e2[_0xbb81('0x2d')][_0xbb81('0x2e')],'sNegative':_0x4836e2[_0xbb81('0x2d')]['Negative'],'sMixed':_0x4836e2['SentimentScore'][_0xbb81('0x2f')],'sNeutral':_0x4836e2[_0xbb81('0x2d')][_0xbb81('0x30')]});})[_0xbb81('0x10')](function(){logger['info'](util[_0xbb81('0xb')](_0xbb81('0x1c'),_0x3c9a16['id']));_0x5bc168();});case _0xbb81('0x31'):return _0x3c9a16[_0xbb81('0x2b')]({'transcribeStatus':_0xbb81('0x31'),'failureReason':_0x3c55ce[_0xbb81('0x13')][_0xbb81('0x32')]})[_0xbb81('0x10')](function(){logger[_0xbb81('0x11')](util[_0xbb81('0xb')](_0xbb81('0x1c'),_0x3c9a16['id']));_0x5bc168();});default:logger[_0xbb81('0x11')](util[_0xbb81('0xb')](_0xbb81('0x33'),_0x3c9a16['id']));break;}}else{return BPromise[_0xbb81('0x34')]()[_0xbb81('0x10')](function(){if(!_0x3c9a16[_0xbb81('0x35')]){throw new db['Sequelize'][(_0xbb81('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2a2784[_0xbb81('0x1f')]||!_0x2a2784['sentimentAccountId']||!_0x2a2784[_0xbb81('0x21')]||!_0x2a2784['language']||!_0x2a2784[_0xbb81('0x23')]){throw new db[(_0xbb81('0x24'))]['ValidationError'](_0xbb81('0x36'));}if(!_0x3c9a16[_0xbb81('0x1a')]){throw new Error('Transcript\x20not\x20available');}if(_0x2a2784[_0xbb81('0x20')]===_0x5939f6['id']){return _0x5939f6;}else{return db['CloudProvider'][_0xbb81('0x26')]({'where':{'id':_settings[_0xbb81('0x20')]}});}})[_0xbb81('0x10')](function(_0xf7b134){if(!_0xf7b134){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))](_0xbb81('0x27'));}if(!_0xf7b134[_0xbb81('0xd')]||!_0xf7b134[_0xbb81('0xe')]){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))](_0xbb81('0x28'));}_0x57dedf=_0xf7b134;logger[_0xbb81('0x11')](util['format'](_0xbb81('0x29'),_0x3c9a16['id']));return sentiment(_0x57dedf[_0xbb81('0xd')],_0x57dedf[_0xbb81('0xe')],_0x2a2784[_0xbb81('0x21')],_0x3c9a16['fileText'],_0x2a2784[_0xbb81('0x22')]);})[_0xbb81('0x10')](function(_0x51b433){logger[_0xbb81('0x11')](util[_0xbb81('0xb')](_0xbb81('0x2a'),_0x3c9a16['id']));return _0x3c9a16[_0xbb81('0x2b')]({'sentiment':_0x51b433['Sentiment'],'sPositive':_0x51b433[_0xbb81('0x2d')][_0xbb81('0x2e')],'sNegative':_0x51b433['SentimentScore'][_0xbb81('0x37')],'sMixed':_0x51b433[_0xbb81('0x2d')][_0xbb81('0x2f')],'sNeutral':_0x51b433[_0xbb81('0x2d')][_0xbb81('0x30')],'transcribeStatus':_0xbb81('0x38')});})['then'](function(){logger['info'](util[_0xbb81('0xb')](_0xbb81('0x1c'),_0x3c9a16['id']));_0x5bc168();});}})[_0xbb81('0x39')](function(_0x475674){if(_0x475674){if(!_0x475674[_0xbb81('0x3a')]||_0x475674[_0xbb81('0x3a')]!==_0xbb81('0x3b')){logger[_0xbb81('0x3c')](util[_0xbb81('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x3c9a16['id']),util[_0xbb81('0x3d')](_0x475674,{'showHidden':![],'depth':null}));}}_0x5bc168();});});}function checkTranscribe(){var _0x17b5c2;var _0x15bea8;var _0x4d3119;return db[_0xbb81('0x3e')][_0xbb81('0x3f')]({'where':{'transcribeStatus':_0xbb81('0x40')}})['then'](function(_0x47d4cd){if(!_0x47d4cd||!_0x47d4cd[_0xbb81('0x1b')]){throw new db['Sequelize'][(_0xbb81('0x1d'))](_0xbb81('0x41'));}_0x17b5c2=_0x47d4cd;return db[_0xbb81('0x42')]['findOne']({'where':{'id':0x1}});})[_0xbb81('0x10')](function(_0x2229f8){if(!_0x2229f8){throw new db['Sequelize'][(_0xbb81('0x1d'))](_0xbb81('0x43'));}_0x15bea8=_0x2229f8;if(!_0x15bea8[_0xbb81('0x5')]||!_0x15bea8[_0xbb81('0x44')]||!_0x15bea8['transcribeRegion']||!_0x15bea8['language']||!_0x15bea8['bucket']){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))](_0xbb81('0x45'));}return db[_0xbb81('0x46')][_0xbb81('0x26')]({'where':{'id':_0x15bea8[_0xbb81('0x44')]}});})[_0xbb81('0x10')](function(_0x2b4a02){if(!_0x2b4a02){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2b4a02[_0xbb81('0xd')]||!_0x2b4a02[_0xbb81('0xe')]){throw new db[(_0xbb81('0x24'))]['ValidationError'](_0xbb81('0x28'));}_0x4d3119=_0x2b4a02;var _0x547843=[];_0x17b5c2[_0xbb81('0x47')](function(_0x195436){_0x547843[_0xbb81('0x48')](checkTranscribeJob(_0x195436,_0x15bea8,_0x4d3119));});return BPromise[_0xbb81('0x49')](_0x547843);})[_0xbb81('0x39')](function(_0xfa294){if(_0xfa294){if(!_0xfa294[_0xbb81('0x3a')]||_0xfa294[_0xbb81('0x3a')]!==_0xbb81('0x3b')){logger[_0xbb81('0x3c')](util[_0xbb81('0x3d')](_0xfa294,{'showHidden':![],'depth':null}));}}});}exports[_0xbb81('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
+var _0x0a67=['FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','bucket','Sentiment\x20Analysis\x20not\x20configured','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sequelize','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral'];(function(_0x2dc621,_0x5b333c){var _0x48f1d8=function(_0x35963f){while(--_0x35963f){_0x2dc621['push'](_0x2dc621['shift']());}};_0x48f1d8(++_0x5b333c);}(_0x0a67,0xa6));var _0x70a6=function(_0xcccdce,_0xf569f8){_0xcccdce=_0xcccdce-0x0;var _0x2c378d=_0x0a67[_0xcccdce];return _0x2c378d;};var _=require(_0x70a6('0x0'));var AWS=require(_0x70a6('0x1'));var rp=require(_0x70a6('0x2'));var util=require(_0x70a6('0x3'));var BPromise=require(_0x70a6('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x70a6('0x5'))(_0x70a6('0x6'));function getTranscriptionJob(_0x3a4af5,_0x57163e,_0x57643c,_0x3bb056){return new Promise(function(_0xf943ac,_0x2d903c){var _0x1cf721=new AWS['TranscribeService']({'accessKeyId':_0x57163e,'secretAccessKey':_0x3a4af5,'region':_0x57643c});_0x1cf721[_0x70a6('0x7')]({'TranscriptionJobName':_0x3bb056},function(_0x4215eb,_0x4f2a49){if(_0x4215eb){return _0x2d903c(_0x4215eb);}else{return _0xf943ac(_0x4f2a49);}});});}function sentiment(_0x444d26,_0x49b5f8,_0x297bfb,_0xe34e5b,_0x4e02d2){return new Promise(function(_0x3c7f19,_0xc27b3c){var _0x2ea6d4=new AWS[(_0x70a6('0x8'))]({'accessKeyId':_0x49b5f8,'secretAccessKey':_0x444d26,'region':_0x297bfb});_0x2ea6d4[_0x70a6('0x9')]({'Text':_0xe34e5b,'LanguageCode':_0x4e02d2['substring'](0x0,0x2)},function(_0x301202,_0xa31c66){if(_0x301202){return _0xc27b3c(_0x301202);}else{return _0x3c7f19(_0xa31c66);}});});}function checkTranscribeJob(_0x47b4b9,_0x3d8f1e,_0x387535){var _0x225f3e;return new BPromise(function(_0x335b7e,_0x546bde){logger[_0x70a6('0xa')](util[_0x70a6('0xb')](_0x70a6('0xc'),_0x47b4b9['id'],_0x47b4b9[_0x70a6('0xd')]));return getTranscriptionJob(_0x387535[_0x70a6('0xe')],_0x387535['data2'],_0x3d8f1e[_0x70a6('0xf')],_0x47b4b9[_0x70a6('0xd')])[_0x70a6('0x10')](function(_0x4e0eda){logger[_0x70a6('0xa')](util['format'](_0x70a6('0x11'),_0x47b4b9['id'],_0x47b4b9[_0x70a6('0xd')],_0x4e0eda['TranscriptionJob'][_0x70a6('0x12')]));if(!_0x47b4b9['fileText']){switch(_0x4e0eda[_0x70a6('0x13')][_0x70a6('0x12')]){case _0x70a6('0x14'):var _0x25e2e9={'transcribeStatus':_0x4e0eda[_0x70a6('0x13')][_0x70a6('0x12')],'fileUri':_0x4e0eda[_0x70a6('0x13')][_0x70a6('0x15')][_0x70a6('0x16')]};logger[_0x70a6('0xa')](util[_0x70a6('0xb')](_0x70a6('0x17'),_0x47b4b9['id']));return rp({'uri':_0x4e0eda[_0x70a6('0x13')][_0x70a6('0x15')][_0x70a6('0x16')],'json':!![]})[_0x70a6('0x10')](function(_0x1dee9a){logger['info'](util[_0x70a6('0xb')](_0x70a6('0x18'),_0x47b4b9['id']));if(_0x1dee9a&&_0x1dee9a[_0x70a6('0x19')]&&_0x1dee9a[_0x70a6('0x19')][_0x70a6('0x1a')]&&_0x1dee9a[_0x70a6('0x19')]['transcripts'][_0x70a6('0x1b')]){_0x25e2e9[_0x70a6('0x1c')]='';for(var _0x2ad201=0x0;_0x2ad201<_0x1dee9a[_0x70a6('0x19')][_0x70a6('0x1a')][_0x70a6('0x1b')];_0x2ad201++){_0x25e2e9[_0x70a6('0x1c')]+=_0x1dee9a[_0x70a6('0x19')][_0x70a6('0x1a')][_0x2ad201][_0x70a6('0x1d')]+'';}}return _0x47b4b9[_0x70a6('0x1e')](_0x25e2e9);})[_0x70a6('0x10')](function(){logger[_0x70a6('0xa')](util[_0x70a6('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x47b4b9['id']));if(!_0x47b4b9[_0x70a6('0x1f')]){throw new db['Sequelize'][(_0x70a6('0x20'))](_0x70a6('0x21'));}if(!_0x3d8f1e[_0x70a6('0x22')]||!_0x3d8f1e[_0x70a6('0x23')]||!_0x3d8f1e[_0x70a6('0x24')]||!_0x3d8f1e[_0x70a6('0x25')]||!_0x3d8f1e['bucket']){throw new db[(_0x70a6('0x26'))][(_0x70a6('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x25e2e9[_0x70a6('0x1c')]){throw new Error(_0x70a6('0x27'));}if(_0x3d8f1e[_0x70a6('0x23')]===_0x387535['id']){return _0x387535;}else{return db[_0x70a6('0x28')][_0x70a6('0x29')]({'where':{'id':_settings[_0x70a6('0x23')]}});}})['then'](function(_0x4ebaaf){if(!_0x4ebaaf){throw new db[(_0x70a6('0x26'))]['ValidationError'](_0x70a6('0x2a'));}if(!_0x4ebaaf['data1']||!_0x4ebaaf[_0x70a6('0x2b')]){throw new db[(_0x70a6('0x26'))]['ValidationError'](_0x70a6('0x2c'));}_0x225f3e=_0x4ebaaf;logger[_0x70a6('0xa')](util[_0x70a6('0xb')](_0x70a6('0x2d'),_0x47b4b9['id']));return sentiment(_0x225f3e['data1'],_0x225f3e[_0x70a6('0x2b')],_0x3d8f1e[_0x70a6('0x24')],_0x25e2e9[_0x70a6('0x1c')],_0x3d8f1e[_0x70a6('0x25')]);})[_0x70a6('0x10')](function(_0x52fe87){logger['info'](util[_0x70a6('0xb')](_0x70a6('0x2e'),_0x47b4b9['id']));return _0x47b4b9['update']({'sentiment':_0x52fe87[_0x70a6('0x2f')],'sPositive':_0x52fe87['SentimentScore'][_0x70a6('0x30')],'sNegative':_0x52fe87[_0x70a6('0x31')][_0x70a6('0x32')],'sMixed':_0x52fe87[_0x70a6('0x31')][_0x70a6('0x33')],'sNeutral':_0x52fe87[_0x70a6('0x31')][_0x70a6('0x34')]});})[_0x70a6('0x10')](function(){logger[_0x70a6('0xa')](util[_0x70a6('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x47b4b9['id']));_0x335b7e();});case _0x70a6('0x35'):return _0x47b4b9['update']({'transcribeStatus':_0x70a6('0x35'),'failureReason':_0x4e0eda[_0x70a6('0x13')][_0x70a6('0x36')]})[_0x70a6('0x10')](function(){logger[_0x70a6('0xa')](util[_0x70a6('0xb')](_0x70a6('0x37'),_0x47b4b9['id']));_0x335b7e();});default:logger[_0x70a6('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x47b4b9['id']));break;}}else{return BPromise['resolve']()[_0x70a6('0x10')](function(){if(!_0x47b4b9[_0x70a6('0x1f')]){throw new db[(_0x70a6('0x26'))][(_0x70a6('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3d8f1e[_0x70a6('0x22')]||!_0x3d8f1e[_0x70a6('0x23')]||!_0x3d8f1e[_0x70a6('0x24')]||!_0x3d8f1e[_0x70a6('0x25')]||!_0x3d8f1e[_0x70a6('0x38')]){throw new db['Sequelize'][(_0x70a6('0x20'))](_0x70a6('0x39'));}if(!_0x47b4b9[_0x70a6('0x1c')]){throw new Error('Transcript\x20not\x20available');}if(_0x3d8f1e[_0x70a6('0x23')]===_0x387535['id']){return _0x387535;}else{return db[_0x70a6('0x28')][_0x70a6('0x29')]({'where':{'id':_settings[_0x70a6('0x23')]}});}})['then'](function(_0x4034ec){if(!_0x4034ec){throw new db[(_0x70a6('0x26'))]['ValidationError'](_0x70a6('0x2a'));}if(!_0x4034ec[_0x70a6('0xe')]||!_0x4034ec[_0x70a6('0x2b')]){throw new db['Sequelize']['ValidationError'](_0x70a6('0x2c'));}_0x225f3e=_0x4034ec;logger[_0x70a6('0xa')](util[_0x70a6('0xb')](_0x70a6('0x2d'),_0x47b4b9['id']));return sentiment(_0x225f3e[_0x70a6('0xe')],_0x225f3e[_0x70a6('0x2b')],_0x3d8f1e[_0x70a6('0x24')],_0x47b4b9['fileText'],_0x3d8f1e[_0x70a6('0x25')]);})[_0x70a6('0x10')](function(_0x231733){logger['info'](util[_0x70a6('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x47b4b9['id']));return _0x47b4b9[_0x70a6('0x1e')]({'sentiment':_0x231733[_0x70a6('0x2f')],'sPositive':_0x231733[_0x70a6('0x31')][_0x70a6('0x30')],'sNegative':_0x231733[_0x70a6('0x31')][_0x70a6('0x32')],'sMixed':_0x231733['SentimentScore']['Mixed'],'sNeutral':_0x231733[_0x70a6('0x31')][_0x70a6('0x34')],'transcribeStatus':_0x70a6('0x14')});})[_0x70a6('0x10')](function(){logger[_0x70a6('0xa')](util['format'](_0x70a6('0x37'),_0x47b4b9['id']));_0x335b7e();});}})['catch'](function(_0x4e11e1){if(_0x4e11e1){if(!_0x4e11e1[_0x70a6('0x3a')]||_0x4e11e1[_0x70a6('0x3a')]!==_0x70a6('0x3b')){logger[_0x70a6('0x3c')](util[_0x70a6('0xb')](_0x70a6('0x3d'),_0x47b4b9['id']),util[_0x70a6('0x3e')](_0x4e11e1,{'showHidden':![],'depth':null}));}}_0x335b7e();});});}function checkTranscribe(){var _0x3af504;var _0x5c8e99;var _0x527b97;return db['VoiceRecording'][_0x70a6('0x3f')]({'where':{'transcribeStatus':_0x70a6('0x40')}})['then'](function(_0x590e45){if(!_0x590e45||!_0x590e45[_0x70a6('0x1b')]){throw new db[(_0x70a6('0x26'))][(_0x70a6('0x20'))]('No\x20transcribe\x20job\x20to\x20check');}_0x3af504=_0x590e45;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x70a6('0x10')](function(_0x1c0497){if(!_0x1c0497){throw new db[(_0x70a6('0x26'))][(_0x70a6('0x20'))](_0x70a6('0x41'));}_0x5c8e99=_0x1c0497;if(!_0x5c8e99[_0x70a6('0x6')]||!_0x5c8e99[_0x70a6('0x42')]||!_0x5c8e99[_0x70a6('0xf')]||!_0x5c8e99[_0x70a6('0x25')]||!_0x5c8e99['bucket']){throw new db[(_0x70a6('0x26'))][(_0x70a6('0x20'))](_0x70a6('0x43'));}return db[_0x70a6('0x28')][_0x70a6('0x29')]({'where':{'id':_0x5c8e99[_0x70a6('0x42')]}});})[_0x70a6('0x10')](function(_0x433693){if(!_0x433693){throw new db['Sequelize'][(_0x70a6('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x433693['data1']||!_0x433693[_0x70a6('0x2b')]){throw new db[(_0x70a6('0x26'))][(_0x70a6('0x20'))](_0x70a6('0x2c'));}_0x527b97=_0x433693;var _0x1061ca=[];_0x3af504[_0x70a6('0x44')](function(_0x4b8adf){_0x1061ca[_0x70a6('0x45')](checkTranscribeJob(_0x4b8adf,_0x5c8e99,_0x527b97));});return BPromise[_0x70a6('0x46')](_0x1061ca);})[_0x70a6('0x47')](function(_0x5ed9c0){if(_0x5ed9c0){if(!_0x5ed9c0[_0x70a6('0x3a')]||_0x5ed9c0['name']!==_0x70a6('0x3b')){logger['error'](util[_0x70a6('0x3e')](_0x5ed9c0,{'showHidden':![],'depth':null}));}}});}exports[_0x70a6('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file