Commit 78f71b6a5a062c5884833f6b1f7f00b74933da63
1 parent
995de273
Exists in
master
and in
1 other branch
Adicionado serviço de teste
Showing
19 changed files
with
160 additions
and
120 deletions
Show diff stats
Makefile
extrator/src/extratorSRT.cpp
| ... | ... | @@ -5,7 +5,7 @@ ExtratorSRT::ExtratorSRT(){ |
| 5 | 5 | finish = false; |
| 6 | 6 | seek_pos = 0; |
| 7 | 7 | hasNextSub = true; |
| 8 | - printl(util::_DEBUG, "Done!\n"); | |
| 8 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | ExtratorSRT::~ExtratorSRT(){ |
| ... | ... | @@ -13,7 +13,7 @@ ExtratorSRT::~ExtratorSRT(){ |
| 13 | 13 | delete listeners; |
| 14 | 14 | //if (bff_reader) delete bff_reader; |
| 15 | 15 | if (file_io) delete file_io; |
| 16 | - printl(util::_DEBUG, "ExtratorSTR finalized!\n"); | |
| 16 | + PRINTL(util::_DEBUG, "ExtratorSTR finalized!\n"); | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | void ExtratorSRT::initialize(){ |
| ... | ... | @@ -43,7 +43,7 @@ void ExtratorSRT::notifyListeners(unsigned char* subtitle, int64_t pts) { |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | void ExtratorSRT::notifyEndExtraction(int size) { |
| 46 | - printl(util::_DEBUG, "Extrator SRT concluiu a extração: %d legendas.\n", size); | |
| 46 | + PRINTL(util::_DEBUG, "Extrator SRT concluiu a extração: %d legendas.\n", size); | |
| 47 | 47 | for(list<ListenerSRT*>::iterator it = listeners->begin(); it != listeners->end(); it++){ |
| 48 | 48 | (*it)->notifyEnd(size); |
| 49 | 49 | } |
| ... | ... | @@ -72,7 +72,7 @@ bool ExtratorSRT::hasNextSubtitle() { |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | void ExtratorSRT::Run(){ |
| 75 | - printl(util::_INFO, "Extraindo Legendas...\n"); | |
| 75 | + PRINTL(util::_INFO, "Extraindo Legendas...\n"); | |
| 76 | 76 | int sub_index = 0; |
| 77 | 77 | string sub_text = ""; |
| 78 | 78 | while(hasNextSubtitle()){ | ... | ... |
extrator/src/extratorTXT.cpp
| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | ExtratorTXT::ExtratorTXT(){ |
| 15 | 15 | listeners = new list<ListenerTXT*>(); |
| 16 | 16 | finish = false; |
| 17 | - printl(util::_DEBUG, "Done!\n"); | |
| 17 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | ExtratorTXT::~ExtratorTXT(){ |
| ... | ... | @@ -23,7 +23,7 @@ ExtratorTXT::~ExtratorTXT(){ |
| 23 | 23 | delete file; |
| 24 | 24 | delete file_io; |
| 25 | 25 | delete bff_reader; |
| 26 | - printl(util::_DEBUG, "ExtratorTXT finalized!\n"); | |
| 26 | + PRINTL(util::_DEBUG, "ExtratorTXT finalized!\n"); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | void ExtratorTXT::initialize(){ |
| ... | ... | @@ -50,7 +50,7 @@ void ExtratorTXT::notifyListeners(unsigned char* line) { |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | void ExtratorTXT::notifyEndExtraction(int size) { |
| 53 | - printl(util::_DEBUG, "ExtratorTXT concluiu a extração: %d linhas.\n", size); | |
| 53 | + PRINTL(util::_DEBUG, "ExtratorTXT concluiu a extração: %d linhas.\n", size); | |
| 54 | 54 | for(list<ListenerTXT*>::iterator it = listeners->begin(); it != listeners->end(); it++){ |
| 55 | 55 | (*it)->notifyEnd(size); |
| 56 | 56 | } |
| ... | ... | @@ -75,7 +75,7 @@ bool ExtratorTXT::isFinished(){ |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | void ExtratorTXT::Run(){ |
| 78 | - printl(util::_INFO, "Extraindo Texto...\n"); | |
| 78 | + PRINTL(util::_INFO, "Extraindo Texto...\n"); | |
| 79 | 79 | int line_index = 0; |
| 80 | 80 | bool hasNext = true; |
| 81 | 81 | string line; | ... | ... |
input/src/inputFile.cpp
| ... | ... | @@ -5,13 +5,13 @@ InputFile::InputFile(char* path) { |
| 5 | 5 | this->path = path; |
| 6 | 6 | this->listeners = new list<ListenerInput*>(); |
| 7 | 7 | finish = false; |
| 8 | - printl(util::_DEBUG, "Done!\n"); | |
| 8 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | InputFile::~InputFile(){ |
| 12 | 12 | listeners->clear(); |
| 13 | 13 | delete listeners; |
| 14 | - printl(util::_DEBUG, "Input finalized!\n"); | |
| 14 | + PRINTL(util::_DEBUG, "Input finalized!\n"); | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | void InputFile::initialize(){ |
| ... | ... | @@ -20,7 +20,7 @@ void InputFile::initialize(){ |
| 20 | 20 | if (strstr(path, ".ts") != NULL) { |
| 21 | 21 | if (filein.is_open()) { |
| 22 | 22 | char buffer [MAX_SIZE_PACKET]; |
| 23 | - printl(util::_INFO, "Lendo arquivo...\n"); | |
| 23 | + PRINTL(util::_INFO, "Lendo arquivo...\n"); | |
| 24 | 24 | while (!filein.eof()) { |
| 25 | 25 | filein.read(buffer, MAX_SIZE_PACKET); |
| 26 | 26 | unsigned char* packet = (unsigned char*) buffer; | ... | ... |
main.cpp
| ... | ... | @@ -24,9 +24,9 @@ |
| 24 | 24 | #include <lavidlib/base/RuntimeException.h> |
| 25 | 25 | |
| 26 | 26 | #define MAX_SIZE_PATH 256 |
| 27 | -#define PATH_VBOX_UPLOADS "vlibras_user/.vlibras-config/uploads" | |
| 27 | +#define PATH_VBOX_UPLOADS "vlibras_user/.vlibras-config/uploads" | |
| 28 | 28 | #define PATH_DEVEL_CONTENTS "vlibras_user/vlibras-contents/videos" |
| 29 | -#define PATH_DEVEL_UPLOADS "vlibras_user/vlibras-contents/uploads" | |
| 29 | +#define PATH_DEVEL_UPLOADS "vlibras_user/vlibras-contents/uploads" | |
| 30 | 30 | |
| 31 | 31 | using namespace std; |
| 32 | 32 | using namespace util; |
| ... | ... | @@ -37,11 +37,11 @@ void serviceOnlySRT(int service, string path_srt, int language, int background, |
| 37 | 37 | void serviceOnlyAudio(int service, string path_audio, int background, string id, int mode); |
| 38 | 38 | void serviceText(string path_text, int language, int background, string id, int mode); |
| 39 | 39 | void serviceRECWithoutMixing(int service, string path_video, int background, string id, int mode); |
| 40 | +void serviceTest(int position, int size, int background); | |
| 40 | 41 | |
| 41 | 42 | void hasFailed(); |
| 42 | 43 | void hasInvalid(); |
| 43 | 44 | void fail(string msg); |
| 44 | -//void runTests(); | |
| 45 | 45 | void setPathContents(int mode, string id); |
| 46 | 46 | |
| 47 | 47 | bool isFailed; |
| ... | ... | @@ -73,6 +73,7 @@ int main(int argc, char* argv[]) { |
| 73 | 73 | try{ |
| 74 | 74 | parser->readArgs(argv, argc); |
| 75 | 75 | }catch(lavidlib::RuntimeException &ex){ |
| 76 | + PRINTL(util::_ERROR, "%s\n", ex.getMessage().c_str()); | |
| 76 | 77 | exit(1); |
| 77 | 78 | } |
| 78 | 79 | |
| ... | ... | @@ -83,7 +84,7 @@ int main(int argc, char* argv[]) { |
| 83 | 84 | |
| 84 | 85 | switch(service){ |
| 85 | 86 | case 1: |
| 86 | - printl(util::_INFO, "Service Type: Video with Subtitles\n"); | |
| 87 | + PRINTL(util::_INFO, "Service Type: Video with Subtitles\n"); | |
| 87 | 88 | input = parser->getInput(); |
| 88 | 89 | input_srt = parser->getInputSRT(); |
| 89 | 90 | language = parser->getLanguage(); |
| ... | ... | @@ -96,7 +97,7 @@ int main(int argc, char* argv[]) { |
| 96 | 97 | break; |
| 97 | 98 | |
| 98 | 99 | case 2: |
| 99 | - printl(util::_INFO, "Service Type: Video Recognize\n"); | |
| 100 | + PRINTL(util::_INFO, "Service Type: Video Recognize\n"); | |
| 100 | 101 | input = parser->getInput(); |
| 101 | 102 | position = parser->getPosition(); |
| 102 | 103 | size = parser->getSize(); |
| ... | ... | @@ -107,7 +108,7 @@ int main(int argc, char* argv[]) { |
| 107 | 108 | break; |
| 108 | 109 | |
| 109 | 110 | case 3: |
| 110 | - printl(util::_INFO, "Service Type: Text\n"); | |
| 111 | + PRINTL(util::_INFO, "Service Type: Text\n"); | |
| 111 | 112 | input = parser->getInput(); |
| 112 | 113 | language = parser->getLanguage(); |
| 113 | 114 | background = parser->getBackground(); |
| ... | ... | @@ -117,7 +118,7 @@ int main(int argc, char* argv[]) { |
| 117 | 118 | break; |
| 118 | 119 | |
| 119 | 120 | case 4: |
| 120 | - printl(util::_INFO, "Service Type: Subtitles only\n"); | |
| 121 | + PRINTL(util::_INFO, "Service Type: Subtitles only\n"); | |
| 121 | 122 | input = parser->getInput(); |
| 122 | 123 | language = parser->getLanguage(); |
| 123 | 124 | background = parser->getBackground(); |
| ... | ... | @@ -127,7 +128,7 @@ int main(int argc, char* argv[]) { |
| 127 | 128 | break; |
| 128 | 129 | |
| 129 | 130 | case 5: //reconhecimento de audio |
| 130 | - printl(util::_INFO, "Service Type: Audio Recognize\n"); | |
| 131 | + PRINTL(util::_INFO, "Service Type: Audio Recognize\n"); | |
| 131 | 132 | input = parser->getInput(); |
| 132 | 133 | background = parser->getBackground(); |
| 133 | 134 | id = parser->getId(); |
| ... | ... | @@ -136,7 +137,7 @@ int main(int argc, char* argv[]) { |
| 136 | 137 | break; |
| 137 | 138 | |
| 138 | 139 | case 6: //Reconhecimento de video sem mixagem |
| 139 | - printl(util::_INFO, "Service Type: Video Recognize (Mixer Disabled)\n"); | |
| 140 | + PRINTL(util::_INFO, "Service Type: Video Recognize (Mixer Disabled)\n"); | |
| 140 | 141 | input = parser->getInput(); |
| 141 | 142 | background = parser->getBackground(); |
| 142 | 143 | id = parser->getId(); |
| ... | ... | @@ -145,11 +146,14 @@ int main(int argc, char* argv[]) { |
| 145 | 146 | break; |
| 146 | 147 | |
| 147 | 148 | case 7: |
| 148 | - cout << "Serviço sendo implementado!" << endl; | |
| 149 | + position = parser->getPosition(); | |
| 150 | + size = parser->getSize(); | |
| 151 | + background = parser->getBackground(); | |
| 152 | + serviceTest(position, size, background); | |
| 149 | 153 | break; |
| 150 | 154 | |
| 151 | 155 | default: |
| 152 | - printf("Opção de serviço não reconhecida!\n"); | |
| 156 | + PRINTL(util::_INFO, "Opção de serviço não reconhecida!\n"); | |
| 153 | 157 | hasInvalid(); |
| 154 | 158 | } |
| 155 | 159 | |
| ... | ... | @@ -160,8 +164,8 @@ int main(int argc, char* argv[]) { |
| 160 | 164 | |
| 161 | 165 | gettimeofday(&tv2, NULL); |
| 162 | 166 | t2 = (double)(tv2.tv_sec) + (double)(tv2.tv_usec)/ 1000000.00; |
| 163 | - printl(util::_DEBUG, "Time: %lf\n", (t2-t1)); | |
| 164 | - printl(util::_INFO, "VLibras finalized!\n\n"); | |
| 167 | + PRINTL(util::_DEBUG, "Time: %lf\n", (t2-t1)); | |
| 168 | + PRINTL(util::_INFO, "VLibras finalized!\n\n"); | |
| 165 | 169 | exit(0); |
| 166 | 170 | } |
| 167 | 171 | |
| ... | ... | @@ -281,9 +285,26 @@ void serviceOnlySRT(int service, string path_srt, int language, int background, |
| 281 | 285 | delete service_srt; |
| 282 | 286 | } |
| 283 | 287 | |
| 288 | +void serviceTest(int position, int size, int background) { | |
| 289 | + ServiceTester* service_t; | |
| 290 | + service_t = new ServiceTester(position, size, background); | |
| 291 | + try{ | |
| 292 | + service_t->Start(); | |
| 293 | + }catch(ServiceException &ex){ | |
| 294 | + fail(ex.getMessage()); | |
| 295 | + hasFailed(); | |
| 296 | + return; | |
| 297 | + } | |
| 298 | + | |
| 299 | + while (!service_t->isFinished()) { | |
| 300 | + sleep(5); | |
| 301 | + } | |
| 302 | + delete service_t; | |
| 303 | +} | |
| 304 | + | |
| 284 | 305 | void fail(string msg){ |
| 285 | - printl(util::_ERROR, "\nOps... Tivemos um problema! :(\n"); | |
| 286 | - printl(util::_ERROR, "Possível causa do erro: %s\n\n", msg.c_str()); | |
| 306 | + PRINTL(util::_ERROR, "\nOps... Tivemos um problema! :(\n"); | |
| 307 | + PRINTL(util::_ERROR, "Possível causa do erro: %s\n\n", msg.c_str()); | |
| 287 | 308 | } |
| 288 | 309 | |
| 289 | 310 | void hasFailed(){ | ... | ... |
mixer/src/Mixer.cpp
| ... | ... | @@ -9,16 +9,16 @@ |
| 9 | 9 | /* Construtores e destrutores...*/ |
| 10 | 10 | Mixer::Mixer() { |
| 11 | 11 | this->setNumThreads("1"); |
| 12 | - printl(util::_DEBUG, "Done!\n"); | |
| 12 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 13 | 13 | } |
| 14 | 14 | Mixer::Mixer(string mainVideo, string secondaryVideo) { |
| 15 | 15 | this->setMainVideo(mainVideo); |
| 16 | 16 | this->setSecondaryVideo(secondaryVideo); |
| 17 | 17 | this->setNumThreads("1"); |
| 18 | - printl(util::_DEBUG, "Done!\n"); | |
| 18 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 19 | 19 | } |
| 20 | 20 | Mixer::~Mixer() { |
| 21 | - printl(util::_DEBUG, "Mixer finalized!\n"); | |
| 21 | + PRINTL(util::_DEBUG, "Mixer finalized!\n"); | |
| 22 | 22 | } |
| 23 | 23 | /* FIM de Construtores e destrutores...*/ |
| 24 | 24 | |
| ... | ... | @@ -27,7 +27,7 @@ Mixer::~Mixer() { |
| 27 | 27 | void Mixer::initialize(string mainVideo, string slVideo, int positionSecondaryVideo, int sizeSecondaryVideo, |
| 28 | 28 | int transparency, char* _id, char* path_uploads, char* path_contents){ |
| 29 | 29 | |
| 30 | - printl(util::_INFO, "Mixando...\n"); | |
| 30 | + PRINTL(util::_INFO, "Mixando...\n"); | |
| 31 | 31 | uploads = path_uploads; |
| 32 | 32 | contents = path_contents; |
| 33 | 33 | stringstream ss; | ... | ... |
recognize/src/recognize.cpp
| ... | ... | @@ -11,7 +11,7 @@ Recognize::Recognize(char* _pathVideo, char* _id) { |
| 11 | 11 | ss << _id; |
| 12 | 12 | ss >> id; |
| 13 | 13 | confidenceRate=CONFIDENCE_RATE; |
| 14 | - printl(util::_DEBUG, "Done!\n"); | |
| 14 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | Recognize::Recognize(char* _pathVideo, char* _id, char* rate) { |
| ... | ... | @@ -27,7 +27,7 @@ Recognize::Recognize(char* _pathVideo, char* _id, char* rate) { |
| 27 | 27 | istringstream(rate) >> confidenceRate; |
| 28 | 28 | if (confidenceRate == 0) |
| 29 | 29 | confidenceRate=CONFIDENCE_RATE; |
| 30 | - printl(util::_DEBUG, "Done!\n"); | |
| 30 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | Recognize::Recognize(char* _pathVideo, int _inputType, char* _id) { |
| ... | ... | @@ -38,19 +38,19 @@ Recognize::Recognize(char* _pathVideo, int _inputType, char* _id) { |
| 38 | 38 | frequency = FREQUENCY_PATTERN; |
| 39 | 39 | sizeBlocs = BLOCS_PATTERN; |
| 40 | 40 | id = _id; |
| 41 | - printl(util::_DEBUG, "Done!\n"); | |
| 41 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | Recognize::~Recognize() { |
| 45 | 45 | listeners->clear(); |
| 46 | 46 | delete listeners; |
| 47 | - printl(util::_DEBUG, "Recognize finalized!\n"); | |
| 47 | + PRINTL(util::_DEBUG, "Recognize finalized!\n"); | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | void Recognize::initialize() { |
| 52 | 52 | |
| 53 | - printl(util::_INFO, "Reconhecendo áudio...\n"); | |
| 53 | + PRINTL(util::_INFO, "Reconhecendo áudio...\n"); | |
| 54 | 54 | /**printf("*** Initialized Recognition ***\n\nVideo: %s\nType [1-File; 2-Mic]: %d\nFrequency: %d\n\n", |
| 55 | 55 | this->pathVideo, this->inputType, this->frequency);**/ |
| 56 | 56 | |
| ... | ... | @@ -378,7 +378,7 @@ void Recognize::notifyListeners(char* text, int64_t pts) { |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | void Recognize::notifyEndExtraction(int sentences_size) { |
| 381 | - printl(util::_DEBUG, "Recognizer concluiu o reconhecimento: %d sentenças.\n", sentences_size); | |
| 381 | + PRINTL(util::_DEBUG, "Recognizer concluiu o reconhecimento: %d sentenças.\n", sentences_size); | |
| 382 | 382 | for(list<RecognizeListener*>::iterator it = listeners->begin(); it != listeners->end(); it++){ |
| 383 | 383 | (*it)->notifyEnd(sentences_size); |
| 384 | 384 | } | ... | ... |
renderer/src/renderer.cpp
| ... | ... | @@ -9,14 +9,14 @@ Renderer::Renderer(char* videoPath, char* user_id) { |
| 9 | 9 | core_socket = new StreamSocket(); |
| 10 | 10 | listeners = new list<ListenerRenderer*>(); |
| 11 | 11 | serverInitialize(); |
| 12 | - printl(util::_DEBUG, "Done!\n"); | |
| 12 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | Renderer::~Renderer() { |
| 16 | 16 | listeners->clear(); |
| 17 | 17 | delete listeners; |
| 18 | 18 | if(core_socket) delete core_socket; |
| 19 | - printl(util::_DEBUG, "Renderer finalized!\n"); | |
| 19 | + PRINTL(util::_DEBUG, "Renderer finalized!\n"); | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | void Renderer::serverInitialize(){ |
| ... | ... | @@ -90,7 +90,7 @@ void Renderer::connectToUnity() { |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | void Renderer::waitScreenShots() { |
| 93 | - printl(util::_INFO, "Gerando vídeo...\n"); | |
| 93 | + PRINTL(util::_INFO, "Gerando vídeo...\n"); | |
| 94 | 94 | char* endgeneration = new char[strlen(END_FLAG)+1]; |
| 95 | 95 | int connected; |
| 96 | 96 | try{ |
| ... | ... | @@ -141,7 +141,7 @@ void Renderer::Run() { |
| 141 | 141 | render(); |
| 142 | 142 | cleanFiles(); |
| 143 | 143 | }catch(lavidlib::RuntimeException &ex){ |
| 144 | - printl(util::_ERROR, "%s\n", ex.getMessage().c_str()); | |
| 144 | + PRINTL(util::_ERROR, "%s\n", ex.getMessage().c_str()); | |
| 145 | 145 | Logging::instance()->writeLog("renderer.cpp <Error>: Falha na comunicação com o Unity player"); |
| 146 | 146 | throw RuntimeException(ex.getMessage().c_str()); |
| 147 | 147 | } | ... | ... |
servico/src/include/serviceTester.h
| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | #define SERVICETESTER_H |
| 3 | 3 | |
| 4 | 4 | #include <iostream> |
| 5 | -#include <json/json.h> | |
| 6 | 5 | #include <lavidlib/io/File.h> |
| 7 | 6 | #include <lavidlib/io/FileIO.h> |
| 8 | 7 | #include "serviceException.h" |
| ... | ... | @@ -10,30 +9,28 @@ |
| 10 | 9 | #include "serviceWindowGenerationFromSRT.h" |
| 11 | 10 | #include "serviceWindowGenerationFromText.h" |
| 12 | 11 | |
| 13 | -// path dos arquivos de teste | |
| 14 | -#define PATH_VID "/home/user/.vlibras-config/test/uploads/test_video.mp4" | |
| 15 | -#define PATH_SRT "/home/user/.vlibras-config/test/uploads/test_srt.srt" | |
| 16 | -#define PATH_TXT "/home/user/.vlibras-config/test/uploads/test_text.txt" | |
| 17 | -#define OUTPUT_FILE "/home/user/.vlibras-config/test/videos/Test.mp4" | |
| 18 | -#define TESTER_ID "Test" | |
| 19 | 12 | #define MODE_TEST 3 |
| 13 | +#define TESTER_ID "Test" | |
| 14 | +#define PATH_TEST_CONTENTS "vlibras_user/.vlibras-config/test/videos" | |
| 15 | +#define PATH_TEST_UPLOADS "vlibras_user/.vlibras-config/test/uploads" | |
| 20 | 16 | |
| 17 | +#define VID_FILE "vlibras_user/.vlibras-config/test/uploads/test_video.mp4" | |
| 18 | +#define SRT_FILE "vlibras_user/.vlibras-config/test/uploads/test_srt.srt" | |
| 19 | +#define REC_FILE "vlibras_user/.vlibras-config/test/uploads/test_rec.mov" | |
| 20 | +#define TXT_FILE "vlibras_user/.vlibras-config/test/uploads/test_text.txt" | |
| 21 | +#define OUT_FILE "vlibras_user/.vlibras-config/test/videos/Test.mp4" | |
| 22 | + | |
| 23 | +using namespace util; | |
| 21 | 24 | using namespace std; |
| 22 | 25 | |
| 23 | 26 | class ServiceTester: public Thread { |
| 24 | 27 | |
| 25 | 28 | public: |
| 26 | - ServiceTester(); | |
| 29 | + ServiceTester(int position, int size, int background); | |
| 27 | 30 | ~ServiceTester(); |
| 28 | - | |
| 29 | 31 | bool isFinished(); |
| 30 | 32 | |
| 31 | - int checkServiceSRT(); | |
| 32 | - int checkServiceText(); | |
| 33 | - int checkServiceRec(); | |
| 34 | 33 | private: |
| 35 | - | |
| 36 | - int language; | |
| 37 | 34 | int position; |
| 38 | 35 | int resolution; |
| 39 | 36 | int background; |
| ... | ... | @@ -51,14 +48,15 @@ private: |
| 51 | 48 | ServiceWindowGenerationFromSRT* service_srt; |
| 52 | 49 | ServiceWindowGenerationFromText* service_text; |
| 53 | 50 | |
| 54 | - void serviceSRT(int service, string path_video, string path_srt, int language, int position, int size, int background, string id, int mode); | |
| 55 | - void serviceREC(int service, string path_video, int position, int size, int background, string id, int mode); | |
| 56 | - void serviceText(string path_text, int language, int background, string id, int mode); | |
| 51 | + void checkServiceSRT(); | |
| 52 | + void checkServiceRec(); | |
| 53 | + void checkServiceText(); | |
| 57 | 54 | |
| 58 | 55 | void Run(); |
| 59 | - bool checkFiles(string fileIn, string fileOut); | |
| 60 | - void hasFailed(string msgerr); | |
| 56 | + bool hasFailed(); | |
| 61 | 57 | void deleteFiles(); |
| 58 | + void setPathContents(); | |
| 59 | + bool checkFiles(string fileIn, string fileOut); | |
| 62 | 60 | }; |
| 63 | 61 | |
| 64 | 62 | #endif /* SERVICETESTER_H */ |
| 65 | 63 | \ No newline at end of file | ... | ... |
servico/src/include/serviceWindowGeneration.h
| ... | ... | @@ -23,8 +23,8 @@ |
| 23 | 23 | #define TESTER 3 |
| 24 | 24 | #define PATH_DEVEL_CONTENTS "vlibras_user/vlibras-contents/videos" |
| 25 | 25 | #define PATH_DEVEL_UPLOADS "vlibras_user/vlibras-contents/uploads" |
| 26 | -#define PATH_TESTER_CONTENTS "vlibras_user/vlibras-config/test/videos" | |
| 27 | -#define PATH_TESTER_UPLOADS "vlibras_user/vlibras-config/test/uploads" | |
| 26 | +#define PATH_TESTER_CONTENTS "vlibras_user/.vlibras-config/test/videos" | |
| 27 | +#define PATH_TESTER_UPLOADS "vlibras_user/.vlibras-config/test/uploads" | |
| 28 | 28 | #define PATH_VBOX_UPLOADS "vlibras_user/.vlibras-config/uploads" |
| 29 | 29 | #define PATH_CONF_FILE "vlibras_user/.vlibras-config/params.json" |
| 30 | 30 | #define PATH_TESTER_FILE "/home/user/.vlibras-config/test/tester.json" | ... | ... |
servico/src/serviceTester.cpp
| 1 | 1 | #include "serviceTester.h" |
| 2 | 2 | |
| 3 | -ServiceTester::serviceTester(int _language, int _position, int _size, int _background) { | |
| 4 | - language = _language; | |
| 5 | - position = _position; | |
| 6 | - size = _size; | |
| 7 | - background = _background; | |
| 3 | +ServiceTester::ServiceTester(int _position, int _size, int _background) { | |
| 4 | + if(_position != 0) | |
| 5 | + this->position = _position; | |
| 6 | + else | |
| 7 | + this->position = 3; //bottom_rigth | |
| 8 | + | |
| 9 | + if(_size != 0) | |
| 10 | + this->resolution = _size; | |
| 11 | + else | |
| 12 | + this->resolution = 2; //medium | |
| 13 | + | |
| 14 | + this->background = _background; | |
| 8 | 15 | msgErr = ""; |
| 9 | 16 | finish = false; |
| 10 | 17 | fail = false; |
| 11 | - printl(util::_DEBUG, "Done!\n"); | |
| 18 | + setPathContents(); | |
| 19 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 12 | 20 | } |
| 13 | 21 | |
| 14 | -ServiceTester::~serviceTester() { | |
| 15 | - printl(util::_DEBUG, "ServiceTester Finalized!\n"); | |
| 22 | +ServiceTester::~ServiceTester() { | |
| 23 | + PRINTL(util::_DEBUG, "ServiceTester Finalized!\n"); | |
| 16 | 24 | } |
| 17 | 25 | |
| 18 | 26 | void ServiceTester::checkServiceSRT() { |
| 19 | - service_srt = new ServiceWindowGenerationFromSRT(PATH_VID, PATH_SRT, language, position, size, background, TESTER_ID, MODE_TEST, 1); | |
| 27 | + service_srt = new ServiceWindowGenerationFromSRT((char*)VID_FILE, (char*)SRT_FILE, 1, position, | |
| 28 | + resolution, background, (char*)TESTER_ID, MODE_TEST, 1); | |
| 20 | 29 | |
| 21 | 30 | try{ |
| 22 | 31 | service_srt->initialize(); |
| 23 | 32 | }catch(ServiceException &ex){ |
| 24 | 33 | msgErr += "Extração de legenda\n"; |
| 25 | - fail = true | |
| 34 | + fail = true; | |
| 26 | 35 | return; |
| 27 | 36 | } |
| 28 | 37 | |
| ... | ... | @@ -31,7 +40,7 @@ void ServiceTester::checkServiceSRT() { |
| 31 | 40 | delete service_srt; |
| 32 | 41 | |
| 33 | 42 | bool sucess; |
| 34 | - sucess = checkFiles(PATH_VID, FILE_OUT_SRT); | |
| 43 | + sucess = checkFiles(VID_FILE, OUT_FILE); | |
| 35 | 44 | if(!sucess){ |
| 36 | 45 | msgErr += "Extração de legenda\n"; |
| 37 | 46 | } |
| ... | ... | @@ -39,7 +48,8 @@ void ServiceTester::checkServiceSRT() { |
| 39 | 48 | } |
| 40 | 49 | |
| 41 | 50 | void ServiceTester::checkServiceRec() { |
| 42 | - service_rec = new ServiceWindowGenerationFromRec(PATH_VID, position, size, background, TESTER_ID, MODE_TEST, 2); | |
| 51 | + service_rec = new ServiceWindowGenerationFromRec((char*)REC_FILE, 0, 0, | |
| 52 | + background, (char*)TESTER_ID, MODE_TEST, 6);// 6 serviço sem mixagem | |
| 43 | 53 | |
| 44 | 54 | try{ |
| 45 | 55 | service_rec->initialize(); |
| ... | ... | @@ -48,25 +58,25 @@ void ServiceTester::checkServiceRec() { |
| 48 | 58 | fail = true; |
| 49 | 59 | return; |
| 50 | 60 | } |
| 51 | - | |
| 52 | 61 | while(!service_rec->isFinished()) |
| 53 | 62 | sleep(5); |
| 54 | 63 | delete service_rec; |
| 55 | 64 | |
| 56 | 65 | bool sucess; |
| 57 | - sucess = checkFiles(PATH_VID, FILE_OUT_REC); | |
| 66 | + sucess = checkFiles(REC_FILE, OUT_FILE); | |
| 58 | 67 | if(!sucess){ |
| 59 | 68 | msgErr += "Reconhecimento\n"; |
| 60 | 69 | } |
| 61 | 70 | deleteFiles(); |
| 62 | 71 | } |
| 63 | 72 | void ServiceTester::checkServiceText() { |
| 64 | - service_text = new ServiceWindowGenerationFromText(PATH_TXT, language, background, TESTER_ID, MODE_TEST); | |
| 73 | + service_text = new ServiceWindowGenerationFromText((char*)TXT_FILE, 1, background, | |
| 74 | + (char*)TESTER_ID, MODE_TEST); | |
| 65 | 75 | |
| 66 | 76 | try{ |
| 67 | 77 | service_text->initialize(); |
| 68 | 78 | }catch(ServiceException &ex){ |
| 69 | - msgErr += "Extração de texto\n" | |
| 79 | + msgErr += "Extração de texto\n"; | |
| 70 | 80 | fail = true; |
| 71 | 81 | return; |
| 72 | 82 | } |
| ... | ... | @@ -76,9 +86,9 @@ void ServiceTester::checkServiceText() { |
| 76 | 86 | delete service_text; |
| 77 | 87 | |
| 78 | 88 | bool sucess; |
| 79 | - sucess = checkFiles(PATH_TXT, FILE_OUT_TXT); | |
| 89 | + sucess = checkFiles(TXT_FILE, OUT_FILE); | |
| 80 | 90 | if(!sucess){ |
| 81 | - msgErr += "Extração de texto\n" | |
| 91 | + msgErr += "Extração de texto\n"; | |
| 82 | 92 | } |
| 83 | 93 | deleteFiles(); |
| 84 | 94 | } |
| ... | ... | @@ -118,24 +128,32 @@ bool ServiceTester::isFinished(){ |
| 118 | 128 | return this->finish; |
| 119 | 129 | } |
| 120 | 130 | |
| 121 | -void hasFailed() { | |
| 122 | - return fail; | |
| 131 | +bool ServiceTester::hasFailed() { | |
| 132 | + return this->fail; | |
| 133 | +} | |
| 134 | + | |
| 135 | +void ServiceTester::setPathContents() { | |
| 136 | + string command = "mkdir -p "; | |
| 137 | + command.append(PATH_TEST_CONTENTS).append(" && mkdir -p ") | |
| 138 | + .append(PATH_TEST_UPLOADS).append("/").append(TESTER_ID); | |
| 139 | + system(command.c_str()); | |
| 123 | 140 | } |
| 124 | 141 | |
| 125 | 142 | void ServiceTester::deleteFiles() { |
| 126 | 143 | string command = "rm -f "; |
| 127 | - command += OUTPUT_FILE; | |
| 128 | - system(command); | |
| 144 | + command.append(OUT_FILE); | |
| 145 | + system(command.c_str()); | |
| 129 | 146 | } |
| 130 | 147 | |
| 131 | 148 | void ServiceTester::Run() { |
| 132 | - printl(util::_INFO, "Verificando módulos, aguarde...\n"); | |
| 149 | + PRINTL(util::_INFO, "Verificando módulos, aguarde...\n"); | |
| 150 | + checkServiceText(); | |
| 133 | 151 | checkServiceSRT(); |
| 134 | 152 | checkServiceRec(); |
| 135 | - checkServiceText(); | |
| 136 | 153 | |
| 137 | 154 | if(hasFailed()) |
| 138 | 155 | throw ServiceException(msgErr); |
| 139 | 156 | |
| 157 | + PRINTL(util::_INFO, "Não foram encontrados problemas!\n"); | |
| 140 | 158 | finish = true; |
| 141 | 159 | } |
| 142 | 160 | \ No newline at end of file | ... | ... |
servico/src/serviceWindowGenerationFromRec.cpp
| ... | ... | @@ -17,7 +17,7 @@ ServiceWindowGenerationFromRec::ServiceWindowGenerationFromRec( |
| 17 | 17 | tradutor = new TradutorPortGlosa(); |
| 18 | 18 | running = true; |
| 19 | 19 | finish = false; |
| 20 | - printl(util::_DEBUG, "Done!\n"); | |
| 20 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | ServiceWindowGenerationFromRec::ServiceWindowGenerationFromRec( |
| ... | ... | @@ -42,7 +42,7 @@ ServiceWindowGenerationFromRec::ServiceWindowGenerationFromRec( |
| 42 | 42 | } |
| 43 | 43 | running = true; |
| 44 | 44 | finish = false; |
| 45 | - printl(util::_DEBUG, "Done!\n"); | |
| 45 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | ServiceWindowGenerationFromRec::~ServiceWindowGenerationFromRec(){ |
| ... | ... | @@ -51,7 +51,7 @@ ServiceWindowGenerationFromRec::~ServiceWindowGenerationFromRec(){ |
| 51 | 51 | if (renderer) delete renderer; |
| 52 | 52 | if (rec) delete rec; |
| 53 | 53 | if (mixer) delete mixer; |
| 54 | - printl(util::_DEBUG, "Service Rec finished!\n"); | |
| 54 | + PRINTL(util::_DEBUG, "Service Rec finished!\n"); | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | void ServiceWindowGenerationFromRec::setPathContents(){ |
| ... | ... | @@ -87,6 +87,7 @@ void ServiceWindowGenerationFromRec::setPathContents(){ |
| 87 | 87 | { |
| 88 | 88 | this->path_contents = (char*) PATH_TESTER_CONTENTS; |
| 89 | 89 | this->path_uploads = (char*) PATH_TESTER_UPLOADS; |
| 90 | + rec->setPathAudioContents(path_uploads); | |
| 90 | 91 | }break; |
| 91 | 92 | |
| 92 | 93 | default: |
| ... | ... | @@ -155,7 +156,7 @@ void ServiceWindowGenerationFromRec::notifyEndOfRenderization() { |
| 155 | 156 | } |
| 156 | 157 | |
| 157 | 158 | void ServiceWindowGenerationFromRec::notifyEnd(int sentences_size){ |
| 158 | - printl(util::_DEBUG, "Service REC recebeu: %d sentenças.\n", sentences_size); | |
| 159 | + PRINTL(util::_DEBUG, "Service REC recebeu: %d sentenças.\n", sentences_size); | |
| 159 | 160 | setSizeOfSubtitles(sentences_size); |
| 160 | 161 | } |
| 161 | 162 | |
| ... | ... | @@ -168,7 +169,7 @@ bool ServiceWindowGenerationFromRec::isFinished(){ |
| 168 | 169 | } |
| 169 | 170 | |
| 170 | 171 | void ServiceWindowGenerationFromRec::initialize(){ |
| 171 | - printl(util::_DEBUG, "Service REC Initialize.\n"); | |
| 172 | + PRINTL(util::_DEBUG, "Service REC Initialize.\n"); | |
| 172 | 173 | setPathLibras(); |
| 173 | 174 | rec->addListener(this); |
| 174 | 175 | tradutor->addListener(this); | ... | ... |
servico/src/serviceWindowGenerationFromSRT.cpp
| ... | ... | @@ -23,7 +23,7 @@ ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* pathVideo, |
| 23 | 23 | } |
| 24 | 24 | running = true; |
| 25 | 25 | finish = false; |
| 26 | - printl(util::_DEBUG, "Done!\n"); | |
| 26 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* pathSRT, int sublanguage, int transp, char* id, int mode, int serviceType) { |
| ... | ... | @@ -44,7 +44,7 @@ ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* pathSRT, in |
| 44 | 44 | } |
| 45 | 45 | running = true; |
| 46 | 46 | finish = false; |
| 47 | - printl(util::_DEBUG, "Done!\n"); | |
| 47 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | ServiceWindowGenerationFromSRT::~ServiceWindowGenerationFromSRT() { |
| ... | ... | @@ -54,7 +54,7 @@ ServiceWindowGenerationFromSRT::~ServiceWindowGenerationFromSRT() { |
| 54 | 54 | if (renderer) delete renderer; |
| 55 | 55 | if (extratorSRT)delete extratorSRT; |
| 56 | 56 | if (extrator_factory) delete extrator_factory; |
| 57 | - printl(util::_DEBUG, "Service SRT finalized!\n"); | |
| 57 | + PRINTL(util::_DEBUG, "Service SRT finalized!\n"); | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | void ServiceWindowGenerationFromSRT::setPathContents() { |
| ... | ... | @@ -168,7 +168,7 @@ void ServiceWindowGenerationFromSRT::notifyEndOfRenderization() { |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | void ServiceWindowGenerationFromSRT::notifyEnd(int sub_size) { |
| 171 | - printl(util::_DEBUG, "Service SRT recebeu: %d legendas.\n", sub_size); | |
| 171 | + PRINTL(util::_DEBUG, "Service SRT recebeu: %d legendas.\n", sub_size); | |
| 172 | 172 | setSizeOfSubtitles(sub_size); |
| 173 | 173 | } |
| 174 | 174 | |
| ... | ... | @@ -181,7 +181,7 @@ bool ServiceWindowGenerationFromSRT::isFinished() { |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | void ServiceWindowGenerationFromSRT::initialize() { |
| 184 | - printl(util::_DEBUG, "Service SRT Initialize.\n"); | |
| 184 | + PRINTL(util::_DEBUG, "Service SRT Initialize.\n"); | |
| 185 | 185 | setPathLibras(); |
| 186 | 186 | extratorSRT = (ExtratorSRT*) extrator_factory->getExtrator(Extrator::SRT); |
| 187 | 187 | extratorSRT->addListener(this); | ... | ... |
servico/src/serviceWindowGenerationFromText.cpp
| ... | ... | @@ -18,7 +18,7 @@ ServiceWindowGenerationFromText::ServiceWindowGenerationFromText(char* pathFile, |
| 18 | 18 | } |
| 19 | 19 | running = true; |
| 20 | 20 | finish = false; |
| 21 | - printl(util::_DEBUG, "Done!\n"); | |
| 21 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | ServiceWindowGenerationFromText::~ServiceWindowGenerationFromText() { |
| ... | ... | @@ -26,7 +26,7 @@ ServiceWindowGenerationFromText::~ServiceWindowGenerationFromText() { |
| 26 | 26 | if (renderer) delete renderer; |
| 27 | 27 | if (extratorTXT)delete extratorTXT; |
| 28 | 28 | if (extrator_factory) delete extrator_factory; |
| 29 | - printl(util::_DEBUG, "Service Text finalized!\n"); | |
| 29 | + PRINTL(util::_DEBUG, "Service Text finalized!\n"); | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | void ServiceWindowGenerationFromText::setPathContents() { |
| ... | ... | @@ -117,7 +117,7 @@ void ServiceWindowGenerationFromText::notifyEndOfRenderization() { |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | void ServiceWindowGenerationFromText::notifyEnd(int line_size) { |
| 120 | - printl(util::_DEBUG, "Service Text recebeu: %d linhas.\n", line_size); | |
| 120 | + PRINTL(util::_DEBUG, "Service Text recebeu: %d linhas.\n", line_size); | |
| 121 | 121 | setSizeOfSubtitles(line_size); |
| 122 | 122 | } |
| 123 | 123 | |
| ... | ... | @@ -130,7 +130,7 @@ bool ServiceWindowGenerationFromText::isFinished() { |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | void ServiceWindowGenerationFromText::initialize() { |
| 133 | - printl(util::_DEBUG, "Service Text Initialize.\n"); | |
| 133 | + PRINTL(util::_DEBUG, "Service Text Initialize.\n"); | |
| 134 | 134 | setPathLibras(); |
| 135 | 135 | extratorTXT = (ExtratorTXT*) extrator_factory->getExtrator(Extrator::TXT); |
| 136 | 136 | extratorTXT->addListener(this); | ... | ... |
tradutor/src/pyTradutor.cpp
tradutor/src/tradutorPortGlosa.cpp
| ... | ... | @@ -21,7 +21,7 @@ namespace Tradutor { |
| 21 | 21 | // Inicia o mutex |
| 22 | 22 | mutex = (pthread_mutex_t *) malloc( sizeof(pthread_mutex_t) ); |
| 23 | 23 | pthread_mutex_init(mutex, NULL); |
| 24 | - printl(util::_DEBUG, "Done!\n"); | |
| 24 | + PRINTL(util::_DEBUG, "Done!\n"); | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| ... | ... | @@ -31,10 +31,10 @@ namespace Tradutor { |
| 31 | 31 | if (mutex) { |
| 32 | 32 | int ret = pthread_mutex_destroy(mutex); |
| 33 | 33 | if (ret) |
| 34 | - printl(util::_ERROR, "Erro, destruindo mutex.\n"); | |
| 34 | + PRINTL(util::_ERROR, "Erro, destruindo mutex.\n"); | |
| 35 | 35 | free(mutex); |
| 36 | 36 | } |
| 37 | - printl(util::_DEBUG, "Translator finalized!\n"); | |
| 37 | + PRINTL(util::_DEBUG, "Translator finalized!\n"); | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | void TradutorPortGlosa::addListener(ListenerTradutor* listener) { | ... | ... |
util/src/argParser.cpp
| ... | ... | @@ -32,16 +32,16 @@ void ArgParser::readArgs(char** argv, int argc) |
| 32 | 32 | switch (opt) |
| 33 | 33 | { |
| 34 | 34 | case 'A': |
| 35 | - if(argc <= 9) | |
| 36 | - returnErr("Insuficient arguments. Try again"); | |
| 35 | + if(argc < 9) | |
| 36 | + throw lavidlib::RuntimeException("Insuficient arguments. Try again"); | |
| 37 | 37 | |
| 38 | 38 | globalArgs.service = _REC_AUDIO; |
| 39 | 39 | globalArgs.input = optarg; |
| 40 | 40 | break; |
| 41 | 41 | |
| 42 | 42 | case 'S': |
| 43 | - if(argc <= 11 || (globalArgs.service == _REC_VIDEO && argc <= 17)) | |
| 44 | - returnErr("Insuficient arguments. Try again"); | |
| 43 | + if(argc < 11 || (globalArgs.service == _REC_VIDEO && argc < 17)) | |
| 44 | + throw lavidlib::RuntimeException("Insuficient arguments. Try again"); | |
| 45 | 45 | |
| 46 | 46 | if(globalArgs.service == _REC_VIDEO){ // ativa o serviço de vídeo e legendas |
| 47 | 47 | globalArgs.service = _VIDEO_WITH_SRT; |
| ... | ... | @@ -53,16 +53,16 @@ void ArgParser::readArgs(char** argv, int argc) |
| 53 | 53 | break; |
| 54 | 54 | |
| 55 | 55 | case 'T': |
| 56 | - if(argc <= 9) | |
| 57 | - returnErr("Insuficient arguments. Try again"); | |
| 56 | + if(argc < 11) | |
| 57 | + throw lavidlib::RuntimeException("Insuficient arguments. Try again"); | |
| 58 | 58 | |
| 59 | 59 | globalArgs.service = _TEXT; |
| 60 | 60 | globalArgs.input = optarg; |
| 61 | 61 | break; |
| 62 | 62 | |
| 63 | 63 | case 'V': |
| 64 | - if(argc <= 13 || ((globalArgs.service == _ONLY_SRT && argc <= 17))) | |
| 65 | - returnErr("Insuficient arguments. Try again"); | |
| 64 | + if(argc < 13 || ((globalArgs.service == _ONLY_SRT && argc < 17))) | |
| 65 | + throw lavidlib::RuntimeException("Insuficient arguments. Try again"); | |
| 66 | 66 | |
| 67 | 67 | if(globalArgs.service == _ONLY_SRT){ // ativa o serviço de vídeo e legendas |
| 68 | 68 | globalArgs.service = _VIDEO_WITH_SRT; |
| ... | ... | @@ -164,12 +164,6 @@ void ArgParser::help() |
| 164 | 164 | throw lavidlib::RuntimeException(); //para nao iniciar o vlibras |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | -void ArgParser::returnErr(const string& option) | |
| 168 | -{ | |
| 169 | - cout << "Option '" << option << "' contains an invalid argument." << endl; | |
| 170 | - throw lavidlib::RuntimeException(); | |
| 171 | -} | |
| 172 | - | |
| 173 | 167 | util::logLevel ArgParser::logFromString(const string& level) |
| 174 | 168 | { |
| 175 | 169 | if(level == "quiet") |
| ... | ... | @@ -242,6 +236,12 @@ ArgParser::Mode ArgParser::executionModeFromString(const string& mode) |
| 242 | 236 | returnErr("--mode"); |
| 243 | 237 | } |
| 244 | 238 | |
| 239 | +void ArgParser::returnErr(const string& option) | |
| 240 | +{ | |
| 241 | + cout << "Option '" << option << "' contains an invalid argument." << endl; | |
| 242 | + throw lavidlib::RuntimeException(); | |
| 243 | +} | |
| 244 | + | |
| 245 | 245 | int ArgParser::getService() |
| 246 | 246 | { |
| 247 | 247 | return globalArgs.service; | ... | ... |
util/src/include/argParser.h
util/src/include/logging.h
| ... | ... | @@ -3,7 +3,6 @@ |
| 3 | 3 | |
| 4 | 4 | #include <stdio.h> |
| 5 | 5 | #include <stdlib.h> |
| 6 | -#include <stdarg.h> | |
| 7 | 6 | #include <time.h> |
| 8 | 7 | |
| 9 | 8 | #define _ERROR_ "\033[31m" |
| ... | ... | @@ -11,6 +10,7 @@ |
| 11 | 10 | #define _WARN_ "\033[33m" |
| 12 | 11 | #define _INFO_ "\033[32m" |
| 13 | 12 | #define _END_ "\033[0m" |
| 13 | + | |
| 14 | 14 | #define LOG_FILE "vlibras_user/vlibras-core/log/log" |
| 15 | 15 | |
| 16 | 16 | namespace util { |
| ... | ... | @@ -36,7 +36,7 @@ namespace util { |
| 36 | 36 | char* getTime(); |
| 37 | 37 | }; |
| 38 | 38 | |
| 39 | - #define printl(level, format, ... ) { \ | |
| 39 | + #define PRINTL(level, format, ... ) { \ | |
| 40 | 40 | logLevel llevel; \ |
| 41 | 41 | llevel = Logging::instance()->getLevel(); \ |
| 42 | 42 | if(level <= llevel){ \ |
| ... | ... | @@ -55,7 +55,7 @@ namespace util { |
| 55 | 55 | break; \ |
| 56 | 56 | } \ |
| 57 | 57 | } \ |
| 58 | - }//fim da função printl | |
| 58 | + }//fim da função PRINTL | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | #endif /* LOGGING_H */ |
| 62 | 62 | \ No newline at end of file | ... | ... |