Commit 2ba84907d4f3acc61f069fb17f89e91434bdc4ee
1 parent
a694fed4
Exists in
master
and in
1 other branch
Melhorias no componente extrator
Showing
5 changed files
with
28 additions
and
6 deletions
Show diff stats
extrator/src/extratorSRT.cpp
... | ... | @@ -51,9 +51,16 @@ void ExtratorSRT::notifyEndExtraction(int size) { |
51 | 51 | |
52 | 52 | void ExtratorSRT::setFilePath(char* path){ |
53 | 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 | 66 | bool ExtratorSRT::isFinished(){ |
... | ... | @@ -75,7 +82,7 @@ void ExtratorSRT::Run(){ |
75 | 82 | subtitle = next(); |
76 | 83 | sub_text = subtitle->getSubtitleText(); |
77 | 84 | notifyListeners((unsigned char*)sub_text.c_str(), calcula_pts((double) subtitle->getTimeIn())); |
78 | - cout << " . "; | |
85 | + //cout << " . "; | |
79 | 86 | sub_index++; |
80 | 87 | free(subtitle); |
81 | 88 | } | ... | ... |
extrator/src/extratorTXT.cpp
... | ... | @@ -57,7 +57,17 @@ void ExtratorTXT::notifyEndExtraction(int size) { |
57 | 57 | } |
58 | 58 | |
59 | 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 | 73 | bool ExtratorTXT::isFinished(){ |
... | ... | @@ -77,7 +87,7 @@ void ExtratorTXT::Run(){ |
77 | 87 | line = bff_reader->readLine(); |
78 | 88 | if (line.length() > 0){ |
79 | 89 | notifyListeners((unsigned char*) line.c_str()); |
80 | - cout << " . "; | |
90 | + //cout << " . "; | |
81 | 91 | line_index++; |
82 | 92 | } |
83 | 93 | }catch (EOFException &ex){ | ... | ... |
extrator/src/include/extratorSRT.h
extrator/src/include/extratorTXT.h
servico/src/serviceWindowGeneration.cpp
... | ... | @@ -200,6 +200,7 @@ void ServiceWindowGeneration::notifyTranslation(vector<string> * glosas) { |
200 | 200 | |
201 | 201 | void ServiceWindowGeneration::transcodeVideoToWebm() { |
202 | 202 | //printf("[INFO]: A transcodificação para .webm está ativada!\n"); |
203 | + DDDPRINTF("[AGUARDE] Transcodificando o vídeo de Libras...\n"); | |
203 | 204 | string command = "ffmpeg -i "; |
204 | 205 | command.append(path_libras) |
205 | 206 | .append(" -vcodec libvpx -acodec libvorbis ") |
... | ... | @@ -216,6 +217,7 @@ void ServiceWindowGeneration::transcodeVideoToMp4() { |
216 | 217 | transcodeVideoToWebm(); |
217 | 218 | else{ |
218 | 219 | //printf("[INFO]: A transcodificação para .mp4 está ativada!\n"); |
220 | + DDDPRINTF("[AGUARDE] Transcodificando o vídeo de Libras...\n"); | |
219 | 221 | string command = "ffmpeg -i "; |
220 | 222 | command.append(path_libras) |
221 | 223 | .append(" -qscale 0 -strict experimental -vcodec libx264 -preset fast -r 30 ") | ... | ... |