Commit b5cf8f1c96d5d7db4f0701253b8b07c758008496

Authored by Wesnydy Ribeiro
1 parent 2ba84907
Exists in master and in 1 other branch devel

Adicionado melhorias no componente extrator

extrator/src/extratorSRT.cpp
... ... @@ -11,7 +11,7 @@ ExtratorSRT::ExtratorSRT(){
11 11 ExtratorSRT::~ExtratorSRT(){
12 12 listeners->clear();
13 13 delete listeners;
14   - if (bff_reader) delete bff_reader;
  14 + //if (bff_reader) delete bff_reader;
15 15 if (file_io) delete file_io;
16 16 DDDPRINTF("ExtratorSTR finalized!\n");
17 17 }
... ... @@ -79,13 +79,16 @@ void ExtratorSRT::Run(){
79 79 string sub_text = "";
80 80  
81 81 while(hasNextSubtitle()){
82   - subtitle = next();
  82 + try{
  83 + subtitle = next();
  84 + }catch(ExtratorException ex){ break; }
83 85 sub_text = subtitle->getSubtitleText();
84 86 notifyListeners((unsigned char*)sub_text.c_str(), calcula_pts((double) subtitle->getTimeIn()));
85   - //cout << " . ";
86 87 sub_index++;
87 88 free(subtitle);
88 89 }
  90 + if(sub_index == 0)
  91 + notifyListeners((unsigned char*)"ARQUIVO_VAZIO", 0);
89 92 printf("\n");
90 93 finish = true;
91 94 notifyEndExtraction(sub_index);
... ... @@ -142,10 +145,8 @@ Subtitle* ExtratorSRT::next() {
142 145 sub->setSubtitleText(text_sub);
143 146 delete(bff_reader);
144 147 return sub;
145   -
146 148 }
147   -
148   -
  149 +
149 150 int64_t ExtratorSRT::str_to_time(string str_time) {
150 151  
151 152 int64_t ttime = 0;
... ...
extrator/src/extratorTXT.cpp
... ... @@ -91,6 +91,8 @@ void ExtratorTXT::Run(){
91 91 line_index++;
92 92 }
93 93 }catch (EOFException &ex){
  94 + if(line_index == 0)
  95 + notifyListeners((unsigned char*)"ARQUIVO_VAZIO");
94 96 hasNext = false;
95 97 }catch (...){
96 98 Util::Logger::Instance()->writeLog((char*) "[ERRO: extratorTXT.cpp] Erro durante a leitura do arquivo de texto.");
... ...