Built motion from commit 47436d59.|2.6.7
[motion2.git] / server / api / sound / sound.controller.js
index 3928cc1..f233c7c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc83a=['squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','end','name','send','index','Sound','fieldName','type','model','map','keys','query','filters','attributes','fields','length','nolimit','sort','where','filter','merge','includeAll','include','rows','catch','show','params','rawAttributes','intersection','options','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','create','file','originalname','extname','filename','substring','basename','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash'];(function(_0x3bc022,_0x398082){var _0x4a19c6=function(_0x1e3281){while(--_0x1e3281){_0x3bc022['push'](_0x3bc022['shift']());}};_0x4a19c6(++_0x398082);}(_0xc83a,0x16d));var _0xac83=function(_0x3e9c05,_0x8b8e4f){_0x3e9c05=_0x3e9c05-0x0;var _0x412ebe=_0xc83a[_0x3e9c05];return _0x412ebe;};'use strict';var emlformat=require(_0xac83('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xac83('0x1'));var rp=require(_0xac83('0x2'));var moment=require(_0xac83('0x3'));var BPromise=require(_0xac83('0x4'));var Mustache=require(_0xac83('0x5'));var util=require('util');var path=require(_0xac83('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xac83('0x7'));var fs=require('fs');var fs_extra=require(_0xac83('0x8'));var _=require(_0xac83('0x9'));var squel=require(_0xac83('0xa'));var crypto=require(_0xac83('0xb'));var jsforce=require(_0xac83('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xac83('0xd'));var querystring=require(_0xac83('0xe'));var Papa=require(_0xac83('0xf'));var Redis=require(_0xac83('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xac83('0x11'));var as=require(_0xac83('0x12'));var hardwareService=require(_0xac83('0x13'));var logger=require('../../config/logger')(_0xac83('0x14'));var utils=require(_0xac83('0x15'));var config=require(_0xac83('0x16'));var licenseUtil=require(_0xac83('0x17'));var db=require(_0xac83('0x18'))['db'];function respondWithStatusCode(_0x3cade4,_0x504c13){_0x504c13=_0x504c13||0xcc;return function(_0x222a5a){if(_0x222a5a){return _0x3cade4[_0xac83('0x19')](_0x504c13);}return _0x3cade4[_0xac83('0x1a')](_0x504c13)['end']();};}function respondWithResult(_0x502713,_0x2dc3c5){_0x2dc3c5=_0x2dc3c5||0xc8;return function(_0x12538f){if(_0x12538f){return _0x502713[_0xac83('0x1a')](_0x2dc3c5)[_0xac83('0x1b')](_0x12538f);}};}function respondWithFilteredResult(_0x9b5cb,_0x50e303){return function(_0x346673){if(_0x346673){var _0x1d84bd=typeof _0x50e303[_0xac83('0x1c')]===_0xac83('0x1d')&&typeof _0x50e303[_0xac83('0x1e')]===_0xac83('0x1d');var _0x43f265=_0x346673[_0xac83('0x1f')];var _0x537d8c=_0x1d84bd?0x0:_0x50e303['offset'];var _0x3c13e0=_0x1d84bd?_0x346673[_0xac83('0x1f')]:_0x50e303[_0xac83('0x1c')]+_0x50e303[_0xac83('0x1e')];var _0x5845da;if(_0x3c13e0>=_0x43f265){_0x3c13e0=_0x43f265;_0x5845da=0xc8;}else{_0x5845da=0xce;}_0x9b5cb[_0xac83('0x1a')](_0x5845da);return _0x9b5cb[_0xac83('0x20')](_0xac83('0x21'),_0x537d8c+'-'+_0x3c13e0+'/'+_0x43f265)[_0xac83('0x1b')](_0x346673);}return null;};}function patchUpdates(_0x2e3e06){return function(_0x2c1776){try{jsonpatch[_0xac83('0x22')](_0x2c1776,_0x2e3e06,!![]);}catch(_0x1ca10d){return BPromise[_0xac83('0x23')](_0x1ca10d);}return _0x2c1776[_0xac83('0x24')]();};}function saveUpdates(_0x2a1330,_0x234272){return function(_0x22506b){if(_0x22506b){return _0x22506b[_0xac83('0x25')](_0x2a1330)[_0xac83('0x26')](function(_0x59c397){return _0x59c397;});}return null;};}function removeEntity(_0x3a5640,_0xcc8f31){return function(_0x20b265){if(_0x20b265){return _0x20b265[_0xac83('0x27')]()[_0xac83('0x26')](function(){var _0x129df5=_0x20b265['get']({'plain':!![]});var _0x5826f6=_0xac83('0x28');return db[_0xac83('0x29')]['destroy']({'where':{'type':_0x5826f6,'resourceId':_0x129df5['id']}})['then'](function(){return _0x20b265;});})[_0xac83('0x26')](function(){_0x3a5640[_0xac83('0x1a')](0xcc)[_0xac83('0x2a')]();});}};}function handleEntityNotFound(_0x388852,_0x532808){return function(_0xd3adb3){if(!_0xd3adb3){_0x388852[_0xac83('0x19')](0x194);}return _0xd3adb3;};}function handleError(_0x34c757,_0x5b3557){_0x5b3557=_0x5b3557||0x1f4;return function(_0xc4cd3f){logger['error'](_0xc4cd3f['stack']);if(_0xc4cd3f[_0xac83('0x2b')]){delete _0xc4cd3f[_0xac83('0x2b')];}_0x34c757[_0xac83('0x1a')](_0x5b3557)[_0xac83('0x2c')](_0xc4cd3f);};}exports[_0xac83('0x2d')]=function(_0x26cc78,_0x375888){var _0x4ec60b={},_0x4fd3e0={},_0x327bd8={'count':0x0,'rows':[]};var _0x3972d5=_['map'](db[_0xac83('0x2e')]['rawAttributes'],function(_0x6033c0){return{'name':_0x6033c0[_0xac83('0x2f')],'type':_0x6033c0[_0xac83('0x30')]['key']};});_0x4fd3e0[_0xac83('0x31')]=_[_0xac83('0x32')](_0x3972d5,_0xac83('0x2b'));_0x4fd3e0['query']=_[_0xac83('0x33')](_0x26cc78[_0xac83('0x34')]);_0x4fd3e0[_0xac83('0x35')]=_['intersection'](_0x4fd3e0[_0xac83('0x31')],_0x4fd3e0[_0xac83('0x34')]);_0x4ec60b[_0xac83('0x36')]=_['intersection'](_0x4fd3e0[_0xac83('0x31')],qs[_0xac83('0x37')](_0x26cc78[_0xac83('0x34')][_0xac83('0x37')]));_0x4ec60b[_0xac83('0x36')]=_0x4ec60b[_0xac83('0x36')][_0xac83('0x38')]?_0x4ec60b['attributes']:_0x4fd3e0['model'];if(!_0x26cc78[_0xac83('0x34')]['hasOwnProperty'](_0xac83('0x39'))){_0x4ec60b['limit']=qs[_0xac83('0x1e')](_0x26cc78['query'][_0xac83('0x1e')]);_0x4ec60b['offset']=qs[_0xac83('0x1c')](_0x26cc78[_0xac83('0x34')][_0xac83('0x1c')]);}_0x4ec60b['order']=qs[_0xac83('0x3a')](_0x26cc78[_0xac83('0x34')]['sort']);_0x4ec60b[_0xac83('0x3b')]=qs['filters'](_['pick'](_0x26cc78['query'],_0x4fd3e0[_0xac83('0x35')]),_0x3972d5);if(_0x26cc78[_0xac83('0x34')][_0xac83('0x3c')]){_0x4ec60b[_0xac83('0x3b')]=_[_0xac83('0x3d')](_0x4ec60b[_0xac83('0x3b')],{'$or':_[_0xac83('0x32')](_0x3972d5,function(_0x4dafcc){if(_0x4dafcc['type']!=='VIRTUAL'){var _0x4348f4={};_0x4348f4[_0x4dafcc['name']]={'$like':'%'+_0x26cc78['query'][_0xac83('0x3c')]+'%'};return _0x4348f4;}})});}_0x4ec60b=_[_0xac83('0x3d')]({},_0x4ec60b,_0x26cc78['options']);var _0x5d997b={'where':_0x4ec60b['where']};return db[_0xac83('0x2e')][_0xac83('0x1f')](_0x5d997b)[_0xac83('0x26')](function(_0x223096){_0x327bd8['count']=_0x223096;if(_0x26cc78[_0xac83('0x34')][_0xac83('0x3e')]){_0x4ec60b[_0xac83('0x3f')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x4ec60b);})[_0xac83('0x26')](function(_0x30f443){_0x327bd8[_0xac83('0x40')]=_0x30f443;return _0x327bd8;})[_0xac83('0x26')](respondWithFilteredResult(_0x375888,_0x4ec60b))[_0xac83('0x41')](handleError(_0x375888,null));};exports[_0xac83('0x42')]=function(_0x31f0d8,_0x958f62){var _0x500b43={'raw':!![],'where':{'id':_0x31f0d8[_0xac83('0x43')]['id']}},_0x3f581f={};_0x3f581f['model']=_[_0xac83('0x33')](db[_0xac83('0x2e')][_0xac83('0x44')]);_0x3f581f['query']=_['keys'](_0x31f0d8[_0xac83('0x34')]);_0x3f581f['filters']=_['intersection'](_0x3f581f[_0xac83('0x31')],_0x3f581f[_0xac83('0x34')]);_0x500b43['attributes']=_[_0xac83('0x45')](_0x3f581f[_0xac83('0x31')],qs[_0xac83('0x37')](_0x31f0d8[_0xac83('0x34')][_0xac83('0x37')]));_0x500b43[_0xac83('0x36')]=_0x500b43[_0xac83('0x36')][_0xac83('0x38')]?_0x500b43[_0xac83('0x36')]:_0x3f581f[_0xac83('0x31')];if(_0x31f0d8[_0xac83('0x34')][_0xac83('0x3e')]){_0x500b43['include']=[{'all':!![]}];}_0x500b43=_[_0xac83('0x3d')]({},_0x500b43,_0x31f0d8[_0xac83('0x46')]);return db[_0xac83('0x2e')][_0xac83('0x47')](_0x500b43)[_0xac83('0x26')](handleEntityNotFound(_0x958f62,null))['then'](respondWithResult(_0x958f62,null))[_0xac83('0x41')](handleError(_0x958f62,null));};exports[_0xac83('0x48')]=function(_0x207b99,_0x25a3fb,_0x4bd517){return db[_0xac83('0x2e')][_0xac83('0x47')]({'where':{'id':_0x207b99[_0xac83('0x43')]['id']},'attributes':['name',_0xac83('0x49'),_0xac83('0x4a')],'raw':!![]})[_0xac83('0x26')](handleEntityNotFound(_0x25a3fb,null))[_0xac83('0x26')](function(_0x33ec65){if(_0x33ec65){if(!fs[_0xac83('0x4b')](path[_0xac83('0x4c')](config[_0xac83('0x4d')],_0xac83('0x4e'),_0x33ec65[_0xac83('0x49')]+'.'+_0x33ec65['converted_format']))){throw new db[(_0xac83('0x4f'))][(_0xac83('0x50'))]('Sound\x20not\x20found');}return _0x25a3fb[_0xac83('0x48')](path['join'](config[_0xac83('0x4d')],_0xac83('0x4e'),util[_0xac83('0x51')](_0xac83('0x52'),_0x33ec65[_0xac83('0x49')],_0x33ec65[_0xac83('0x4a')])),util[_0xac83('0x51')](_0xac83('0x52'),_0x33ec65['name'],_0x33ec65[_0xac83('0x4a')]));}return null;})['catch'](handleError(_0x25a3fb,null));};exports[_0xac83('0x53')]=function(_0x57edca,_0x23fd0c,_0x198353){var _0xd027={'name':path['basename'](_0x57edca[_0xac83('0x54')][_0xac83('0x55')],path[_0xac83('0x56')](_0x57edca[_0xac83('0x54')][_0xac83('0x55')])),'save_name':path['basename'](_0x57edca[_0xac83('0x54')][_0xac83('0x57')],path[_0xac83('0x56')](_0x57edca[_0xac83('0x54')]['filename'])),'original_format':path[_0xac83('0x56')](_0x57edca['file']['originalname'])[_0xac83('0x58')](0x1),'converted_format':'wav'};var _0x4b2378=path[_0xac83('0x4c')](config['root'],'server/files/sounds/original',_0x57edca['file'][_0xac83('0x57')]);var _0x5622c5=path['join'](config[_0xac83('0x4d')],_0xac83('0x4e'),util[_0xac83('0x51')](_0xac83('0x52'),path[_0xac83('0x59')](_0x57edca[_0xac83('0x54')][_0xac83('0x57')],path[_0xac83('0x56')](_0x57edca['file']['filename'])),_0xd027[_0xac83('0x4a')]));logger[_0xac83('0x5a')]('Sound\x20upload\x20filepath:\x20%s',_0x4b2378);logger['info'](_0xac83('0x5b'),_0x5622c5);try{fs[_0xac83('0x5c')](_0x4b2378,parseInt(_0xac83('0x5d'),0x8));var _0x390780=sox[_0xac83('0x5e')](_0x4b2378,_0x5622c5,{'sampleRate':0x1f40,'format':_0xac83('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x390780['on'](_0xac83('0x60'),function(_0x51fdb7){fs[_0xac83('0x61')](_0x4b2378);_0x23fd0c['status'](0x1f4)['send'](_0x51fdb7);});_0x390780['on'](_0xac83('0x62'),function(_0x4a3cdf){_0xd027['original_duration']=isNaN(_0x4a3cdf[_0xac83('0x63')])?null:_0x4a3cdf[_0xac83('0x63')]*0x3e8;_0xd027[_0xac83('0x64')]=isNaN(_0x4a3cdf[_0xac83('0x65')])?null:_0x4a3cdf[_0xac83('0x65')];_0xd027[_0xac83('0x66')]=isNaN(_0x4a3cdf[_0xac83('0x67')])?null:_0x4a3cdf['channelCount'];_0xd027['original_bitRate']=isNaN(_0x4a3cdf[_0xac83('0x68')])?null:_0x4a3cdf[_0xac83('0x68')];_0xd027[_0xac83('0x69')]=isNaN(_0x4a3cdf['sampleRate'])?null:_0x4a3cdf[_0xac83('0x6a')];});_0x390780['on']('dest',function(_0x442f9d){_0xd027[_0xac83('0x6b')]=isNaN(_0x442f9d[_0xac83('0x63')])?null:_0x442f9d['duration']*0x3e8;_0xd027[_0xac83('0x6c')]=isNaN(_0x442f9d[_0xac83('0x65')])?null:_0x442f9d[_0xac83('0x65')];_0xd027[_0xac83('0x6d')]=isNaN(_0x442f9d['channelCount'])?null:_0x442f9d[_0xac83('0x67')];_0xd027[_0xac83('0x6e')]=isNaN(_0x442f9d[_0xac83('0x68')])?null:_0x442f9d['bitRate'];_0xd027[_0xac83('0x6f')]=isNaN(_0x442f9d['sampleRate'])?null:_0x442f9d[_0xac83('0x6a')];});_0x390780['on'](_0xac83('0x2a'),function(){fs[_0xac83('0x5c')](_0x5622c5,parseInt(_0xac83('0x5d'),0x8));return db[_0xac83('0x2e')][_0xac83('0x53')](_0xd027)[_0xac83('0x26')](function(_0x2da2c0){var _0x1b85c6={'role':_0x57edca[_0xac83('0x70')][_0xac83('0x71')],'userProfileId':_0x57edca[_0xac83('0x70')][_0xac83('0x72')]};if(!_0x1b85c6)throw new Error(_0xac83('0x73'));if(_0x1b85c6[_0xac83('0x71')]===_0xac83('0x74')){var _0x427f0d=_0x2da2c0[_0xac83('0x75')]({'plain':!![]});return db[_0xac83('0x76')]['find']({'where':{'name':_0xac83('0x28'),'userProfileId':_0x1b85c6['userProfileId']},'raw':!![]})[_0xac83('0x26')](function(_0x567818){if(_0x567818&&_0x567818['autoAssociation']===0x0){return db[_0xac83('0x29')][_0xac83('0x53')]({'name':_0x427f0d['name'],'resourceId':_0x427f0d['id'],'type':_0x567818['name'],'sectionId':_0x567818['id']},{})[_0xac83('0x26')](function(){return _0x2da2c0;});}else{return _0x2da2c0;}})['catch'](function(_0x1d05cf){logger['error'](_0xac83('0x77'),_0x1d05cf);throw _0x1d05cf;});}return _0x2da2c0;})['then'](respondWithResult(_0x23fd0c,null))[_0xac83('0x41')](handleError(_0x23fd0c,null));});_0x390780[_0xac83('0x78')]();}catch(_0x2449ac){_0x23fd0c[_0xac83('0x1a')](0x1f4)[_0xac83('0x2c')](_0x2449ac);}};exports['update']=function(_0x2d15a3,_0xaf5cf2,_0xd8cbf3){return db['Sound']['find']({'where':{'id':_0x2d15a3[_0xac83('0x43')]['id']}})['then'](handleEntityNotFound(_0xaf5cf2,null))['then'](saveUpdates(_[_0xac83('0x79')](_0x2d15a3[_0xac83('0x70')],[_0xac83('0x2b'),_0xac83('0x7a')]),null))[_0xac83('0x26')](respondWithResult(_0xaf5cf2,null))[_0xac83('0x41')](handleError(_0xaf5cf2,null));};exports[_0xac83('0x7b')]=function(_0x1f4189,_0x17ac6f,_0x200754){return db[_0xac83('0x2e')][_0xac83('0x47')]({'where':{'id':_0x1f4189[_0xac83('0x43')]['id']}})[_0xac83('0x26')](function(_0x2e2b11){if(_0x2e2b11){return _0x2e2b11['destroy']();}})[_0xac83('0x26')](function(_0x3d81dd){var _0x1e6a83=path[_0xac83('0x4c')](config[_0xac83('0x4d')],'server/files/sounds/original',util[_0xac83('0x51')](_0xac83('0x52'),_0x3d81dd['save_name'],_0x3d81dd[_0xac83('0x7c')]));var _0x2c0308=path[_0xac83('0x4c')](config['root'],_0xac83('0x4e'),util['format']('%s.%s',_0x3d81dd['save_name'],_0x3d81dd['converted_format']));fs['unlinkSync'](_0x1e6a83);fs[_0xac83('0x61')](_0x2c0308);return _0x3d81dd;})[_0xac83('0x26')](function(_0x54f6b8){if(_0x54f6b8){return _0x17ac6f[_0xac83('0x1a')](0xcc)[_0xac83('0x2a')]();}})[_0xac83('0x26')](handleEntityNotFound(_0x17ac6f,null))[_0xac83('0x41')](handleError(_0x17ac6f,null));};
\ No newline at end of file
+var _0x46fe=['catch','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sound\x20not\x20found','download','format','%s.%s','basename','file','extname','filename','originalname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_sampleCount','sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','get','Sounds','UserProfileResource','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find'];(function(_0x34db82,_0x580d46){var _0x4311b5=function(_0x5726c1){while(--_0x5726c1){_0x34db82['push'](_0x34db82['shift']());}};_0x4311b5(++_0x580d46);}(_0x46fe,0x1a1));var _0xe46f=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0x46fe[_0x2b305c];return _0x5d8c85;};'use strict';var emlformat=require(_0xe46f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe46f('0x1'));var jsonpatch=require(_0xe46f('0x2'));var rp=require(_0xe46f('0x3'));var moment=require(_0xe46f('0x4'));var BPromise=require(_0xe46f('0x5'));var Mustache=require(_0xe46f('0x6'));var util=require(_0xe46f('0x7'));var path=require(_0xe46f('0x8'));var sox=require(_0xe46f('0x9'));var csv=require(_0xe46f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe46f('0xb'));var squel=require(_0xe46f('0xc'));var crypto=require('crypto');var jsforce=require(_0xe46f('0xd'));var deskjs=require(_0xe46f('0xe'));var toCsv=require(_0xe46f('0xa'));var querystring=require('querystring');var Papa=require(_0xe46f('0xf'));var Redis=require(_0xe46f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe46f('0x11'));var as=require(_0xe46f('0x12'));var hardwareService=require(_0xe46f('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe46f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe46f('0x15'))['db'];function respondWithStatusCode(_0x521228,_0x524139){_0x524139=_0x524139||0xcc;return function(_0x582e48){if(_0x582e48){return _0x521228[_0xe46f('0x16')](_0x524139);}return _0x521228[_0xe46f('0x17')](_0x524139)[_0xe46f('0x18')]();};}function respondWithResult(_0x23dfce,_0x1cff66){_0x1cff66=_0x1cff66||0xc8;return function(_0x38b2d4){if(_0x38b2d4){return _0x23dfce['status'](_0x1cff66)[_0xe46f('0x19')](_0x38b2d4);}};}function respondWithFilteredResult(_0x51de2c,_0x5dcdc8){return function(_0x50d1d9){if(_0x50d1d9){var _0x57da57=typeof _0x5dcdc8[_0xe46f('0x1a')]===_0xe46f('0x1b')&&typeof _0x5dcdc8[_0xe46f('0x1c')]==='undefined';var _0x1a7df0=_0x50d1d9[_0xe46f('0x1d')];var _0x51dc42=_0x57da57?0x0:_0x5dcdc8[_0xe46f('0x1a')];var _0x6f77db=_0x57da57?_0x50d1d9[_0xe46f('0x1d')]:_0x5dcdc8[_0xe46f('0x1a')]+_0x5dcdc8[_0xe46f('0x1c')];var _0x3aa789;if(_0x6f77db>=_0x1a7df0){_0x6f77db=_0x1a7df0;_0x3aa789=0xc8;}else{_0x3aa789=0xce;}_0x51de2c[_0xe46f('0x17')](_0x3aa789);return _0x51de2c[_0xe46f('0x1e')](_0xe46f('0x1f'),_0x51dc42+'-'+_0x6f77db+'/'+_0x1a7df0)['json'](_0x50d1d9);}return null;};}function patchUpdates(_0x24e233){return function(_0x3b7fe7){try{jsonpatch['apply'](_0x3b7fe7,_0x24e233,!![]);}catch(_0x58e2e5){return BPromise['reject'](_0x58e2e5);}return _0x3b7fe7[_0xe46f('0x20')]();};}function saveUpdates(_0x428a79,_0x623993){return function(_0xba80c1){if(_0xba80c1){return _0xba80c1[_0xe46f('0x21')](_0x428a79)['then'](function(_0x1de69e){return _0x1de69e;});}return null;};}function removeEntity(_0x40825b,_0xf8e244){return function(_0xc707d4){if(_0xc707d4){return _0xc707d4[_0xe46f('0x22')]()[_0xe46f('0x23')](function(){var _0x3b6be9=_0xc707d4[_0xe46f('0x24')]({'plain':!![]});var _0x414efe=_0xe46f('0x25');return db[_0xe46f('0x26')][_0xe46f('0x22')]({'where':{'type':_0x414efe,'resourceId':_0x3b6be9['id']}})['then'](function(){return _0xc707d4;});})[_0xe46f('0x23')](function(){_0x40825b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7ccb,_0x524d44){return function(_0x56e20a){if(!_0x56e20a){_0x4a7ccb[_0xe46f('0x16')](0x194);}return _0x56e20a;};}function handleError(_0x418421,_0x2ca748){_0x2ca748=_0x2ca748||0x1f4;return function(_0x4d9cc4){logger['error'](_0x4d9cc4[_0xe46f('0x27')]);if(_0x4d9cc4['name']){delete _0x4d9cc4[_0xe46f('0x28')];}_0x418421[_0xe46f('0x17')](_0x2ca748)[_0xe46f('0x29')](_0x4d9cc4);};}exports[_0xe46f('0x2a')]=function(_0x25e99a,_0xd221f4){var _0x487a51={},_0x5723df={},_0x346ede={'count':0x0,'rows':[]};var _0x51cf3b=_[_0xe46f('0x2b')](db[_0xe46f('0x2c')][_0xe46f('0x2d')],function(_0x125613){return{'name':_0x125613[_0xe46f('0x2e')],'type':_0x125613[_0xe46f('0x2f')][_0xe46f('0x30')]};});_0x5723df[_0xe46f('0x31')]=_[_0xe46f('0x2b')](_0x51cf3b,'name');_0x5723df[_0xe46f('0x32')]=_[_0xe46f('0x33')](_0x25e99a[_0xe46f('0x32')]);_0x5723df[_0xe46f('0x34')]=_[_0xe46f('0x35')](_0x5723df[_0xe46f('0x31')],_0x5723df[_0xe46f('0x32')]);_0x487a51[_0xe46f('0x36')]=_['intersection'](_0x5723df[_0xe46f('0x31')],qs[_0xe46f('0x37')](_0x25e99a[_0xe46f('0x32')]['fields']));_0x487a51[_0xe46f('0x36')]=_0x487a51[_0xe46f('0x36')][_0xe46f('0x38')]?_0x487a51[_0xe46f('0x36')]:_0x5723df[_0xe46f('0x31')];if(!_0x25e99a[_0xe46f('0x32')][_0xe46f('0x39')]('nolimit')){_0x487a51[_0xe46f('0x1c')]=qs['limit'](_0x25e99a['query'][_0xe46f('0x1c')]);_0x487a51[_0xe46f('0x1a')]=qs[_0xe46f('0x1a')](_0x25e99a['query'][_0xe46f('0x1a')]);}_0x487a51[_0xe46f('0x3a')]=qs['sort'](_0x25e99a['query'][_0xe46f('0x3b')]);_0x487a51[_0xe46f('0x3c')]=qs[_0xe46f('0x34')](_['pick'](_0x25e99a['query'],_0x5723df[_0xe46f('0x34')]),_0x51cf3b);if(_0x25e99a[_0xe46f('0x32')][_0xe46f('0x3d')]){_0x487a51[_0xe46f('0x3c')]=_[_0xe46f('0x3e')](_0x487a51[_0xe46f('0x3c')],{'$or':_[_0xe46f('0x2b')](_0x51cf3b,function(_0x1e9073){if(_0x1e9073[_0xe46f('0x2f')]!==_0xe46f('0x3f')){var _0x2dfd5a={};_0x2dfd5a[_0x1e9073[_0xe46f('0x28')]]={'$like':'%'+_0x25e99a[_0xe46f('0x32')][_0xe46f('0x3d')]+'%'};return _0x2dfd5a;}})});}_0x487a51=_[_0xe46f('0x3e')]({},_0x487a51,_0x25e99a[_0xe46f('0x40')]);var _0x2bb426={'where':_0x487a51[_0xe46f('0x3c')]};return db[_0xe46f('0x2c')][_0xe46f('0x1d')](_0x2bb426)[_0xe46f('0x23')](function(_0x29b3db){_0x346ede[_0xe46f('0x1d')]=_0x29b3db;if(_0x25e99a['query'][_0xe46f('0x41')]){_0x487a51[_0xe46f('0x42')]=[{'all':!![]}];}return db['Sound'][_0xe46f('0x43')](_0x487a51);})[_0xe46f('0x23')](function(_0x422dc3){_0x346ede[_0xe46f('0x44')]=_0x422dc3;return _0x346ede;})['then'](respondWithFilteredResult(_0xd221f4,_0x487a51))['catch'](handleError(_0xd221f4,null));};exports[_0xe46f('0x45')]=function(_0x596bb0,_0x50a4a0){var _0x1ff5cf={'raw':!![],'where':{'id':_0x596bb0['params']['id']}},_0x1e07a5={};_0x1e07a5[_0xe46f('0x31')]=_[_0xe46f('0x33')](db[_0xe46f('0x2c')][_0xe46f('0x2d')]);_0x1e07a5[_0xe46f('0x32')]=_['keys'](_0x596bb0[_0xe46f('0x32')]);_0x1e07a5[_0xe46f('0x34')]=_['intersection'](_0x1e07a5[_0xe46f('0x31')],_0x1e07a5[_0xe46f('0x32')]);_0x1ff5cf[_0xe46f('0x36')]=_[_0xe46f('0x35')](_0x1e07a5[_0xe46f('0x31')],qs[_0xe46f('0x37')](_0x596bb0[_0xe46f('0x32')]['fields']));_0x1ff5cf[_0xe46f('0x36')]=_0x1ff5cf[_0xe46f('0x36')][_0xe46f('0x38')]?_0x1ff5cf[_0xe46f('0x36')]:_0x1e07a5[_0xe46f('0x31')];if(_0x596bb0[_0xe46f('0x32')]['includeAll']){_0x1ff5cf['include']=[{'all':!![]}];}_0x1ff5cf=_[_0xe46f('0x3e')]({},_0x1ff5cf,_0x596bb0['options']);return db['Sound'][_0xe46f('0x46')](_0x1ff5cf)[_0xe46f('0x23')](handleEntityNotFound(_0x50a4a0,null))[_0xe46f('0x23')](respondWithResult(_0x50a4a0,null))[_0xe46f('0x47')](handleError(_0x50a4a0,null));};exports['download']=function(_0x1f3a68,_0x45f7dd,_0x4c4a9d){return db['Sound'][_0xe46f('0x46')]({'where':{'id':_0x1f3a68[_0xe46f('0x48')]['id']},'attributes':[_0xe46f('0x28'),_0xe46f('0x49'),_0xe46f('0x4a')],'raw':!![]})[_0xe46f('0x23')](handleEntityNotFound(_0x45f7dd,null))[_0xe46f('0x23')](function(_0x50f0bf){if(_0x50f0bf){if(!fs[_0xe46f('0x4b')](path[_0xe46f('0x4c')](config[_0xe46f('0x4d')],_0xe46f('0x4e'),_0x50f0bf[_0xe46f('0x49')]+'.'+_0x50f0bf[_0xe46f('0x4a')]))){throw new db['Sequelize']['ValidationError'](_0xe46f('0x4f'));}return _0x45f7dd[_0xe46f('0x50')](path['join'](config[_0xe46f('0x4d')],_0xe46f('0x4e'),util[_0xe46f('0x51')](_0xe46f('0x52'),_0x50f0bf[_0xe46f('0x49')],_0x50f0bf[_0xe46f('0x4a')])),util['format']('%s.%s',_0x50f0bf[_0xe46f('0x28')],_0x50f0bf['converted_format']));}return null;})[_0xe46f('0x47')](handleError(_0x45f7dd,null));};exports['create']=function(_0x53badf,_0x2d012f,_0x6ae16d){var _0x1a2da2={'name':path[_0xe46f('0x53')](_0x53badf[_0xe46f('0x54')]['originalname'],path[_0xe46f('0x55')](_0x53badf[_0xe46f('0x54')]['originalname'])),'save_name':path[_0xe46f('0x53')](_0x53badf['file'][_0xe46f('0x56')],path[_0xe46f('0x55')](_0x53badf[_0xe46f('0x54')][_0xe46f('0x56')])),'original_format':path['extname'](_0x53badf['file'][_0xe46f('0x57')])[_0xe46f('0x58')](0x1),'converted_format':_0xe46f('0x59')};var _0xb1ec4a=path[_0xe46f('0x4c')](config[_0xe46f('0x4d')],_0xe46f('0x5a'),_0x53badf[_0xe46f('0x54')]['filename']);var _0x2256a2=path[_0xe46f('0x4c')](config[_0xe46f('0x4d')],_0xe46f('0x4e'),util['format'](_0xe46f('0x52'),path[_0xe46f('0x53')](_0x53badf[_0xe46f('0x54')][_0xe46f('0x56')],path[_0xe46f('0x55')](_0x53badf['file']['filename'])),_0x1a2da2[_0xe46f('0x4a')]));logger[_0xe46f('0x5b')](_0xe46f('0x5c'),_0xb1ec4a);logger[_0xe46f('0x5b')](_0xe46f('0x5d'),_0x2256a2);try{fs[_0xe46f('0x5e')](_0xb1ec4a,parseInt(_0xe46f('0x5f'),0x8));var _0x41771a=sox[_0xe46f('0x60')](_0xb1ec4a,_0x2256a2,{'sampleRate':0x1f40,'format':_0xe46f('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x41771a['on']('error',function(_0x2f9f96){fs['unlinkSync'](_0xb1ec4a);_0x2d012f[_0xe46f('0x17')](0x1f4)['send'](_0x2f9f96);});_0x41771a['on'](_0xe46f('0x61'),function(_0x38dfb7){_0x1a2da2[_0xe46f('0x62')]=isNaN(_0x38dfb7['duration'])?null:_0x38dfb7[_0xe46f('0x63')]*0x3e8;_0x1a2da2[_0xe46f('0x64')]=isNaN(_0x38dfb7['sampleCount'])?null:_0x38dfb7['sampleCount'];_0x1a2da2[_0xe46f('0x65')]=isNaN(_0x38dfb7['channelCount'])?null:_0x38dfb7[_0xe46f('0x66')];_0x1a2da2['original_bitRate']=isNaN(_0x38dfb7[_0xe46f('0x67')])?null:_0x38dfb7[_0xe46f('0x67')];_0x1a2da2['original_sampleRate']=isNaN(_0x38dfb7[_0xe46f('0x68')])?null:_0x38dfb7['sampleRate'];});_0x41771a['on'](_0xe46f('0x69'),function(_0x511ff0){_0x1a2da2['converted_duration']=isNaN(_0x511ff0[_0xe46f('0x63')])?null:_0x511ff0[_0xe46f('0x63')]*0x3e8;_0x1a2da2[_0xe46f('0x6a')]=isNaN(_0x511ff0[_0xe46f('0x6b')])?null:_0x511ff0[_0xe46f('0x6b')];_0x1a2da2[_0xe46f('0x6c')]=isNaN(_0x511ff0['channelCount'])?null:_0x511ff0[_0xe46f('0x66')];_0x1a2da2[_0xe46f('0x6d')]=isNaN(_0x511ff0[_0xe46f('0x67')])?null:_0x511ff0[_0xe46f('0x67')];_0x1a2da2[_0xe46f('0x6e')]=isNaN(_0x511ff0[_0xe46f('0x68')])?null:_0x511ff0[_0xe46f('0x68')];});_0x41771a['on']('end',function(){fs[_0xe46f('0x5e')](_0x2256a2,parseInt(_0xe46f('0x5f'),0x8));return db[_0xe46f('0x2c')][_0xe46f('0x6f')](_0x1a2da2)[_0xe46f('0x23')](function(_0x25484b){var _0x10f980={'role':_0x53badf[_0xe46f('0x70')][_0xe46f('0x71')],'userProfileId':_0x53badf[_0xe46f('0x70')]['userProfileId']};if(!_0x10f980)throw new Error(_0xe46f('0x72'));if(_0x10f980['role']===_0xe46f('0x73')){var _0x4dbab3=_0x25484b[_0xe46f('0x24')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xe46f('0x25'),'userProfileId':_0x10f980['userProfileId']},'raw':!![]})[_0xe46f('0x23')](function(_0x415b1d){if(_0x415b1d&&_0x415b1d[_0xe46f('0x74')]===0x0){return db[_0xe46f('0x26')][_0xe46f('0x6f')]({'name':_0x4dbab3[_0xe46f('0x28')],'resourceId':_0x4dbab3['id'],'type':_0x415b1d[_0xe46f('0x28')],'sectionId':_0x415b1d['id']},{})[_0xe46f('0x23')](function(){return _0x25484b;});}else{return _0x25484b;}})[_0xe46f('0x47')](function(_0x2c9d6b){logger['error'](_0xe46f('0x75'),_0x2c9d6b);throw _0x2c9d6b;});}return _0x25484b;})[_0xe46f('0x23')](respondWithResult(_0x2d012f,null))['catch'](handleError(_0x2d012f,null));});_0x41771a[_0xe46f('0x76')]();}catch(_0x1f7b06){_0x2d012f[_0xe46f('0x17')](0x1f4)[_0xe46f('0x29')](_0x1f7b06);}};exports['update']=function(_0x2fc77f,_0x25b0ab,_0x865899){return db[_0xe46f('0x2c')][_0xe46f('0x46')]({'where':{'id':_0x2fc77f[_0xe46f('0x48')]['id']}})[_0xe46f('0x23')](handleEntityNotFound(_0x25b0ab,null))[_0xe46f('0x23')](saveUpdates(_['pick'](_0x2fc77f[_0xe46f('0x70')],['name','description']),null))[_0xe46f('0x23')](respondWithResult(_0x25b0ab,null))['catch'](handleError(_0x25b0ab,null));};exports[_0xe46f('0x77')]=function(_0x71f104,_0x2e3aec,_0xc8cfd7){return db['Sound'][_0xe46f('0x46')]({'where':{'id':_0x71f104[_0xe46f('0x48')]['id']}})[_0xe46f('0x23')](function(_0x5f21b9){if(_0x5f21b9){return _0x5f21b9[_0xe46f('0x22')]();}})[_0xe46f('0x23')](function(_0x5c99e8){var _0x2be2fc=path[_0xe46f('0x4c')](config['root'],'server/files/sounds/original',util[_0xe46f('0x51')](_0xe46f('0x52'),_0x5c99e8[_0xe46f('0x49')],_0x5c99e8[_0xe46f('0x78')]));var _0x28df2c=path[_0xe46f('0x4c')](config['root'],_0xe46f('0x4e'),util[_0xe46f('0x51')](_0xe46f('0x52'),_0x5c99e8[_0xe46f('0x49')],_0x5c99e8[_0xe46f('0x4a')]));fs[_0xe46f('0x79')](_0x2be2fc);fs[_0xe46f('0x79')](_0x28df2c);return _0x5c99e8;})[_0xe46f('0x23')](function(_0x418606){if(_0x418606){return _0x2e3aec[_0xe46f('0x17')](0xcc)[_0xe46f('0x18')]();}})[_0xe46f('0x23')](handleEntityNotFound(_0x2e3aec,null))[_0xe46f('0x47')](handleError(_0x2e3aec,null));};
\ No newline at end of file