Commit 86eba8e599d8e44cd8bd853d9e73a3b57e7bd1a9

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

Modificações para gerar o instalador

main.cpp
... ... @@ -18,6 +18,10 @@
18 18 #include <sys/time.h>
19 19 #include <stdlib.h>
20 20  
  21 +#define PATH_DEVEL_CONTENTS "vlibras_user/vlibras-contents/videos"
  22 +#define PATH_DEVEL_UPLOADS "vlibras_user/vlibras-contents/uploads"
  23 +#define PATH_VBOX_UPLOADS "vlibras_user/.vlibras-config/uploads"
  24 +
21 25 using namespace std;
22 26  
23 27 void serviceSRT(char* service, char* path_video, char* path_srt, char* sublanguage, char* position, char* size, char* transparency, char* id, char* client_type);
... ... @@ -30,6 +34,7 @@ void serviceText(char* service, char* path_text, char* transparency, char* id, c
30 34  
31 35 void help();
32 36 void serviceHelp(int service);
  37 +void setPathContents(char* client);
33 38 void fail(string msg);
34 39 void hasFailed();
35 40 void hasInvalid();
... ... @@ -117,6 +122,8 @@ int main(int argc, char* argv[]) {
117 122 void serviceSRT(char* service, char* path_video, char* path_srt, char* sublanguage, char* position,
118 123 char* size, char* transparency, char* id, char* client_type){
119 124  
  125 + setPathContents(client_type);
  126 +
120 127 ServiceWindowGenerationFromSRT * service_srt;
121 128 service_srt = new ServiceWindowGenerationFromSRT(path_video, path_srt, (int) atoi(sublanguage),
122 129 (int) atoi(position), (int) atoi(size), (int) atoi(transparency), id, client_type, (int) atoi(service));
... ... @@ -138,6 +145,8 @@ void serviceSRT(char* service, char* path_video, char* path_srt, char* sublangua
138 145 void serviceREC(char* service, char* path_video, char* sublanguage, char* position, char* size,
139 146 char* transparency, char* id, char* client_type){
140 147  
  148 + setPathContents(client_type);
  149 +
141 150 ServiceWindowGenerationFromRec * service_rec;
142 151 service_rec = new ServiceWindowGenerationFromRec(path_video, (int) atoi(sublanguage),
143 152 (int) atoi(position), (int) atoi(size), (int) atoi(transparency), id, client_type, (int) atoi(service));
... ... @@ -157,6 +166,8 @@ void serviceREC(char* service, char* path_video, char* sublanguage, char* positi
157 166  
158 167 void serviceText(char* service, char* path_text, char* transparency, char* id, char* client_type){
159 168  
  169 + setPathContents(client_type);
  170 +
160 171 ServiceWindowGenerationFromText *service_text;
161 172 service_text = new ServiceWindowGenerationFromText(path_text, (int) atoi(transparency), id, client_type);
162 173  
... ... @@ -175,6 +186,9 @@ void serviceText(char* service, char* path_text, char* transparency, char* id, c
175 186 }
176 187  
177 188 void serviceOnlySRT(char* service, char* path_file, char* transparency, char* id, char* client_type){
  189 +
  190 + setPathContents(client_type);
  191 +
178 192 ServiceWindowGenerationFromSRT * service_srt;
179 193 service_srt = new ServiceWindowGenerationFromSRT(path_file, (int) atoi(transparency), id, client_type, (int) atoi(service));
180 194 try{
... ... @@ -194,6 +208,8 @@ void serviceOnlySRT(char* service, char* path_file, char* transparency, char* id
194 208  
195 209 void serviceOnlyAudio(char* service, char* path_audio, char* transparency, char* id, char* client_type){
196 210  
  211 + setPathContents(client_type);
  212 +
197 213 ServiceWindowGenerationFromRec * service_rec;
198 214 service_rec = new ServiceWindowGenerationFromRec(path_audio, 0, 0, 0, (int) atoi(transparency), id, client_type, (int) atoi(service));
199 215  
... ... @@ -273,6 +289,19 @@ void hasInvalid(){
273 289 isInvalid = true;
274 290 }
275 291  
  292 +void setPathContents(char* client){
  293 + string command = "mkdir -p ";
  294 + if(strcmp(client, "devel") == 0)
  295 + command.append(PATH_DEVEL_CONTENTS).append(" && mkdir -p ").append(PATH_DEVEL_UPLOADS);
  296 + else if (strcmp(client, "prod") == 0)
  297 + command.append(PATH_VBOX_UPLOADS);
  298 + else {
  299 + fail("Cliente Inválido!");
  300 + exit(127);
  301 + }
  302 + system(command.c_str());
  303 +}
  304 +
276 305 void serviceHelp(int service){
277 306 cout << "\nParâmetros inválidos! Tente novamente.\n";
278 307 switch(service){
... ...
mixer/src/Mixer.cpp
... ... @@ -151,7 +151,6 @@ void Mixer::setPathFinal(){
151 151 ss << contents;
152 152 ss >> pathFinal;
153 153 pathFinal.append("/").append(user_id).append(".mp4");
154   - cout << "Path: " << pathFinal << endl;
155 154 }
156 155  
157 156 /*Ajusta o FPS do vídeo principal para 45 se preciso...*/
... ...
recognize/src/recognize.cpp
... ... @@ -292,7 +292,7 @@ void Recognize::generateConfidence() {
292 292 scores.push_back(avgScores/sizeAvgScores);
293 293  
294 294 }else if(pass==0){
295   - notifyListeners((char*) "SENTENCA_COM_BAIXA_QUALIDADE", 0);
  295 + notifyListeners((char*) "SENTENCA COM BAIXA QUALIDADE", 0);
296 296 notifyEndExtraction(count_lines);
297 297 return;
298 298 }
... ... @@ -412,9 +412,9 @@ void Recognize::cleanFiles() {
412 412  
413 413 void Recognize::createDir(){
414 414  
415   - string command = "mkdir ";
  415 + string command = "mkdir -p ";
416 416 command.append(path_contents).append("/").append(id).append("/audio")
417   - .append(" && mkdir ").append(path_contents).append("/").append(id).append("/audio/parts")
418   - .append(" && mkdir ").append(path_contents).append("/").append(id).append("/audio/origin");
  417 + .append(" && mkdir -p ").append(path_contents).append("/").append(id).append("/audio/parts")
  418 + .append(" && mkdir -p ").append(path_contents).append("/").append(id).append("/audio/origin");
419 419 system(command.c_str());
420 420 }
... ...
renderer/src/renderer.cpp
... ... @@ -33,7 +33,7 @@ void Renderer::serverInitialize(){
33 33  
34 34 command.append(" && ").append(render);
35 35 system(command.c_str());
36   - sleep(5);
  36 + sleep(1);
37 37 }
38 38  
39 39 void Renderer::receiveGlosa(std::string glosa, int64_t pts) {
... ... @@ -137,8 +137,8 @@ void Renderer::Run() {
137 137 }
138 138  
139 139 void Renderer::render() {
140   - string command = "avconv -loglevel quiet -framerate 30 -i ";
141   - command.append(PATH_SCREENS).append("[\'").append(folder_id).append("\']").append("/frame_%d.png ")
  140 + string command = "ffmpeg -loglevel quiet -framerate 30 -i ";
  141 + command.append(PATH_SCREENS).append(folder_id).append("/frame_%d.png ")
142 142 .append("-vcodec libx264 -pix_fmt yuv420p ").append(path_video);
143 143 system(command.c_str());
144 144 notifyListeners();
... ...
servico/src/include/serviceWindowGeneration.h
... ... @@ -22,8 +22,8 @@
22 22 #define PRODUCTION "prod"
23 23 #define PATH_DEVEL_CONTENTS "vlibras_user/vlibras-contents/videos"
24 24 #define PATH_DEVEL_UPLOADS "vlibras_user/vlibras-contents/uploads"
25   -#define PATH_VBOX_UPLOADS "vlibras_user/.vlibras-conf/uploads"
26   -#define PATH_CONF_FILE "vlibras_user/.vlibras-conf/params.json"
  25 +#define PATH_VBOX_UPLOADS "vlibras_user/.vlibras-config/uploads"
  26 +#define PATH_CONF_FILE "vlibras_user/.vlibras-config/params.json"
27 27 #define MAX_SIZE_PATH 256
28 28  
29 29 using namespace Json;
... ...
servico/src/serviceWindowGenerationFromRec.cpp
... ... @@ -67,7 +67,8 @@ void ServiceWindowGenerationFromRec::setPathContents(){
67 67 conf_file.close();
68 68 throw ServiceException("Fail to parsing param.json");
69 69 }
70   - string attr = root.get("storage", PATH_VBOX_UPLOADS).asString();
  70 + string attr = "vlibras_user/";
  71 + attr += root.get("storage", PATH_VBOX_UPLOADS).asString();
71 72 this->path_contents = new char[MAX_SIZE_PATH];
72 73 strcpy(this->path_contents, attr.c_str());
73 74 this->path_uploads = PATH_VBOX_UPLOADS;
... ... @@ -137,8 +138,7 @@ void ServiceWindowGenerationFromRec::notifyTranslation(vector&lt;string&gt; * glosas)
137 138 }catch(lavidlib::RuntimeException &ex){
138 139 throw ServiceException(ex.getMessage().c_str());
139 140 }
140   - vetor_pts->erase(vetor_pts->begin());
141   - legendas_enviadas++;
  141 + vetor_pts->erase(vetor_pts->begin());
142 142 }
143 143  
144 144 void ServiceWindowGenerationFromRec::notifyEndOfRenderization() {
... ...
servico/src/serviceWindowGenerationFromSRT.cpp
... ... @@ -69,8 +69,10 @@ void ServiceWindowGenerationFromSRT::setPathContents() {
69 69 conf_file.close();
70 70 throw ServiceException("Fail to parsing param.json");
71 71 }
72   - string attr = root.get("storage", PATH_VBOX_UPLOADS).asString();
  72 + string attr = "vlibras_user/";
  73 + attr += root.get("storage", PATH_VBOX_UPLOADS).asString();
73 74 this->path_contents = new char[MAX_SIZE_PATH];
  75 +
74 76 strcpy(this->path_contents, attr.c_str());
75 77 this->path_uploads = PATH_VBOX_UPLOADS;
76 78 conf_file.close();
... ... @@ -142,7 +144,6 @@ void ServiceWindowGenerationFromSRT::notifyTranslation(vector&lt;string&gt; * glosas)
142 144 throw ServiceException(ex.getMessage().c_str());
143 145 }
144 146 vetor_pts->erase(vetor_pts->begin());
145   - legendas_enviadas++;
146 147 }
147 148  
148 149 void ServiceWindowGenerationFromSRT::notifyEndOfRenderization() {
... ...
servico/src/serviceWindowGenerationFromText.cpp
... ... @@ -39,7 +39,8 @@ void ServiceWindowGenerationFromText::setPathContents() {
39 39 if(!parsingSuccessful){
40 40 throw new RuntimeException("Fail to parsing param.json");
41 41 }
42   - string attr = root.get("storage", PATH_VBOX_UPLOADS).asString();
  42 + string attr = "vlibras_user/";
  43 + attr += root.get("storage", PATH_VBOX_UPLOADS).asString();
43 44 this->path_contents = new char[MAX_SIZE_PATH];
44 45 strcpy(this->path_contents, attr.c_str());
45 46 //this->path_uploads = PATH_VBOX_UPLOADS;
... ...