diff --git a/extrator/src/extratorSRT.cpp b/extrator/src/extratorSRT.cpp index d1b7177..265d649 100644 --- a/extrator/src/extratorSRT.cpp +++ b/extrator/src/extratorSRT.cpp @@ -51,9 +51,16 @@ void ExtratorSRT::notifyEndExtraction(int size) { void ExtratorSRT::setFilePath(char* path){ filePath = (char*) path; - string command = "perl -p -e \'s/\n/ /\' "; - command.append(filePath).append(" > /dev/null"); - system(command.c_str()); + string command1 = "perl -p -e 's/\r$//' < "; + command1.append(filePath).append(" > ").append(INPUT_SRT); + system(command1.c_str()); + + string command2 = "iconv -f"; + command2.append(" $(file --mime-encoding -b ") + .append(INPUT_SRT).append(")") + .append(" -t utf-8 ").append(INPUT_SRT).append(" > ").append(filePath) + .append(" && rm -f ").append(INPUT_SRT); + system(command2.c_str()); } bool ExtratorSRT::isFinished(){ @@ -75,7 +82,7 @@ void ExtratorSRT::Run(){ subtitle = next(); sub_text = subtitle->getSubtitleText(); notifyListeners((unsigned char*)sub_text.c_str(), calcula_pts((double) subtitle->getTimeIn())); - cout << " . "; + //cout << " . "; sub_index++; free(subtitle); } diff --git a/extrator/src/extratorTXT.cpp b/extrator/src/extratorTXT.cpp index 4170dfb..a9c46cb 100644 --- a/extrator/src/extratorTXT.cpp +++ b/extrator/src/extratorTXT.cpp @@ -57,7 +57,17 @@ void ExtratorTXT::notifyEndExtraction(int size) { } void ExtratorTXT::setFilePath(char* path){ - filePath = (char*) path; + filePath = (char*) path; + string command1 = "perl -p -e 's/\r$//' < "; + command1.append(filePath).append(" > ").append(INPUT_TXT); + system(command1.c_str()); + + string command2 = "iconv -f"; + command2.append(" $(file --mime-encoding -b ") + .append(INPUT_TXT).append(")") + .append(" -t utf-8 ").append(INPUT_TXT).append(" > ").append(filePath) + .append(" && rm -f ").append(INPUT_TXT); + system(command2.c_str()); } bool ExtratorTXT::isFinished(){ @@ -77,7 +87,7 @@ void ExtratorTXT::Run(){ line = bff_reader->readLine(); if (line.length() > 0){ notifyListeners((unsigned char*) line.c_str()); - cout << " . "; + //cout << " . "; line_index++; } }catch (EOFException &ex){ diff --git a/extrator/src/include/extratorSRT.h b/extrator/src/include/extratorSRT.h index 497417c..6f8a52f 100644 --- a/extrator/src/include/extratorSRT.h +++ b/extrator/src/include/extratorSRT.h @@ -22,6 +22,7 @@ #define SIZE_CSCAPE 1 #define TARGET_TIME "-->" +#define INPUT_SRT "vlibras_user/inputSRT.srt" //#define MAX_LINE 1024 using namespace jthread; diff --git a/extrator/src/include/extratorTXT.h b/extrator/src/include/extratorTXT.h index 2066967..51bf9e7 100644 --- a/extrator/src/include/extratorTXT.h +++ b/extrator/src/include/extratorTXT.h @@ -20,6 +20,8 @@ #include "listenerTXT.h" #include "extratorException.h" +#define INPUT_TXT "vlibras_user/inputTXT.txt" + using namespace jthread; using namespace std; diff --git a/servico/src/serviceWindowGeneration.cpp b/servico/src/serviceWindowGeneration.cpp index edae9c0..03896fd 100644 --- a/servico/src/serviceWindowGeneration.cpp +++ b/servico/src/serviceWindowGeneration.cpp @@ -200,6 +200,7 @@ void ServiceWindowGeneration::notifyTranslation(vector * glosas) { void ServiceWindowGeneration::transcodeVideoToWebm() { //printf("[INFO]: A transcodificação para .webm está ativada!\n"); + DDDPRINTF("[AGUARDE] Transcodificando o vídeo de Libras...\n"); string command = "ffmpeg -i "; command.append(path_libras) .append(" -vcodec libvpx -acodec libvorbis ") @@ -216,6 +217,7 @@ void ServiceWindowGeneration::transcodeVideoToMp4() { transcodeVideoToWebm(); else{ //printf("[INFO]: A transcodificação para .mp4 está ativada!\n"); + DDDPRINTF("[AGUARDE] Transcodificando o vídeo de Libras...\n"); string command = "ffmpeg -i "; command.append(path_libras) .append(" -qscale 0 -strict experimental -vcodec libx264 -preset fast -r 30 ") -- libgit2 0.21.2