diff --git a/extrator/src/extratorSRT.cpp b/extrator/src/extratorSRT.cpp index 265d649..f03b34a 100644 --- a/extrator/src/extratorSRT.cpp +++ b/extrator/src/extratorSRT.cpp @@ -11,7 +11,7 @@ ExtratorSRT::ExtratorSRT(){ ExtratorSRT::~ExtratorSRT(){ listeners->clear(); delete listeners; - if (bff_reader) delete bff_reader; + //if (bff_reader) delete bff_reader; if (file_io) delete file_io; DDDPRINTF("ExtratorSTR finalized!\n"); } @@ -79,13 +79,16 @@ void ExtratorSRT::Run(){ string sub_text = ""; while(hasNextSubtitle()){ - subtitle = next(); + try{ + subtitle = next(); + }catch(ExtratorException ex){ break; } sub_text = subtitle->getSubtitleText(); notifyListeners((unsigned char*)sub_text.c_str(), calcula_pts((double) subtitle->getTimeIn())); - //cout << " . "; sub_index++; free(subtitle); } + if(sub_index == 0) + notifyListeners((unsigned char*)"ARQUIVO_VAZIO", 0); printf("\n"); finish = true; notifyEndExtraction(sub_index); @@ -142,10 +145,8 @@ Subtitle* ExtratorSRT::next() { sub->setSubtitleText(text_sub); delete(bff_reader); return sub; - } - - + int64_t ExtratorSRT::str_to_time(string str_time) { int64_t ttime = 0; diff --git a/extrator/src/extratorTXT.cpp b/extrator/src/extratorTXT.cpp index a9c46cb..b8d1e6d 100644 --- a/extrator/src/extratorTXT.cpp +++ b/extrator/src/extratorTXT.cpp @@ -91,6 +91,8 @@ void ExtratorTXT::Run(){ line_index++; } }catch (EOFException &ex){ + if(line_index == 0) + notifyListeners((unsigned char*)"ARQUIVO_VAZIO"); hasNext = false; }catch (...){ Util::Logger::Instance()->writeLog((char*) "[ERRO: extratorTXT.cpp] Erro durante a leitura do arquivo de texto."); -- libgit2 0.21.2