diff --git a/main.cpp b/main.cpp index 46e41b4..524b013 100644 --- a/main.cpp +++ b/main.cpp @@ -18,6 +18,10 @@ #include #include +#define PATH_DEVEL_CONTENTS "vlibras_user/vlibras-contents/videos" +#define PATH_DEVEL_UPLOADS "vlibras_user/vlibras-contents/uploads" +#define PATH_VBOX_UPLOADS "vlibras_user/.vlibras-config/uploads" + using namespace std; 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 void help(); void serviceHelp(int service); +void setPathContents(char* client); void fail(string msg); void hasFailed(); void hasInvalid(); @@ -117,6 +122,8 @@ int main(int argc, char* argv[]) { void serviceSRT(char* service, char* path_video, char* path_srt, char* sublanguage, char* position, char* size, char* transparency, char* id, char* client_type){ + setPathContents(client_type); + ServiceWindowGenerationFromSRT * service_srt; service_srt = new ServiceWindowGenerationFromSRT(path_video, path_srt, (int) atoi(sublanguage), (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 void serviceREC(char* service, char* path_video, char* sublanguage, char* position, char* size, char* transparency, char* id, char* client_type){ + setPathContents(client_type); + ServiceWindowGenerationFromRec * service_rec; service_rec = new ServiceWindowGenerationFromRec(path_video, (int) atoi(sublanguage), (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 void serviceText(char* service, char* path_text, char* transparency, char* id, char* client_type){ + setPathContents(client_type); + ServiceWindowGenerationFromText *service_text; service_text = new ServiceWindowGenerationFromText(path_text, (int) atoi(transparency), id, client_type); @@ -175,6 +186,9 @@ void serviceText(char* service, char* path_text, char* transparency, char* id, c } void serviceOnlySRT(char* service, char* path_file, char* transparency, char* id, char* client_type){ + + setPathContents(client_type); + ServiceWindowGenerationFromSRT * service_srt; service_srt = new ServiceWindowGenerationFromSRT(path_file, (int) atoi(transparency), id, client_type, (int) atoi(service)); try{ @@ -194,6 +208,8 @@ void serviceOnlySRT(char* service, char* path_file, char* transparency, char* id void serviceOnlyAudio(char* service, char* path_audio, char* transparency, char* id, char* client_type){ + setPathContents(client_type); + ServiceWindowGenerationFromRec * service_rec; service_rec = new ServiceWindowGenerationFromRec(path_audio, 0, 0, 0, (int) atoi(transparency), id, client_type, (int) atoi(service)); @@ -273,6 +289,19 @@ void hasInvalid(){ isInvalid = true; } +void setPathContents(char* client){ + string command = "mkdir -p "; + if(strcmp(client, "devel") == 0) + command.append(PATH_DEVEL_CONTENTS).append(" && mkdir -p ").append(PATH_DEVEL_UPLOADS); + else if (strcmp(client, "prod") == 0) + command.append(PATH_VBOX_UPLOADS); + else { + fail("Cliente Inválido!"); + exit(127); + } + system(command.c_str()); +} + void serviceHelp(int service){ cout << "\nParâmetros inválidos! Tente novamente.\n"; switch(service){ diff --git a/mixer/src/Mixer.cpp b/mixer/src/Mixer.cpp index 1ba1dbe..7929929 100644 --- a/mixer/src/Mixer.cpp +++ b/mixer/src/Mixer.cpp @@ -151,7 +151,6 @@ void Mixer::setPathFinal(){ ss << contents; ss >> pathFinal; pathFinal.append("/").append(user_id).append(".mp4"); - cout << "Path: " << pathFinal << endl; } /*Ajusta o FPS do vídeo principal para 45 se preciso...*/ diff --git a/recognize/src/recognize.cpp b/recognize/src/recognize.cpp index 44111bb..8d55fda 100644 --- a/recognize/src/recognize.cpp +++ b/recognize/src/recognize.cpp @@ -292,7 +292,7 @@ void Recognize::generateConfidence() { scores.push_back(avgScores/sizeAvgScores); }else if(pass==0){ - notifyListeners((char*) "SENTENCA_COM_BAIXA_QUALIDADE", 0); + notifyListeners((char*) "SENTENCA COM BAIXA QUALIDADE", 0); notifyEndExtraction(count_lines); return; } @@ -412,9 +412,9 @@ void Recognize::cleanFiles() { void Recognize::createDir(){ - string command = "mkdir "; + string command = "mkdir -p "; command.append(path_contents).append("/").append(id).append("/audio") - .append(" && mkdir ").append(path_contents).append("/").append(id).append("/audio/parts") - .append(" && mkdir ").append(path_contents).append("/").append(id).append("/audio/origin"); + .append(" && mkdir -p ").append(path_contents).append("/").append(id).append("/audio/parts") + .append(" && mkdir -p ").append(path_contents).append("/").append(id).append("/audio/origin"); system(command.c_str()); } diff --git a/renderer/src/renderer.cpp b/renderer/src/renderer.cpp index f28afc8..870900a 100644 --- a/renderer/src/renderer.cpp +++ b/renderer/src/renderer.cpp @@ -33,7 +33,7 @@ void Renderer::serverInitialize(){ command.append(" && ").append(render); system(command.c_str()); - sleep(5); + sleep(1); } void Renderer::receiveGlosa(std::string glosa, int64_t pts) { @@ -137,8 +137,8 @@ void Renderer::Run() { } void Renderer::render() { - string command = "avconv -loglevel quiet -framerate 30 -i "; - command.append(PATH_SCREENS).append("[\'").append(folder_id).append("\']").append("/frame_%d.png ") + string command = "ffmpeg -loglevel quiet -framerate 30 -i "; + command.append(PATH_SCREENS).append(folder_id).append("/frame_%d.png ") .append("-vcodec libx264 -pix_fmt yuv420p ").append(path_video); system(command.c_str()); notifyListeners(); diff --git a/servico/src/include/serviceWindowGeneration.h b/servico/src/include/serviceWindowGeneration.h index 3a3feac..0b4e371 100644 --- a/servico/src/include/serviceWindowGeneration.h +++ b/servico/src/include/serviceWindowGeneration.h @@ -22,8 +22,8 @@ #define PRODUCTION "prod" #define PATH_DEVEL_CONTENTS "vlibras_user/vlibras-contents/videos" #define PATH_DEVEL_UPLOADS "vlibras_user/vlibras-contents/uploads" -#define PATH_VBOX_UPLOADS "vlibras_user/.vlibras-conf/uploads" -#define PATH_CONF_FILE "vlibras_user/.vlibras-conf/params.json" +#define PATH_VBOX_UPLOADS "vlibras_user/.vlibras-config/uploads" +#define PATH_CONF_FILE "vlibras_user/.vlibras-config/params.json" #define MAX_SIZE_PATH 256 using namespace Json; diff --git a/servico/src/serviceWindowGenerationFromRec.cpp b/servico/src/serviceWindowGenerationFromRec.cpp index 79a12e7..f442a43 100644 --- a/servico/src/serviceWindowGenerationFromRec.cpp +++ b/servico/src/serviceWindowGenerationFromRec.cpp @@ -67,7 +67,8 @@ void ServiceWindowGenerationFromRec::setPathContents(){ conf_file.close(); throw ServiceException("Fail to parsing param.json"); } - string attr = root.get("storage", PATH_VBOX_UPLOADS).asString(); + string attr = "vlibras_user/"; + attr += root.get("storage", PATH_VBOX_UPLOADS).asString(); this->path_contents = new char[MAX_SIZE_PATH]; strcpy(this->path_contents, attr.c_str()); this->path_uploads = PATH_VBOX_UPLOADS; @@ -137,8 +138,7 @@ void ServiceWindowGenerationFromRec::notifyTranslation(vector * glosas) }catch(lavidlib::RuntimeException &ex){ throw ServiceException(ex.getMessage().c_str()); } - vetor_pts->erase(vetor_pts->begin()); - legendas_enviadas++; + vetor_pts->erase(vetor_pts->begin()); } void ServiceWindowGenerationFromRec::notifyEndOfRenderization() { diff --git a/servico/src/serviceWindowGenerationFromSRT.cpp b/servico/src/serviceWindowGenerationFromSRT.cpp index 597863e..091c344 100644 --- a/servico/src/serviceWindowGenerationFromSRT.cpp +++ b/servico/src/serviceWindowGenerationFromSRT.cpp @@ -69,8 +69,10 @@ void ServiceWindowGenerationFromSRT::setPathContents() { conf_file.close(); throw ServiceException("Fail to parsing param.json"); } - string attr = root.get("storage", PATH_VBOX_UPLOADS).asString(); + string attr = "vlibras_user/"; + attr += root.get("storage", PATH_VBOX_UPLOADS).asString(); this->path_contents = new char[MAX_SIZE_PATH]; + strcpy(this->path_contents, attr.c_str()); this->path_uploads = PATH_VBOX_UPLOADS; conf_file.close(); @@ -142,7 +144,6 @@ void ServiceWindowGenerationFromSRT::notifyTranslation(vector * glosas) throw ServiceException(ex.getMessage().c_str()); } vetor_pts->erase(vetor_pts->begin()); - legendas_enviadas++; } void ServiceWindowGenerationFromSRT::notifyEndOfRenderization() { diff --git a/servico/src/serviceWindowGenerationFromText.cpp b/servico/src/serviceWindowGenerationFromText.cpp index b28c3f8..1f33764 100644 --- a/servico/src/serviceWindowGenerationFromText.cpp +++ b/servico/src/serviceWindowGenerationFromText.cpp @@ -39,7 +39,8 @@ void ServiceWindowGenerationFromText::setPathContents() { if(!parsingSuccessful){ throw new RuntimeException("Fail to parsing param.json"); } - string attr = root.get("storage", PATH_VBOX_UPLOADS).asString(); + string attr = "vlibras_user/"; + attr += root.get("storage", PATH_VBOX_UPLOADS).asString(); this->path_contents = new char[MAX_SIZE_PATH]; strcpy(this->path_contents, attr.c_str()); //this->path_uploads = PATH_VBOX_UPLOADS; -- libgit2 0.21.2