Commit 2ba84907d4f3acc61f069fb17f89e91434bdc4ee

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

Melhorias no componente extrator

extrator/src/extratorSRT.cpp
@@ -51,9 +51,16 @@ void ExtratorSRT::notifyEndExtraction(int size) { @@ -51,9 +51,16 @@ void ExtratorSRT::notifyEndExtraction(int size) {
51 51
52 void ExtratorSRT::setFilePath(char* path){ 52 void ExtratorSRT::setFilePath(char* path){
53 filePath = (char*) path; 53 filePath = (char*) path;
54 - string command = "perl -p -e \'s/\n/ /\' ";  
55 - command.append(filePath).append(" > /dev/null");  
56 - system(command.c_str()); 54 + string command1 = "perl -p -e 's/\r$//' < ";
  55 + command1.append(filePath).append(" > ").append(INPUT_SRT);
  56 + system(command1.c_str());
  57 +
  58 + string command2 = "iconv -f";
  59 + command2.append(" $(file --mime-encoding -b ")
  60 + .append(INPUT_SRT).append(")")
  61 + .append(" -t utf-8 ").append(INPUT_SRT).append(" > ").append(filePath)
  62 + .append(" && rm -f ").append(INPUT_SRT);
  63 + system(command2.c_str());
57 } 64 }
58 65
59 bool ExtratorSRT::isFinished(){ 66 bool ExtratorSRT::isFinished(){
@@ -75,7 +82,7 @@ void ExtratorSRT::Run(){ @@ -75,7 +82,7 @@ void ExtratorSRT::Run(){
75 subtitle = next(); 82 subtitle = next();
76 sub_text = subtitle->getSubtitleText(); 83 sub_text = subtitle->getSubtitleText();
77 notifyListeners((unsigned char*)sub_text.c_str(), calcula_pts((double) subtitle->getTimeIn())); 84 notifyListeners((unsigned char*)sub_text.c_str(), calcula_pts((double) subtitle->getTimeIn()));
78 - cout << " . "; 85 + //cout << " . ";
79 sub_index++; 86 sub_index++;
80 free(subtitle); 87 free(subtitle);
81 } 88 }
extrator/src/extratorTXT.cpp
@@ -57,7 +57,17 @@ void ExtratorTXT::notifyEndExtraction(int size) { @@ -57,7 +57,17 @@ void ExtratorTXT::notifyEndExtraction(int size) {
57 } 57 }
58 58
59 void ExtratorTXT::setFilePath(char* path){ 59 void ExtratorTXT::setFilePath(char* path){
60 - filePath = (char*) path; 60 + filePath = (char*) path;
  61 + string command1 = "perl -p -e 's/\r$//' < ";
  62 + command1.append(filePath).append(" > ").append(INPUT_TXT);
  63 + system(command1.c_str());
  64 +
  65 + string command2 = "iconv -f";
  66 + command2.append(" $(file --mime-encoding -b ")
  67 + .append(INPUT_TXT).append(")")
  68 + .append(" -t utf-8 ").append(INPUT_TXT).append(" > ").append(filePath)
  69 + .append(" && rm -f ").append(INPUT_TXT);
  70 + system(command2.c_str());
61 } 71 }
62 72
63 bool ExtratorTXT::isFinished(){ 73 bool ExtratorTXT::isFinished(){
@@ -77,7 +87,7 @@ void ExtratorTXT::Run(){ @@ -77,7 +87,7 @@ void ExtratorTXT::Run(){
77 line = bff_reader->readLine(); 87 line = bff_reader->readLine();
78 if (line.length() > 0){ 88 if (line.length() > 0){
79 notifyListeners((unsigned char*) line.c_str()); 89 notifyListeners((unsigned char*) line.c_str());
80 - cout << " . "; 90 + //cout << " . ";
81 line_index++; 91 line_index++;
82 } 92 }
83 }catch (EOFException &ex){ 93 }catch (EOFException &ex){
extrator/src/include/extratorSRT.h
@@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
22 22
23 #define SIZE_CSCAPE 1 23 #define SIZE_CSCAPE 1
24 #define TARGET_TIME "-->" 24 #define TARGET_TIME "-->"
  25 +#define INPUT_SRT "vlibras_user/inputSRT.srt"
25 //#define MAX_LINE 1024 26 //#define MAX_LINE 1024
26 27
27 using namespace jthread; 28 using namespace jthread;
extrator/src/include/extratorTXT.h
@@ -20,6 +20,8 @@ @@ -20,6 +20,8 @@
20 #include "listenerTXT.h" 20 #include "listenerTXT.h"
21 #include "extratorException.h" 21 #include "extratorException.h"
22 22
  23 +#define INPUT_TXT "vlibras_user/inputTXT.txt"
  24 +
23 using namespace jthread; 25 using namespace jthread;
24 using namespace std; 26 using namespace std;
25 27
servico/src/serviceWindowGeneration.cpp
@@ -200,6 +200,7 @@ void ServiceWindowGeneration::notifyTranslation(vector&lt;string&gt; * glosas) { @@ -200,6 +200,7 @@ void ServiceWindowGeneration::notifyTranslation(vector&lt;string&gt; * glosas) {
200 200
201 void ServiceWindowGeneration::transcodeVideoToWebm() { 201 void ServiceWindowGeneration::transcodeVideoToWebm() {
202 //printf("[INFO]: A transcodificação para .webm está ativada!\n"); 202 //printf("[INFO]: A transcodificação para .webm está ativada!\n");
  203 + DDDPRINTF("[AGUARDE] Transcodificando o vídeo de Libras...\n");
203 string command = "ffmpeg -i "; 204 string command = "ffmpeg -i ";
204 command.append(path_libras) 205 command.append(path_libras)
205 .append(" -vcodec libvpx -acodec libvorbis ") 206 .append(" -vcodec libvpx -acodec libvorbis ")
@@ -216,6 +217,7 @@ void ServiceWindowGeneration::transcodeVideoToMp4() { @@ -216,6 +217,7 @@ void ServiceWindowGeneration::transcodeVideoToMp4() {
216 transcodeVideoToWebm(); 217 transcodeVideoToWebm();
217 else{ 218 else{
218 //printf("[INFO]: A transcodificação para .mp4 está ativada!\n"); 219 //printf("[INFO]: A transcodificação para .mp4 está ativada!\n");
  220 + DDDPRINTF("[AGUARDE] Transcodificando o vídeo de Libras...\n");
219 string command = "ffmpeg -i "; 221 string command = "ffmpeg -i ";
220 command.append(path_libras) 222 command.append(path_libras)
221 .append(" -qscale 0 -strict experimental -vcodec libx264 -preset fast -r 30 ") 223 .append(" -qscale 0 -strict experimental -vcodec libx264 -preset fast -r 30 ")