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

main.cpp
... ... @@ -321,15 +321,29 @@ void hasInvalid(){
321 321  
322 322 void setPathContents(int mode, string id){
323 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 349 void help()
... ...
recognize/src/recognize.cpp
... ... @@ -443,7 +443,14 @@ void Recognize::executeGoogleEngine() {
443 443  
444 444 wavcut = new Wavcut(pathAudio,outputPath,_id);
445 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 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 15 msgErr = "";
16 16 finish = false;
17 17 fail = false;
18   - setPathContents();
19 18 PRINTL(util::_DEBUG, "Done!\n");
20 19 }
21 20  
... ... @@ -24,6 +23,9 @@ ServiceTester::~ServiceTester() {
24 23 }
25 24  
26 25 void ServiceTester::checkServiceSRT() {
  26 +
  27 + setPathContents();
  28 +
27 29 service_srt = new ServiceWindowGenerationFromSRT((char*)VID_FILE, (char*)SRT_FILE, 1, position,
28 30 resolution, background, (char*)TESTER_ID, MODE_TEST, 1);
29 31  
... ... @@ -48,6 +50,9 @@ void ServiceTester::checkServiceSRT() {
48 50 }
49 51  
50 52 void ServiceTester::checkServiceRec() {
  53 +
  54 + setPathContents();
  55 +
51 56 service_rec = new ServiceWindowGenerationFromRec((char*)REC_FILE, 0, 0,
52 57 background, (char*)TESTER_ID, MODE_TEST, 6);// 6 serviço sem mixagem
53 58  
... ... @@ -70,6 +75,9 @@ void ServiceTester::checkServiceRec() {
70 75 deleteFiles();
71 76 }
72 77 void ServiceTester::checkServiceText() {
  78 +
  79 + setPathContents();
  80 +
73 81 service_text = new ServiceWindowGenerationFromText((char*)TXT_FILE, 1, background,
74 82 (char*)TESTER_ID, MODE_TEST);
75 83  
... ... @@ -141,7 +149,8 @@ void ServiceTester::setPathContents() {
141 149  
142 150 void ServiceTester::deleteFiles() {
143 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 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 135 }
136 136  
137 137 if (argc < 2){
138   - printf("Not enough arguments.\nTry --help.\n");
  138 + printf("Not enough arguments. Try --help.\n");
139 139 throw lavidlib::RuntimeException();
140 140 }
141 141  
... ...