Built motion from commit (unavailable).|2.0.73
[motion2.git] / server / api / sound / sound.controller.js
index 574f0af..fea2d00 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea84=['server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','start','body','description','delete','original_format','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','api','../../config/utils','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','Sound','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','dateEnd','add','day','merge','map','filter','includeAll','include','findAll','catch','show','params','find','download','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','save_name','basename','file','originalname','extname','filename','substring','wav'];(function(_0x1e0b1e,_0x2ec015){var _0x2886e4=function(_0x53dec1){while(--_0x53dec1){_0x1e0b1e['push'](_0x1e0b1e['shift']());}};_0x2886e4(++_0x2ec015);}(_0xea84,0xfe));var _0x4ea8=function(_0x114870,_0x7529be){_0x114870=_0x114870-0x0;var _0x198666=_0xea84[_0x114870];return _0x198666;};'use strict';var jsonpatch=require(_0x4ea8('0x0'));var rp=require(_0x4ea8('0x1'));var moment=require(_0x4ea8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4ea8('0x3'));var util=require(_0x4ea8('0x4'));var path=require('path');var sox=require(_0x4ea8('0x5'));var csv=require('to-csv');var ejs=require(_0x4ea8('0x6'));var fs=require('fs');var _=require(_0x4ea8('0x7'));var squel=require('squel');var crypto=require(_0x4ea8('0x8'));var jsforce=require(_0x4ea8('0x9'));var deskjs=require(_0x4ea8('0xa'));var toCsv=require(_0x4ea8('0xb'));var querystring=require(_0x4ea8('0xc'));var Papa=require('papaparse');var qs=require(_0x4ea8('0xd'));var logger=require('../../config/logger')(_0x4ea8('0xe'));var utils=require(_0x4ea8('0xf'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25f12d,_0x1daa9b){_0x1daa9b=_0x1daa9b||0xcc;return function(_0xc763c2){if(_0xc763c2){return _0x25f12d['sendStatus'](_0x1daa9b);}return _0x25f12d[_0x4ea8('0x10')](_0x1daa9b)[_0x4ea8('0x11')]();};}function respondWithResult(_0xfea898,_0x1e972c){_0x1e972c=_0x1e972c||0xc8;return function(_0x21c5a1){if(_0x21c5a1){return _0xfea898[_0x4ea8('0x10')](_0x1e972c)['json'](_0x21c5a1);}};}function respondWithFilteredResult(_0x263967,_0x31c773){return function(_0x5efa21){if(_0x5efa21){var _0x14979c=_0x5efa21[_0x4ea8('0x12')],_0x3e319a=_0x31c773[_0x4ea8('0x13')],_0x38aa58=_0x31c773['offset']+_0x31c773['limit'],_0x3ce9f3;if(_0x38aa58>=_0x14979c){_0x38aa58=_0x14979c;_0x3ce9f3=0xc8;}else{_0x3ce9f3=0xce;}_0x263967[_0x4ea8('0x10')](_0x3ce9f3);return _0x263967[_0x4ea8('0x14')]('Content-Range',_0x3e319a+'-'+_0x38aa58+'/'+_0x14979c)[_0x4ea8('0x15')](_0x5efa21);}return null;};}function patchUpdates(_0xf2b2f4){return function(_0x3111de){try{jsonpatch[_0x4ea8('0x16')](_0x3111de,_0xf2b2f4,!![]);}catch(_0x294d20){return BPromise[_0x4ea8('0x17')](_0x294d20);}return _0x3111de[_0x4ea8('0x18')]();};}function saveUpdates(_0x5a1c75,_0x7422a4){return function(_0x389b9f){if(_0x389b9f){return _0x389b9f[_0x4ea8('0x19')](_0x5a1c75)[_0x4ea8('0x1a')](function(_0x244e35){return _0x244e35;});}return null;};}function removeEntity(_0xe46a83,_0x3b582b){return function(_0x23ea43){if(_0x23ea43){return _0x23ea43[_0x4ea8('0x1b')]()[_0x4ea8('0x1a')](function(){_0xe46a83[_0x4ea8('0x10')](0xcc)[_0x4ea8('0x11')]();});}};}function handleEntityNotFound(_0x2cb73b,_0x303660){return function(_0x4d831c){if(!_0x4d831c){_0x2cb73b[_0x4ea8('0x1c')](0x194);}return _0x4d831c;};}function handleError(_0x5cd147,_0x40afe3){_0x40afe3=_0x40afe3||0x1f4;return function(_0x204fe1){logger[_0x4ea8('0x1d')](_0x204fe1[_0x4ea8('0x1e')]);if(_0x204fe1['name']){delete _0x204fe1[_0x4ea8('0x1f')];}_0x5cd147['status'](_0x40afe3)['send'](_0x204fe1);};}exports[_0x4ea8('0x20')]=function(_0x55a286,_0x228d98){var _0x16fc81={},_0x5f15c9={},_0x3bfa29={'count':0x0,'rows':[]};var _0x33638c=db[_0x4ea8('0x21')][_0x4ea8('0x22')];_0x5f15c9[_0x4ea8('0x23')]=_[_0x4ea8('0x24')](_0x33638c);var _0x3ab360={'dateStart':_0x55a286[_0x4ea8('0x25')][_0x4ea8('0x26')],'dateEnd':_0x55a286[_0x4ea8('0x25')]['dateEnd']};delete _0x55a286[_0x4ea8('0x25')][_0x4ea8('0x26')];delete _0x55a286['query']['dateEnd'];_0x5f15c9[_0x4ea8('0x25')]=_[_0x4ea8('0x24')](_0x55a286[_0x4ea8('0x25')]);_0x5f15c9[_0x4ea8('0x27')]=_[_0x4ea8('0x28')](_0x5f15c9[_0x4ea8('0x23')],_0x5f15c9[_0x4ea8('0x25')]);_0x16fc81[_0x4ea8('0x29')]=_['intersection'](_0x5f15c9['model'],qs[_0x4ea8('0x2a')](_0x55a286[_0x4ea8('0x25')][_0x4ea8('0x2a')]));_0x16fc81[_0x4ea8('0x29')]=_0x16fc81['attributes'][_0x4ea8('0x2b')]?_0x16fc81[_0x4ea8('0x29')]:_0x5f15c9[_0x4ea8('0x23')];if(!_0x55a286[_0x4ea8('0x25')]['hasOwnProperty'](_0x4ea8('0x2c'))){_0x16fc81['limit']=qs[_0x4ea8('0x2d')](_0x55a286[_0x4ea8('0x25')][_0x4ea8('0x2d')]);_0x16fc81[_0x4ea8('0x13')]=qs[_0x4ea8('0x13')](_0x55a286[_0x4ea8('0x25')][_0x4ea8('0x13')]);}_0x16fc81[_0x4ea8('0x2e')]=qs[_0x4ea8('0x2f')](_0x55a286[_0x4ea8('0x25')][_0x4ea8('0x2f')]);_0x16fc81[_0x4ea8('0x30')]=qs[_0x4ea8('0x27')](_[_0x4ea8('0x31')](_0x55a286['query'],_0x5f15c9[_0x4ea8('0x27')]));if(_0x3ab360[_0x4ea8('0x26')]){if(_0x3ab360[_0x4ea8('0x32')]){_0x3ab360[_0x4ea8('0x32')]=moment(_0x3ab360[_0x4ea8('0x32')])[_0x4ea8('0x33')](0x1,_0x4ea8('0x34'));}else{_0x3ab360[_0x4ea8('0x32')]=moment(_0x3ab360[_0x4ea8('0x26')])[_0x4ea8('0x33')](0x1,'day');}_['merge'](_0x16fc81[_0x4ea8('0x30')],{'createdAt':{'$gte':_0x3ab360[_0x4ea8('0x26')],'$lte':_0x3ab360[_0x4ea8('0x32')]}});}if(_0x55a286['query']['filter']){_0x16fc81['where']=_[_0x4ea8('0x35')](_0x16fc81[_0x4ea8('0x30')],{'$or':_[_0x4ea8('0x36')](_0x16fc81[_0x4ea8('0x29')],function(_0x1902b){var _0xa217ca={};_0xa217ca[_0x1902b]={'$like':'%'+_0x55a286['query'][_0x4ea8('0x37')]+'%'};return _0xa217ca;})});}_0x16fc81=_[_0x4ea8('0x35')]({},_0x16fc81,_0x55a286['options']);var _0x17b6ad={'where':_0x16fc81[_0x4ea8('0x30')]};return db[_0x4ea8('0x21')]['count'](_0x17b6ad)['then'](function(_0x423a29){_0x3bfa29[_0x4ea8('0x12')]=_0x423a29;if(_0x55a286['query'][_0x4ea8('0x38')]){_0x16fc81[_0x4ea8('0x39')]=[{'all':!![]}];}return db[_0x4ea8('0x21')][_0x4ea8('0x3a')](_0x16fc81);})[_0x4ea8('0x1a')](function(_0x352dc8){_0x3bfa29['rows']=_0x352dc8;return _0x3bfa29;})[_0x4ea8('0x1a')](respondWithFilteredResult(_0x228d98,_0x16fc81))[_0x4ea8('0x3b')](handleError(_0x228d98,null));};exports[_0x4ea8('0x3c')]=function(_0x28ec08,_0x2226fc){var _0x20b64b={'raw':!![],'where':{'id':_0x28ec08[_0x4ea8('0x3d')]['id']}},_0x17a566={};_0x17a566['model']=_[_0x4ea8('0x24')](db[_0x4ea8('0x21')]['rawAttributes']);_0x17a566['query']=_[_0x4ea8('0x24')](_0x28ec08[_0x4ea8('0x25')]);_0x17a566[_0x4ea8('0x27')]=_['intersection'](_0x17a566['model'],_0x17a566[_0x4ea8('0x25')]);_0x20b64b[_0x4ea8('0x29')]=_['intersection'](_0x17a566['model'],qs[_0x4ea8('0x2a')](_0x28ec08[_0x4ea8('0x25')][_0x4ea8('0x2a')]));_0x20b64b['attributes']=_0x20b64b['attributes'][_0x4ea8('0x2b')]?_0x20b64b[_0x4ea8('0x29')]:_0x17a566[_0x4ea8('0x23')];if(_0x28ec08[_0x4ea8('0x25')][_0x4ea8('0x38')]){_0x20b64b[_0x4ea8('0x39')]=[{'all':!![]}];}_0x20b64b=_['merge']({},_0x20b64b,_0x28ec08['options']);return db[_0x4ea8('0x21')][_0x4ea8('0x3e')](_0x20b64b)[_0x4ea8('0x1a')](handleEntityNotFound(_0x2226fc,null))['then'](respondWithResult(_0x2226fc,null))[_0x4ea8('0x3b')](handleError(_0x2226fc,null));};exports[_0x4ea8('0x3f')]=function(_0x54f705,_0x57576a,_0x349872){return db['Sound']['find']({'where':{'id':_0x54f705[_0x4ea8('0x3d')]['id']},'attributes':[_0x4ea8('0x1f'),'save_name',_0x4ea8('0x40')],'raw':!![]})['then'](handleEntityNotFound(_0x57576a,null))[_0x4ea8('0x1a')](function(_0x1cce40){if(_0x1cce40){if(!fs[_0x4ea8('0x41')](path['join'](config[_0x4ea8('0x42')],_0x4ea8('0x43'),_0x1cce40['save_name']+'.'+_0x1cce40[_0x4ea8('0x40')]))){throw new db[(_0x4ea8('0x44'))][(_0x4ea8('0x45'))](_0x4ea8('0x46'));}return _0x57576a[_0x4ea8('0x3f')](path[_0x4ea8('0x47')](config[_0x4ea8('0x42')],_0x4ea8('0x43'),util[_0x4ea8('0x48')](_0x4ea8('0x49'),_0x1cce40[_0x4ea8('0x4a')],_0x1cce40['converted_format'])),util[_0x4ea8('0x48')](_0x4ea8('0x49'),_0x1cce40['name'],_0x1cce40['converted_format']));}return null;})[_0x4ea8('0x3b')](handleError(_0x57576a,null));};exports['create']=function(_0x8be6f6,_0x483aaf,_0x373613){var _0x37df08={'name':path[_0x4ea8('0x4b')](_0x8be6f6[_0x4ea8('0x4c')][_0x4ea8('0x4d')],path[_0x4ea8('0x4e')](_0x8be6f6['file'][_0x4ea8('0x4d')])),'save_name':path['basename'](_0x8be6f6[_0x4ea8('0x4c')][_0x4ea8('0x4f')],path[_0x4ea8('0x4e')](_0x8be6f6[_0x4ea8('0x4c')]['filename'])),'original_format':path[_0x4ea8('0x4e')](_0x8be6f6[_0x4ea8('0x4c')][_0x4ea8('0x4d')])[_0x4ea8('0x50')](0x1),'converted_format':_0x4ea8('0x51')};var _0x1f607d=path[_0x4ea8('0x47')](config[_0x4ea8('0x42')],_0x4ea8('0x52'),_0x8be6f6[_0x4ea8('0x4c')][_0x4ea8('0x4f')]);var _0x36f2ae=path[_0x4ea8('0x47')](config['root'],_0x4ea8('0x43'),util[_0x4ea8('0x48')](_0x4ea8('0x49'),path[_0x4ea8('0x4b')](_0x8be6f6['file'][_0x4ea8('0x4f')],path[_0x4ea8('0x4e')](_0x8be6f6[_0x4ea8('0x4c')][_0x4ea8('0x4f')])),_0x37df08[_0x4ea8('0x40')]));logger[_0x4ea8('0x53')](_0x4ea8('0x54'),_0x1f607d);logger[_0x4ea8('0x53')](_0x4ea8('0x55'),_0x36f2ae);try{fs[_0x4ea8('0x56')](_0x1f607d,parseInt(_0x4ea8('0x57'),0x8));var _0x42ac0f=sox[_0x4ea8('0x58')](_0x1f607d,_0x36f2ae,{'sampleRate':0x1f40,'format':_0x4ea8('0x51'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x42ac0f['on'](_0x4ea8('0x1d'),function(_0x318684){fs[_0x4ea8('0x59')](_0x1f607d);_0x483aaf[_0x4ea8('0x10')](0x1f4)[_0x4ea8('0x5a')](_0x318684);});_0x42ac0f['on']('src',function(_0x4f4602){_0x37df08[_0x4ea8('0x5b')]=isNaN(_0x4f4602['duration'])?null:_0x4f4602[_0x4ea8('0x5c')]*0x3e8;_0x37df08[_0x4ea8('0x5d')]=isNaN(_0x4f4602[_0x4ea8('0x5e')])?null:_0x4f4602[_0x4ea8('0x5e')];_0x37df08[_0x4ea8('0x5f')]=isNaN(_0x4f4602[_0x4ea8('0x60')])?null:_0x4f4602[_0x4ea8('0x60')];_0x37df08[_0x4ea8('0x61')]=isNaN(_0x4f4602['bitRate'])?null:_0x4f4602[_0x4ea8('0x62')];_0x37df08[_0x4ea8('0x63')]=isNaN(_0x4f4602[_0x4ea8('0x64')])?null:_0x4f4602['sampleRate'];});_0x42ac0f['on'](_0x4ea8('0x65'),function(_0x35fe9c){_0x37df08[_0x4ea8('0x66')]=isNaN(_0x35fe9c[_0x4ea8('0x5c')])?null:_0x35fe9c[_0x4ea8('0x5c')]*0x3e8;_0x37df08[_0x4ea8('0x67')]=isNaN(_0x35fe9c[_0x4ea8('0x5e')])?null:_0x35fe9c[_0x4ea8('0x5e')];_0x37df08[_0x4ea8('0x68')]=isNaN(_0x35fe9c[_0x4ea8('0x60')])?null:_0x35fe9c[_0x4ea8('0x60')];_0x37df08[_0x4ea8('0x69')]=isNaN(_0x35fe9c[_0x4ea8('0x62')])?null:_0x35fe9c[_0x4ea8('0x62')];_0x37df08[_0x4ea8('0x6a')]=isNaN(_0x35fe9c[_0x4ea8('0x64')])?null:_0x35fe9c[_0x4ea8('0x64')];});_0x42ac0f['on'](_0x4ea8('0x11'),function(){fs[_0x4ea8('0x56')](_0x36f2ae,parseInt(_0x4ea8('0x57'),0x8));return db['Sound']['create'](_0x37df08)[_0x4ea8('0x1a')](respondWithResult(_0x483aaf,null))[_0x4ea8('0x3b')](handleError(_0x483aaf,null));});_0x42ac0f[_0x4ea8('0x6b')]();}catch(_0xac907d){_0x483aaf['status'](0x1f4)[_0x4ea8('0x5a')](_0xac907d);}};exports[_0x4ea8('0x19')]=function(_0x100245,_0x268f0f,_0x23d900){return db[_0x4ea8('0x21')][_0x4ea8('0x3e')]({'where':{'id':_0x100245[_0x4ea8('0x3d')]['id']}})[_0x4ea8('0x1a')](handleEntityNotFound(_0x268f0f,null))[_0x4ea8('0x1a')](saveUpdates(_[_0x4ea8('0x31')](_0x100245[_0x4ea8('0x6c')],[_0x4ea8('0x1f'),_0x4ea8('0x6d')]),null))['then'](respondWithResult(_0x268f0f,null))[_0x4ea8('0x3b')](handleError(_0x268f0f,null));};exports[_0x4ea8('0x6e')]=function(_0x4a26b3,_0x4c798f,_0x20b3f9){return db[_0x4ea8('0x21')]['find']({'where':{'id':_0x4a26b3['params']['id']}})['then'](function(_0x3cbba7){if(_0x3cbba7){return _0x3cbba7[_0x4ea8('0x1b')]();}})[_0x4ea8('0x1a')](function(_0x17e3b2){var _0x4c887d=path[_0x4ea8('0x47')](config[_0x4ea8('0x42')],'server/files/sounds/original',util[_0x4ea8('0x48')]('%s.%s',_0x17e3b2[_0x4ea8('0x4a')],_0x17e3b2[_0x4ea8('0x6f')]));var _0x46fa28=path[_0x4ea8('0x47')](config[_0x4ea8('0x42')],_0x4ea8('0x43'),util[_0x4ea8('0x48')](_0x4ea8('0x49'),_0x17e3b2[_0x4ea8('0x4a')],_0x17e3b2[_0x4ea8('0x40')]));fs[_0x4ea8('0x59')](_0x4c887d);fs[_0x4ea8('0x59')](_0x46fa28);return _0x17e3b2;})[_0x4ea8('0x1a')](function(_0x1028c3){if(_0x1028c3){return _0x4c798f['status'](0xcc)[_0x4ea8('0x11')]();}})[_0x4ea8('0x1a')](handleEntityNotFound(_0x4c798f,null))[_0x4ea8('0x3b')](handleError(_0x4c798f,null));};
\ No newline at end of file
+var _0x158a=['delete','original_format','unlinkSync','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','limit','set','Content-Range','save','update','then','destroy','end','error','stack','name','index','Sound','keys','query','dateEnd','dateStart','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','add','day','merge','map','filter','options','count','includeAll','include','rows','catch','show','params','rawAttributes','intersection','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','chmodSync','transcode','send','src','duration','original_sampleCount','bitRate','sampleRate','dest','sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','start','body'];(function(_0x74c0f3,_0x3ad21e){var _0x442ab7=function(_0x4e121e){while(--_0x4e121e){_0x74c0f3['push'](_0x74c0f3['shift']());}};_0x442ab7(++_0x3ad21e);}(_0x158a,0x19f));var _0xa158=function(_0x554732,_0xdb5283){_0x554732=_0x554732-0x0;var _0x4c0300=_0x158a[_0x554732];return _0x4c0300;};'use strict';var jsonpatch=require(_0xa158('0x0'));var rp=require('request-promise');var moment=require(_0xa158('0x1'));var BPromise=require(_0xa158('0x2'));var Mustache=require('mustache');var util=require(_0xa158('0x3'));var path=require(_0xa158('0x4'));var sox=require(_0xa158('0x5'));var csv=require(_0xa158('0x6'));var ejs=require(_0xa158('0x7'));var fs=require('fs');var _=require(_0xa158('0x8'));var squel=require(_0xa158('0x9'));var crypto=require(_0xa158('0xa'));var jsforce=require(_0xa158('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa158('0x6'));var querystring=require(_0xa158('0xc'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0xa158('0xd'))(_0xa158('0xe'));var utils=require(_0xa158('0xf'));var config=require('../../config/environment');var db=require(_0xa158('0x10'))['db'];function respondWithStatusCode(_0x5efdcf,_0x2bd165){_0x2bd165=_0x2bd165||0xcc;return function(_0x4e5927){if(_0x4e5927){return _0x5efdcf['sendStatus'](_0x2bd165);}return _0x5efdcf[_0xa158('0x11')](_0x2bd165)['end']();};}function respondWithResult(_0x4c5336,_0x5469b9){_0x5469b9=_0x5469b9||0xc8;return function(_0x5360f5){if(_0x5360f5){return _0x4c5336[_0xa158('0x11')](_0x5469b9)[_0xa158('0x12')](_0x5360f5);}};}function respondWithFilteredResult(_0x34898c,_0x15ebba){return function(_0x421c60){if(_0x421c60){var _0x1628c8=_0x421c60['count'],_0xf6f1e1=_0x15ebba['offset'],_0x4eef27=_0x15ebba[_0xa158('0x13')]+_0x15ebba[_0xa158('0x14')],_0x1c4037;if(_0x4eef27>=_0x1628c8){_0x4eef27=_0x1628c8;_0x1c4037=0xc8;}else{_0x1c4037=0xce;}_0x34898c[_0xa158('0x11')](_0x1c4037);return _0x34898c[_0xa158('0x15')](_0xa158('0x16'),_0xf6f1e1+'-'+_0x4eef27+'/'+_0x1628c8)[_0xa158('0x12')](_0x421c60);}return null;};}function patchUpdates(_0x4be90c){return function(_0x43d838){try{jsonpatch['apply'](_0x43d838,_0x4be90c,!![]);}catch(_0x7cf26){return BPromise['reject'](_0x7cf26);}return _0x43d838[_0xa158('0x17')]();};}function saveUpdates(_0x1596e8,_0x3874d0){return function(_0x154e0a){if(_0x154e0a){return _0x154e0a[_0xa158('0x18')](_0x1596e8)[_0xa158('0x19')](function(_0xe5434a){return _0xe5434a;});}return null;};}function removeEntity(_0x1be1e9,_0x3d5312){return function(_0x4fa11b){if(_0x4fa11b){return _0x4fa11b[_0xa158('0x1a')]()[_0xa158('0x19')](function(){_0x1be1e9[_0xa158('0x11')](0xcc)[_0xa158('0x1b')]();});}};}function handleEntityNotFound(_0xb36b81,_0x1ca767){return function(_0x472072){if(!_0x472072){_0xb36b81['sendStatus'](0x194);}return _0x472072;};}function handleError(_0x3351fd,_0x2e3d7f){_0x2e3d7f=_0x2e3d7f||0x1f4;return function(_0x2960b9){logger[_0xa158('0x1c')](_0x2960b9[_0xa158('0x1d')]);if(_0x2960b9[_0xa158('0x1e')]){delete _0x2960b9[_0xa158('0x1e')];}_0x3351fd[_0xa158('0x11')](_0x2e3d7f)['send'](_0x2960b9);};}exports[_0xa158('0x1f')]=function(_0xf7eeef,_0xf95795){var _0x4d89c3={},_0x1dbd1e={},_0x1fa6c5={'count':0x0,'rows':[]};var _0x2c1d4a=db[_0xa158('0x20')]['rawAttributes'];_0x1dbd1e['model']=_[_0xa158('0x21')](_0x2c1d4a);var _0x3b9e3c={'dateStart':_0xf7eeef[_0xa158('0x22')]['dateStart'],'dateEnd':_0xf7eeef[_0xa158('0x22')][_0xa158('0x23')]};delete _0xf7eeef[_0xa158('0x22')][_0xa158('0x24')];delete _0xf7eeef[_0xa158('0x22')][_0xa158('0x23')];_0x1dbd1e[_0xa158('0x22')]=_[_0xa158('0x21')](_0xf7eeef[_0xa158('0x22')]);_0x1dbd1e[_0xa158('0x25')]=_['intersection'](_0x1dbd1e[_0xa158('0x26')],_0x1dbd1e[_0xa158('0x22')]);_0x4d89c3[_0xa158('0x27')]=_['intersection'](_0x1dbd1e[_0xa158('0x26')],qs[_0xa158('0x28')](_0xf7eeef[_0xa158('0x22')][_0xa158('0x28')]));_0x4d89c3[_0xa158('0x27')]=_0x4d89c3['attributes'][_0xa158('0x29')]?_0x4d89c3[_0xa158('0x27')]:_0x1dbd1e[_0xa158('0x26')];if(!_0xf7eeef[_0xa158('0x22')][_0xa158('0x2a')](_0xa158('0x2b'))){_0x4d89c3['limit']=qs[_0xa158('0x14')](_0xf7eeef[_0xa158('0x22')][_0xa158('0x14')]);_0x4d89c3[_0xa158('0x13')]=qs[_0xa158('0x13')](_0xf7eeef[_0xa158('0x22')][_0xa158('0x13')]);}_0x4d89c3['order']=qs[_0xa158('0x2c')](_0xf7eeef[_0xa158('0x22')][_0xa158('0x2c')]);_0x4d89c3[_0xa158('0x2d')]=qs[_0xa158('0x25')](_['pick'](_0xf7eeef[_0xa158('0x22')],_0x1dbd1e[_0xa158('0x25')]));if(_0x3b9e3c[_0xa158('0x24')]){if(_0x3b9e3c[_0xa158('0x23')]){_0x3b9e3c['dateEnd']=moment(_0x3b9e3c['dateEnd'])[_0xa158('0x2e')](0x1,_0xa158('0x2f'));}else{_0x3b9e3c[_0xa158('0x23')]=moment(_0x3b9e3c[_0xa158('0x24')])['add'](0x1,_0xa158('0x2f'));}_[_0xa158('0x30')](_0x4d89c3[_0xa158('0x2d')],{'createdAt':{'$gte':_0x3b9e3c[_0xa158('0x24')],'$lte':_0x3b9e3c[_0xa158('0x23')]}});}if(_0xf7eeef[_0xa158('0x22')]['filter']){_0x4d89c3['where']=_['merge'](_0x4d89c3[_0xa158('0x2d')],{'$or':_[_0xa158('0x31')](_0x4d89c3[_0xa158('0x27')],function(_0x3fad0b){var _0x2b7f1d={};_0x2b7f1d[_0x3fad0b]={'$like':'%'+_0xf7eeef['query'][_0xa158('0x32')]+'%'};return _0x2b7f1d;})});}_0x4d89c3=_[_0xa158('0x30')]({},_0x4d89c3,_0xf7eeef[_0xa158('0x33')]);var _0x2f4db5={'where':_0x4d89c3['where']};return db[_0xa158('0x20')]['count'](_0x2f4db5)[_0xa158('0x19')](function(_0x590493){_0x1fa6c5[_0xa158('0x34')]=_0x590493;if(_0xf7eeef[_0xa158('0x22')][_0xa158('0x35')]){_0x4d89c3[_0xa158('0x36')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x4d89c3);})[_0xa158('0x19')](function(_0x1b3fc5){_0x1fa6c5[_0xa158('0x37')]=_0x1b3fc5;return _0x1fa6c5;})[_0xa158('0x19')](respondWithFilteredResult(_0xf95795,_0x4d89c3))[_0xa158('0x38')](handleError(_0xf95795,null));};exports[_0xa158('0x39')]=function(_0x770084,_0x322a76){var _0x5a085b={'raw':!![],'where':{'id':_0x770084[_0xa158('0x3a')]['id']}},_0x49958f={};_0x49958f[_0xa158('0x26')]=_[_0xa158('0x21')](db['Sound'][_0xa158('0x3b')]);_0x49958f['query']=_[_0xa158('0x21')](_0x770084[_0xa158('0x22')]);_0x49958f['filters']=_[_0xa158('0x3c')](_0x49958f[_0xa158('0x26')],_0x49958f[_0xa158('0x22')]);_0x5a085b[_0xa158('0x27')]=_[_0xa158('0x3c')](_0x49958f['model'],qs[_0xa158('0x28')](_0x770084['query']['fields']));_0x5a085b[_0xa158('0x27')]=_0x5a085b[_0xa158('0x27')]['length']?_0x5a085b[_0xa158('0x27')]:_0x49958f[_0xa158('0x26')];if(_0x770084['query']['includeAll']){_0x5a085b[_0xa158('0x36')]=[{'all':!![]}];}_0x5a085b=_['merge']({},_0x5a085b,_0x770084['options']);return db['Sound']['find'](_0x5a085b)[_0xa158('0x19')](handleEntityNotFound(_0x322a76,null))[_0xa158('0x19')](respondWithResult(_0x322a76,null))[_0xa158('0x38')](handleError(_0x322a76,null));};exports['download']=function(_0x389416,_0x53004f,_0x567043){return db[_0xa158('0x20')][_0xa158('0x3d')]({'where':{'id':_0x389416[_0xa158('0x3a')]['id']},'attributes':[_0xa158('0x1e'),_0xa158('0x3e'),_0xa158('0x3f')],'raw':!![]})['then'](handleEntityNotFound(_0x53004f,null))[_0xa158('0x19')](function(_0x40690b){if(_0x40690b){if(!fs[_0xa158('0x40')](path[_0xa158('0x41')](config[_0xa158('0x42')],_0xa158('0x43'),_0x40690b['save_name']+'.'+_0x40690b[_0xa158('0x3f')]))){throw new db[(_0xa158('0x44'))][(_0xa158('0x45'))](_0xa158('0x46'));}return _0x53004f[_0xa158('0x47')](path[_0xa158('0x41')](config[_0xa158('0x42')],_0xa158('0x43'),util[_0xa158('0x48')]('%s.%s',_0x40690b[_0xa158('0x3e')],_0x40690b[_0xa158('0x3f')])),util[_0xa158('0x48')](_0xa158('0x49'),_0x40690b[_0xa158('0x1e')],_0x40690b[_0xa158('0x3f')]));}return null;})[_0xa158('0x38')](handleError(_0x53004f,null));};exports[_0xa158('0x4a')]=function(_0x36239a,_0x66149c,_0x117e3e){var _0x539c0b={'name':path[_0xa158('0x4b')](_0x36239a[_0xa158('0x4c')][_0xa158('0x4d')],path['extname'](_0x36239a['file'][_0xa158('0x4d')])),'save_name':path[_0xa158('0x4b')](_0x36239a[_0xa158('0x4c')][_0xa158('0x4e')],path[_0xa158('0x4f')](_0x36239a[_0xa158('0x4c')][_0xa158('0x4e')])),'original_format':path[_0xa158('0x4f')](_0x36239a[_0xa158('0x4c')]['originalname'])[_0xa158('0x50')](0x1),'converted_format':_0xa158('0x51')};var _0x257c54=path[_0xa158('0x41')](config['root'],_0xa158('0x52'),_0x36239a[_0xa158('0x4c')]['filename']);var _0x9a1ce5=path[_0xa158('0x41')](config[_0xa158('0x42')],_0xa158('0x43'),util[_0xa158('0x48')](_0xa158('0x49'),path[_0xa158('0x4b')](_0x36239a['file']['filename'],path[_0xa158('0x4f')](_0x36239a[_0xa158('0x4c')][_0xa158('0x4e')])),_0x539c0b[_0xa158('0x3f')]));logger[_0xa158('0x53')]('Sound\x20upload\x20filepath:\x20%s',_0x257c54);logger[_0xa158('0x53')]('Sound\x20upload\x20destination:\x20%s',_0x9a1ce5);try{fs[_0xa158('0x54')](_0x257c54,parseInt('0777',0x8));var _0x2291f8=sox[_0xa158('0x55')](_0x257c54,_0x9a1ce5,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2291f8['on'](_0xa158('0x1c'),function(_0xe5fd0a){fs['unlinkSync'](_0x257c54);_0x66149c[_0xa158('0x11')](0x1f4)[_0xa158('0x56')](_0xe5fd0a);});_0x2291f8['on'](_0xa158('0x57'),function(_0x5a0e89){_0x539c0b['original_duration']=isNaN(_0x5a0e89[_0xa158('0x58')])?null:_0x5a0e89[_0xa158('0x58')]*0x3e8;_0x539c0b[_0xa158('0x59')]=isNaN(_0x5a0e89['sampleCount'])?null:_0x5a0e89['sampleCount'];_0x539c0b['original_channelCount']=isNaN(_0x5a0e89['channelCount'])?null:_0x5a0e89['channelCount'];_0x539c0b['original_bitRate']=isNaN(_0x5a0e89[_0xa158('0x5a')])?null:_0x5a0e89[_0xa158('0x5a')];_0x539c0b['original_sampleRate']=isNaN(_0x5a0e89[_0xa158('0x5b')])?null:_0x5a0e89['sampleRate'];});_0x2291f8['on'](_0xa158('0x5c'),function(_0x25ce42){_0x539c0b['converted_duration']=isNaN(_0x25ce42[_0xa158('0x58')])?null:_0x25ce42[_0xa158('0x58')]*0x3e8;_0x539c0b['converted_sampleCount']=isNaN(_0x25ce42[_0xa158('0x5d')])?null:_0x25ce42[_0xa158('0x5d')];_0x539c0b[_0xa158('0x5e')]=isNaN(_0x25ce42[_0xa158('0x5f')])?null:_0x25ce42[_0xa158('0x5f')];_0x539c0b[_0xa158('0x60')]=isNaN(_0x25ce42['bitRate'])?null:_0x25ce42[_0xa158('0x5a')];_0x539c0b[_0xa158('0x61')]=isNaN(_0x25ce42['sampleRate'])?null:_0x25ce42[_0xa158('0x5b')];});_0x2291f8['on']('end',function(){fs[_0xa158('0x54')](_0x9a1ce5,parseInt('0777',0x8));return db[_0xa158('0x20')][_0xa158('0x4a')](_0x539c0b)[_0xa158('0x19')](respondWithResult(_0x66149c,null))['catch'](handleError(_0x66149c,null));});_0x2291f8[_0xa158('0x62')]();}catch(_0x1e26fd){_0x66149c[_0xa158('0x11')](0x1f4)[_0xa158('0x56')](_0x1e26fd);}};exports['update']=function(_0x578850,_0x1d5f6c,_0x1bec59){return db['Sound'][_0xa158('0x3d')]({'where':{'id':_0x578850[_0xa158('0x3a')]['id']}})[_0xa158('0x19')](handleEntityNotFound(_0x1d5f6c,null))[_0xa158('0x19')](saveUpdates(_['pick'](_0x578850[_0xa158('0x63')],[_0xa158('0x1e'),'description']),null))[_0xa158('0x19')](respondWithResult(_0x1d5f6c,null))['catch'](handleError(_0x1d5f6c,null));};exports[_0xa158('0x64')]=function(_0x258959,_0x1157ae,_0x1e3bbd){return db['Sound'][_0xa158('0x3d')]({'where':{'id':_0x258959[_0xa158('0x3a')]['id']}})[_0xa158('0x19')](function(_0x2e8cf4){if(_0x2e8cf4){return _0x2e8cf4['destroy']();}})['then'](function(_0x48db78){var _0x4b3471=path['join'](config['root'],'server/files/sounds/original',util['format']('%s.%s',_0x48db78[_0xa158('0x3e')],_0x48db78[_0xa158('0x65')]));var _0x3d67b0=path[_0xa158('0x41')](config[_0xa158('0x42')],_0xa158('0x43'),util[_0xa158('0x48')](_0xa158('0x49'),_0x48db78[_0xa158('0x3e')],_0x48db78[_0xa158('0x3f')]));fs[_0xa158('0x66')](_0x4b3471);fs['unlinkSync'](_0x3d67b0);return _0x48db78;})[_0xa158('0x19')](function(_0x4b6f0d){if(_0x4b6f0d){return _0x1157ae[_0xa158('0x11')](0xcc)['end']();}})[_0xa158('0x19')](handleEntityNotFound(_0x1157ae,null))[_0xa158('0x38')](handleError(_0x1157ae,null));};
\ No newline at end of file