Commit 8214776dfd322de53bb13576fd150a6f12f1a5c9

Authored by Wesnydy Ribeiro
1 parent 22f08e2f
Exists in master and in 1 other branch devel

Ajustes para gerar o .deb e correção nos paths

@@ -321,15 +321,29 @@ void hasInvalid(){ @@ -321,15 +321,29 @@ void hasInvalid(){
321 321
322 void setPathContents(int mode, string id){ 322 void setPathContents(int mode, string id){
323 string command = "mkdir -p "; 323 string command = "mkdir -p ";
324 - if(mode == 1)// 1 aqui é devel  
325 - command.append(PATH_DEVEL_CONTENTS).append(" && mkdir -p ").append(PATH_DEVEL_UPLOADS).append("/").append(id);  
326 - else if (mode == 2)// 2 aqui é prod  
327 - command.append(PATH_VBOX_UPLOADS);  
328 - else {  
329 - fail("Modo de execução não reconhecido!");  
330 - exit(127); 324 + switch(mode){
  325 + case 1://devel
  326 + char* vlStorage;
  327 + char* vlUploads;
  328 + vlStorage = getenv("VLSTORAGE");
  329 + vlUploads = getenv("VLUPLOADS");
  330 +
  331 + if(vlStorage == NULL || vlUploads == NULL){
  332 + command.append(PATH_DEVEL_CONTENTS).append(" && mkdir -p ")
  333 + .append(PATH_DEVEL_UPLOADS).append("/").append(id);
  334 + system(command.c_str());
  335 + }
  336 + break;
  337 +
  338 + case 2://produção
  339 + command.append(PATH_VBOX_UPLOADS).append("/").append(id);
  340 + system(command.c_str());
  341 + break;
  342 +
  343 + default:
  344 + fail("Modo de execução não reconhecido!");
  345 + exit(127);
331 } 346 }
332 - system(command.c_str());  
333 } 347 }
334 348
335 void help() 349 void help()
recognize/src/recognize.cpp
@@ -443,7 +443,14 @@ void Recognize::executeGoogleEngine() { @@ -443,7 +443,14 @@ void Recognize::executeGoogleEngine() {
443 443
444 wavcut = new Wavcut(pathAudio,outputPath,_id); 444 wavcut = new Wavcut(pathAudio,outputPath,_id);
445 Jconf *jconf; 445 Jconf *jconf;
446 - jconf = j_config_load_file_new(PATH_WCONFIG); 446 +
  447 + char* wPath;
  448 + wPath = getenv("WCONFIG");
  449 +
  450 + if(wPath != NULL)
  451 + jconf = j_config_load_file_new(wPath);
  452 + else
  453 + jconf = j_config_load_file_new(PATH_WCONFIG);
447 454
448 if(wavcut->initialize(jconf)<2){ 455 if(wavcut->initialize(jconf)<2){
449 456
servico/src/serviceTester.cpp
@@ -15,7 +15,6 @@ ServiceTester::ServiceTester(int _position, int _size, int _background) { @@ -15,7 +15,6 @@ ServiceTester::ServiceTester(int _position, int _size, int _background) {
15 msgErr = ""; 15 msgErr = "";
16 finish = false; 16 finish = false;
17 fail = false; 17 fail = false;
18 - setPathContents();  
19 PRINTL(util::_DEBUG, "Done!\n"); 18 PRINTL(util::_DEBUG, "Done!\n");
20 } 19 }
21 20
@@ -24,6 +23,9 @@ ServiceTester::~ServiceTester() { @@ -24,6 +23,9 @@ ServiceTester::~ServiceTester() {
24 } 23 }
25 24
26 void ServiceTester::checkServiceSRT() { 25 void ServiceTester::checkServiceSRT() {
  26 +
  27 + setPathContents();
  28 +
27 service_srt = new ServiceWindowGenerationFromSRT((char*)VID_FILE, (char*)SRT_FILE, 1, position, 29 service_srt = new ServiceWindowGenerationFromSRT((char*)VID_FILE, (char*)SRT_FILE, 1, position,
28 resolution, background, (char*)TESTER_ID, MODE_TEST, 1); 30 resolution, background, (char*)TESTER_ID, MODE_TEST, 1);
29 31
@@ -48,6 +50,9 @@ void ServiceTester::checkServiceSRT() { @@ -48,6 +50,9 @@ void ServiceTester::checkServiceSRT() {
48 } 50 }
49 51
50 void ServiceTester::checkServiceRec() { 52 void ServiceTester::checkServiceRec() {
  53 +
  54 + setPathContents();
  55 +
51 service_rec = new ServiceWindowGenerationFromRec((char*)REC_FILE, 0, 0, 56 service_rec = new ServiceWindowGenerationFromRec((char*)REC_FILE, 0, 0,
52 background, (char*)TESTER_ID, MODE_TEST, 6);// 6 serviço sem mixagem 57 background, (char*)TESTER_ID, MODE_TEST, 6);// 6 serviço sem mixagem
53 58
@@ -70,6 +75,9 @@ void ServiceTester::checkServiceRec() { @@ -70,6 +75,9 @@ void ServiceTester::checkServiceRec() {
70 deleteFiles(); 75 deleteFiles();
71 } 76 }
72 void ServiceTester::checkServiceText() { 77 void ServiceTester::checkServiceText() {
  78 +
  79 + setPathContents();
  80 +
73 service_text = new ServiceWindowGenerationFromText((char*)TXT_FILE, 1, background, 81 service_text = new ServiceWindowGenerationFromText((char*)TXT_FILE, 1, background,
74 (char*)TESTER_ID, MODE_TEST); 82 (char*)TESTER_ID, MODE_TEST);
75 83
@@ -141,7 +149,8 @@ void ServiceTester::setPathContents() { @@ -141,7 +149,8 @@ void ServiceTester::setPathContents() {
141 149
142 void ServiceTester::deleteFiles() { 150 void ServiceTester::deleteFiles() {
143 string command = "rm -f "; 151 string command = "rm -f ";
144 - command.append(OUT_FILE); 152 + command.append(OUT_FILE).append(" && rm -rf ")
  153 + .append(PATH_TEST_UPLOADS).append("/").append(TESTER_ID);
145 system(command.c_str()); 154 system(command.c_str());
146 } 155 }
147 156
util/src/argParser.cpp
@@ -135,7 +135,7 @@ void ArgParser::readArgs(char** argv, int argc) @@ -135,7 +135,7 @@ void ArgParser::readArgs(char** argv, int argc)
135 } 135 }
136 136
137 if (argc < 2){ 137 if (argc < 2){
138 - printf("Not enough arguments.\nTry --help.\n"); 138 + printf("Not enough arguments. Try --help.\n");
139 throw lavidlib::RuntimeException(); 139 throw lavidlib::RuntimeException();
140 } 140 }
141 141