diff --git a/recognize/src/include/recognize.h b/recognize/src/include/recognize.h index 7727725..6a16d73 100644 --- a/recognize/src/include/recognize.h +++ b/recognize/src/include/recognize.h @@ -23,6 +23,7 @@ #define SIZE_BUFFER 256 #define CONFIDENCE_RATE 0.10 +#define PATH_JCONFIG "vlibras_user/vlibras-core/recognize/src/julius.jconf" #define PATH_AUDIO_ORIGIN "/audio/origin/audio_origin.wav" #define PATH_AUDIO_PARTS "/audio/parts/" #define FILENAME_RECOGNIZED_OUT "/audio/recognized.out" diff --git a/recognize/src/recognize.cpp b/recognize/src/recognize.cpp index c910ac6..5be255e 100644 --- a/recognize/src/recognize.cpp +++ b/recognize/src/recognize.cpp @@ -208,10 +208,19 @@ void Recognize::breakVideoParts(int timeTotal) { void Recognize::executeJuliusEngine() { - string command, type, freqStr; + string type, freqStr; + string command = "julius - C "; char cfreq[10]; - command = "julius -C vlibras_user/vlibras-core/recognize/src/julius.jconf -input "; + char* jPath; + jPath = getenv("JCONFIG"); + + if(jPath != NULL) + command.append(jPath); + else + command.append(PATH_JCONFIG); + + command.append(" -input "); if (inputType == 1) type = "rawfile"; diff --git a/servico/src/serviceWindowGenerationFromRec.cpp b/servico/src/serviceWindowGenerationFromRec.cpp index 3d538aa..c506130 100644 --- a/servico/src/serviceWindowGenerationFromRec.cpp +++ b/servico/src/serviceWindowGenerationFromRec.cpp @@ -34,9 +34,13 @@ ServiceWindowGenerationFromRec::ServiceWindowGenerationFromRec( numero_legendas = INT_MAX; legendas_enviadas = 0; vetor_pts = new vector(); - rec = new Recognize(path_input, id);// parametro 1 indica que é um cliente web + rec = new Recognize(path_input, id); tradutor = new TradutorPortGlosa(); - setPathContents(); + try{ + setPathContents(); + }catch(RuntimeException ex){ + throw ServiceException(ex.getMessage()); + } running = true; finish = false; DPRINTF("Done!\n"); @@ -83,13 +87,20 @@ void ServiceWindowGenerationFromRec::setPathLibras(){ void ServiceWindowGenerationFromRec::setBackground(){ if(this->transparency == 0) { //pega dicionario com BackGround opaco - sincronizador = new Synchronizer(BASEDIR, EXTENSAO_DICIONARIO, - this->path_libras, this->transparency); - } else { - if(this->transparency == 1) { //pega dicionario com BackGround transparente - sincronizador = new Synchronizer(BASEDIRTRANSP, EXTENSAO_DICIONARIO, - this->path_libras, this->transparency); - } + char* dicPath; + dicPath = getenv("DIC_LIBRAS"); + if(dicPath != NULL) + sincronizador = new Synchronizer(dicPath, EXTENSAO_DICIONARIO, this->path_libras, this->transparency); + else + sincronizador = new Synchronizer(BASEDIR, EXTENSAO_DICIONARIO, this->path_libras, this->transparency); + + } else if(this->transparency == 1) { //pega dicionario com BackGround transparente + char* dicTPath; + dicTPath = getenv("DICTRANSP_LIBRAS"); + if(dicTPath != NULL) + sincronizador = new Synchronizer(dicTPath, EXTENSAO_DICIONARIO, this->path_libras, this->transparency); + else + sincronizador = new Synchronizer(BASEDIRTRANSP, EXTENSAO_DICIONARIO, this->path_libras, this->transparency); } } diff --git a/servico/src/serviceWindowGenerationFromSRT.cpp b/servico/src/serviceWindowGenerationFromSRT.cpp index 7160f5a..080e920 100644 --- a/servico/src/serviceWindowGenerationFromSRT.cpp +++ b/servico/src/serviceWindowGenerationFromSRT.cpp @@ -17,7 +17,11 @@ ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* pathVideo, vetor_pts = new vector(); tradutor = new TradutorPortGlosa(); extrator_factory = new ExtratorFactory(); - setPathContents(); + try{ + setPathContents(); + }catch(RuntimeException ex){ + throw ServiceException(ex.getMessage()); + } running = true; finish = false; DPRINTF("Done!\n"); @@ -35,7 +39,11 @@ ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* pathSRT, in vetor_pts = new vector(); tradutor = new TradutorPortGlosa(); extrator_factory = new ExtratorFactory(); - setPathContents(); + try{ + setPathContents(); + }catch(RuntimeException ex){ + throw ServiceException(ex.getMessage()); + } running = true; finish = false; DPRINTF("Done!\n"); @@ -81,13 +89,20 @@ void ServiceWindowGenerationFromSRT::setPathLibras() { void ServiceWindowGenerationFromSRT::setBackground() { if(this->transparency == 0) { //pega dicionario com BackGround opaco - sincronizador = new Synchronizer(BASEDIR, EXTENSAO_DICIONARIO, - this->path_libras, this->transparency); - } else { - if(this->transparency == 1) { //pega dicionario com BackGround transparente - sincronizador = new Synchronizer(BASEDIRTRANSP, EXTENSAO_DICIONARIO, - this->path_libras, this->transparency); - } + char* dicPath; + dicPath = getenv("DIC_LIBRAS"); + if(dicPath != NULL) + sincronizador = new Synchronizer(dicPath, EXTENSAO_DICIONARIO, this->path_libras, this->transparency); + else + sincronizador = new Synchronizer(BASEDIR, EXTENSAO_DICIONARIO, this->path_libras, this->transparency); + + } else if(this->transparency == 1) { //pega dicionario com BackGround transparente + char* dicTPath; + dicTPath = getenv("DICTRANSP_LIBRAS"); + if(dicTPath != NULL) + sincronizador = new Synchronizer(dicTPath, EXTENSAO_DICIONARIO, this->path_libras, this->transparency); + else + sincronizador = new Synchronizer(BASEDIRTRANSP, EXTENSAO_DICIONARIO, this->path_libras, this->transparency); } } diff --git a/servico/src/serviceWindowGenerationFromText.cpp b/servico/src/serviceWindowGenerationFromText.cpp index 4b77d85..c636a68 100644 --- a/servico/src/serviceWindowGenerationFromText.cpp +++ b/servico/src/serviceWindowGenerationFromText.cpp @@ -12,7 +12,11 @@ ServiceWindowGenerationFromText::ServiceWindowGenerationFromText(char* pathFile, vetor_pts = new vector(); tradutor = new TradutorPortGlosa(); extrator_factory = new ExtratorFactory(); - setPathContents(); + try{ + setPathContents(); + }catch(RuntimeException ex){ + throw ServiceException(ex.getMessage()); + } running = true; finish = false; DPRINTF("Done!\n"); @@ -35,7 +39,7 @@ void ServiceWindowGenerationFromText::setPathContents() { ifstream conf_file(PATH_CONF_FILE, ifstream::binary); parsingSuccessful = reader.parse(conf_file, root); if(!parsingSuccessful){ - throw ServiceException("Fail to parsing param.json"); + throw new RuntimeException("Fail to parsing param.json"); } string attr = root.get("storage", PATH_VBOX_UPLOADS).asString(); this->path_contents = new char[MAX_SIZE_PATH]; @@ -56,14 +60,22 @@ void ServiceWindowGenerationFromText::setPathLibras() { } void ServiceWindowGenerationFromText::setBackground() { - if(this->transparency == 0) { //pega dicionario com BackGround opaco - sincronizador = new Synchronizer(BASEDIR, EXTENSAO_DICIONARIO, - this->path_libras, this->transparency); - } else { - if(this->transparency == 1) { //pega dicionario com BackGround transparente - sincronizador = new Synchronizer(BASEDIRTRANSP, EXTENSAO_DICIONARIO, - this->path_libras, this->transparency); - } + if(this->transparency == 0) { //pega dicionario com BackGround opaco + char* dicPath; + dicPath = getenv("DIC_LIBRAS"); + if(dicPath != NULL) + sincronizador = new Synchronizer(dicPath, EXTENSAO_DICIONARIO, this->path_libras, this->transparency); + else + sincronizador = new Synchronizer(BASEDIR, EXTENSAO_DICIONARIO, this->path_libras, this->transparency); + + } else if(this->transparency == 1) { //pega dicionario com BackGround transparente + char* dicTPath; + dicTPath = getenv("DICTRANSP_LIBRAS"); + if(dicTPath != NULL) + sincronizador = new Synchronizer(dicTPath, EXTENSAO_DICIONARIO, this->path_libras, this->transparency); + else{ + sincronizador = new Synchronizer(BASEDIRTRANSP, EXTENSAO_DICIONARIO, this->path_libras, this->transparency); + } } } -- libgit2 0.21.2