Commit 86eba8e599d8e44cd8bd853d9e73a3b57e7bd1a9
1 parent
126bc23b
Exists in
master
and in
1 other branch
Modificações para gerar o instalador
Showing
8 changed files
with
46 additions
and
16 deletions
Show diff stats
main.cpp
| @@ -18,6 +18,10 @@ | @@ -18,6 +18,10 @@ | ||
| 18 | #include <sys/time.h> | 18 | #include <sys/time.h> |
| 19 | #include <stdlib.h> | 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 | using namespace std; | 25 | using namespace std; |
| 22 | 26 | ||
| 23 | void serviceSRT(char* service, char* path_video, char* path_srt, char* sublanguage, char* position, char* size, char* transparency, char* id, char* client_type); | 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,6 +34,7 @@ void serviceText(char* service, char* path_text, char* transparency, char* id, c | ||
| 30 | 34 | ||
| 31 | void help(); | 35 | void help(); |
| 32 | void serviceHelp(int service); | 36 | void serviceHelp(int service); |
| 37 | +void setPathContents(char* client); | ||
| 33 | void fail(string msg); | 38 | void fail(string msg); |
| 34 | void hasFailed(); | 39 | void hasFailed(); |
| 35 | void hasInvalid(); | 40 | void hasInvalid(); |
| @@ -117,6 +122,8 @@ int main(int argc, char* argv[]) { | @@ -117,6 +122,8 @@ int main(int argc, char* argv[]) { | ||
| 117 | void serviceSRT(char* service, char* path_video, char* path_srt, char* sublanguage, char* position, | 122 | void serviceSRT(char* service, char* path_video, char* path_srt, char* sublanguage, char* position, |
| 118 | char* size, char* transparency, char* id, char* client_type){ | 123 | char* size, char* transparency, char* id, char* client_type){ |
| 119 | 124 | ||
| 125 | + setPathContents(client_type); | ||
| 126 | + | ||
| 120 | ServiceWindowGenerationFromSRT * service_srt; | 127 | ServiceWindowGenerationFromSRT * service_srt; |
| 121 | service_srt = new ServiceWindowGenerationFromSRT(path_video, path_srt, (int) atoi(sublanguage), | 128 | service_srt = new ServiceWindowGenerationFromSRT(path_video, path_srt, (int) atoi(sublanguage), |
| 122 | (int) atoi(position), (int) atoi(size), (int) atoi(transparency), id, client_type, (int) atoi(service)); | 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,6 +145,8 @@ void serviceSRT(char* service, char* path_video, char* path_srt, char* sublangua | ||
| 138 | void serviceREC(char* service, char* path_video, char* sublanguage, char* position, char* size, | 145 | void serviceREC(char* service, char* path_video, char* sublanguage, char* position, char* size, |
| 139 | char* transparency, char* id, char* client_type){ | 146 | char* transparency, char* id, char* client_type){ |
| 140 | 147 | ||
| 148 | + setPathContents(client_type); | ||
| 149 | + | ||
| 141 | ServiceWindowGenerationFromRec * service_rec; | 150 | ServiceWindowGenerationFromRec * service_rec; |
| 142 | service_rec = new ServiceWindowGenerationFromRec(path_video, (int) atoi(sublanguage), | 151 | service_rec = new ServiceWindowGenerationFromRec(path_video, (int) atoi(sublanguage), |
| 143 | (int) atoi(position), (int) atoi(size), (int) atoi(transparency), id, client_type, (int) atoi(service)); | 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,6 +166,8 @@ void serviceREC(char* service, char* path_video, char* sublanguage, char* positi | ||
| 157 | 166 | ||
| 158 | void serviceText(char* service, char* path_text, char* transparency, char* id, char* client_type){ | 167 | void serviceText(char* service, char* path_text, char* transparency, char* id, char* client_type){ |
| 159 | 168 | ||
| 169 | + setPathContents(client_type); | ||
| 170 | + | ||
| 160 | ServiceWindowGenerationFromText *service_text; | 171 | ServiceWindowGenerationFromText *service_text; |
| 161 | service_text = new ServiceWindowGenerationFromText(path_text, (int) atoi(transparency), id, client_type); | 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,6 +186,9 @@ void serviceText(char* service, char* path_text, char* transparency, char* id, c | ||
| 175 | } | 186 | } |
| 176 | 187 | ||
| 177 | void serviceOnlySRT(char* service, char* path_file, char* transparency, char* id, char* client_type){ | 188 | void serviceOnlySRT(char* service, char* path_file, char* transparency, char* id, char* client_type){ |
| 189 | + | ||
| 190 | + setPathContents(client_type); | ||
| 191 | + | ||
| 178 | ServiceWindowGenerationFromSRT * service_srt; | 192 | ServiceWindowGenerationFromSRT * service_srt; |
| 179 | service_srt = new ServiceWindowGenerationFromSRT(path_file, (int) atoi(transparency), id, client_type, (int) atoi(service)); | 193 | service_srt = new ServiceWindowGenerationFromSRT(path_file, (int) atoi(transparency), id, client_type, (int) atoi(service)); |
| 180 | try{ | 194 | try{ |
| @@ -194,6 +208,8 @@ void serviceOnlySRT(char* service, char* path_file, char* transparency, char* id | @@ -194,6 +208,8 @@ void serviceOnlySRT(char* service, char* path_file, char* transparency, char* id | ||
| 194 | 208 | ||
| 195 | void serviceOnlyAudio(char* service, char* path_audio, char* transparency, char* id, char* client_type){ | 209 | void serviceOnlyAudio(char* service, char* path_audio, char* transparency, char* id, char* client_type){ |
| 196 | 210 | ||
| 211 | + setPathContents(client_type); | ||
| 212 | + | ||
| 197 | ServiceWindowGenerationFromRec * service_rec; | 213 | ServiceWindowGenerationFromRec * service_rec; |
| 198 | service_rec = new ServiceWindowGenerationFromRec(path_audio, 0, 0, 0, (int) atoi(transparency), id, client_type, (int) atoi(service)); | 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,6 +289,19 @@ void hasInvalid(){ | ||
| 273 | isInvalid = true; | 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 | void serviceHelp(int service){ | 305 | void serviceHelp(int service){ |
| 277 | cout << "\nParâmetros inválidos! Tente novamente.\n"; | 306 | cout << "\nParâmetros inválidos! Tente novamente.\n"; |
| 278 | switch(service){ | 307 | switch(service){ |
mixer/src/Mixer.cpp
| @@ -151,7 +151,6 @@ void Mixer::setPathFinal(){ | @@ -151,7 +151,6 @@ void Mixer::setPathFinal(){ | ||
| 151 | ss << contents; | 151 | ss << contents; |
| 152 | ss >> pathFinal; | 152 | ss >> pathFinal; |
| 153 | pathFinal.append("/").append(user_id).append(".mp4"); | 153 | pathFinal.append("/").append(user_id).append(".mp4"); |
| 154 | - cout << "Path: " << pathFinal << endl; | ||
| 155 | } | 154 | } |
| 156 | 155 | ||
| 157 | /*Ajusta o FPS do vídeo principal para 45 se preciso...*/ | 156 | /*Ajusta o FPS do vídeo principal para 45 se preciso...*/ |
recognize/src/recognize.cpp
| @@ -292,7 +292,7 @@ void Recognize::generateConfidence() { | @@ -292,7 +292,7 @@ void Recognize::generateConfidence() { | ||
| 292 | scores.push_back(avgScores/sizeAvgScores); | 292 | scores.push_back(avgScores/sizeAvgScores); |
| 293 | 293 | ||
| 294 | }else if(pass==0){ | 294 | }else if(pass==0){ |
| 295 | - notifyListeners((char*) "SENTENCA_COM_BAIXA_QUALIDADE", 0); | 295 | + notifyListeners((char*) "SENTENCA COM BAIXA QUALIDADE", 0); |
| 296 | notifyEndExtraction(count_lines); | 296 | notifyEndExtraction(count_lines); |
| 297 | return; | 297 | return; |
| 298 | } | 298 | } |
| @@ -412,9 +412,9 @@ void Recognize::cleanFiles() { | @@ -412,9 +412,9 @@ void Recognize::cleanFiles() { | ||
| 412 | 412 | ||
| 413 | void Recognize::createDir(){ | 413 | void Recognize::createDir(){ |
| 414 | 414 | ||
| 415 | - string command = "mkdir "; | 415 | + string command = "mkdir -p "; |
| 416 | command.append(path_contents).append("/").append(id).append("/audio") | 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 | system(command.c_str()); | 419 | system(command.c_str()); |
| 420 | } | 420 | } |
renderer/src/renderer.cpp
| @@ -33,7 +33,7 @@ void Renderer::serverInitialize(){ | @@ -33,7 +33,7 @@ void Renderer::serverInitialize(){ | ||
| 33 | 33 | ||
| 34 | command.append(" && ").append(render); | 34 | command.append(" && ").append(render); |
| 35 | system(command.c_str()); | 35 | system(command.c_str()); |
| 36 | - sleep(5); | 36 | + sleep(1); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | void Renderer::receiveGlosa(std::string glosa, int64_t pts) { | 39 | void Renderer::receiveGlosa(std::string glosa, int64_t pts) { |
| @@ -137,8 +137,8 @@ void Renderer::Run() { | @@ -137,8 +137,8 @@ void Renderer::Run() { | ||
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | void Renderer::render() { | 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 | .append("-vcodec libx264 -pix_fmt yuv420p ").append(path_video); | 142 | .append("-vcodec libx264 -pix_fmt yuv420p ").append(path_video); |
| 143 | system(command.c_str()); | 143 | system(command.c_str()); |
| 144 | notifyListeners(); | 144 | notifyListeners(); |
servico/src/include/serviceWindowGeneration.h
| @@ -22,8 +22,8 @@ | @@ -22,8 +22,8 @@ | ||
| 22 | #define PRODUCTION "prod" | 22 | #define PRODUCTION "prod" |
| 23 | #define PATH_DEVEL_CONTENTS "vlibras_user/vlibras-contents/videos" | 23 | #define PATH_DEVEL_CONTENTS "vlibras_user/vlibras-contents/videos" |
| 24 | #define PATH_DEVEL_UPLOADS "vlibras_user/vlibras-contents/uploads" | 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 | #define MAX_SIZE_PATH 256 | 27 | #define MAX_SIZE_PATH 256 |
| 28 | 28 | ||
| 29 | using namespace Json; | 29 | using namespace Json; |
servico/src/serviceWindowGenerationFromRec.cpp
| @@ -67,7 +67,8 @@ void ServiceWindowGenerationFromRec::setPathContents(){ | @@ -67,7 +67,8 @@ void ServiceWindowGenerationFromRec::setPathContents(){ | ||
| 67 | conf_file.close(); | 67 | conf_file.close(); |
| 68 | throw ServiceException("Fail to parsing param.json"); | 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 | this->path_contents = new char[MAX_SIZE_PATH]; | 72 | this->path_contents = new char[MAX_SIZE_PATH]; |
| 72 | strcpy(this->path_contents, attr.c_str()); | 73 | strcpy(this->path_contents, attr.c_str()); |
| 73 | this->path_uploads = PATH_VBOX_UPLOADS; | 74 | this->path_uploads = PATH_VBOX_UPLOADS; |
| @@ -137,8 +138,7 @@ void ServiceWindowGenerationFromRec::notifyTranslation(vector<string> * glosas) | @@ -137,8 +138,7 @@ void ServiceWindowGenerationFromRec::notifyTranslation(vector<string> * glosas) | ||
| 137 | }catch(lavidlib::RuntimeException &ex){ | 138 | }catch(lavidlib::RuntimeException &ex){ |
| 138 | throw ServiceException(ex.getMessage().c_str()); | 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 | void ServiceWindowGenerationFromRec::notifyEndOfRenderization() { | 144 | void ServiceWindowGenerationFromRec::notifyEndOfRenderization() { |
servico/src/serviceWindowGenerationFromSRT.cpp
| @@ -69,8 +69,10 @@ void ServiceWindowGenerationFromSRT::setPathContents() { | @@ -69,8 +69,10 @@ void ServiceWindowGenerationFromSRT::setPathContents() { | ||
| 69 | conf_file.close(); | 69 | conf_file.close(); |
| 70 | throw ServiceException("Fail to parsing param.json"); | 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 | this->path_contents = new char[MAX_SIZE_PATH]; | 74 | this->path_contents = new char[MAX_SIZE_PATH]; |
| 75 | + | ||
| 74 | strcpy(this->path_contents, attr.c_str()); | 76 | strcpy(this->path_contents, attr.c_str()); |
| 75 | this->path_uploads = PATH_VBOX_UPLOADS; | 77 | this->path_uploads = PATH_VBOX_UPLOADS; |
| 76 | conf_file.close(); | 78 | conf_file.close(); |
| @@ -142,7 +144,6 @@ void ServiceWindowGenerationFromSRT::notifyTranslation(vector<string> * glosas) | @@ -142,7 +144,6 @@ void ServiceWindowGenerationFromSRT::notifyTranslation(vector<string> * glosas) | ||
| 142 | throw ServiceException(ex.getMessage().c_str()); | 144 | throw ServiceException(ex.getMessage().c_str()); |
| 143 | } | 145 | } |
| 144 | vetor_pts->erase(vetor_pts->begin()); | 146 | vetor_pts->erase(vetor_pts->begin()); |
| 145 | - legendas_enviadas++; | ||
| 146 | } | 147 | } |
| 147 | 148 | ||
| 148 | void ServiceWindowGenerationFromSRT::notifyEndOfRenderization() { | 149 | void ServiceWindowGenerationFromSRT::notifyEndOfRenderization() { |
servico/src/serviceWindowGenerationFromText.cpp
| @@ -39,7 +39,8 @@ void ServiceWindowGenerationFromText::setPathContents() { | @@ -39,7 +39,8 @@ void ServiceWindowGenerationFromText::setPathContents() { | ||
| 39 | if(!parsingSuccessful){ | 39 | if(!parsingSuccessful){ |
| 40 | throw new RuntimeException("Fail to parsing param.json"); | 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 | this->path_contents = new char[MAX_SIZE_PATH]; | 44 | this->path_contents = new char[MAX_SIZE_PATH]; |
| 44 | strcpy(this->path_contents, attr.c_str()); | 45 | strcpy(this->path_contents, attr.c_str()); |
| 45 | //this->path_uploads = PATH_VBOX_UPLOADS; | 46 | //this->path_uploads = PATH_VBOX_UPLOADS; |