From a450f87e0de88fca24c283fc3e98bd1efdec459b Mon Sep 17 00:00:00 2001 From: Markus Date: Wed, 30 Oct 2019 16:32:30 +0100 Subject: [PATCH] 3.4.5: add colors to info function --- parameterManager.h | 2 +- programManager.cpp | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/parameterManager.h b/parameterManager.h index b7b0323..0c6a81f 100644 --- a/parameterManager.h +++ b/parameterManager.h @@ -63,7 +63,7 @@ struct Settings { proxy_ip = "127.0.0.1", languages = "GerDub,GerSub,Eng,", genaueHoster = "", - version = "3.4.4", + version = "3.4.5", defaultFileVersion="1.6", outputFilePath = "", default_checkPath = "", diff --git a/programManager.cpp b/programManager.cpp index 8845c6c..ad1ae96 100644 --- a/programManager.cpp +++ b/programManager.cpp @@ -739,7 +739,12 @@ int ProgramManager::infoModus(Settings *settings) } int gesammtFolge = 0; - + std::string green = ((settings->colorless) ? "" : "\033[92m"), + lila = ((settings->colorless) ? "" : "\033[95m"), + Lightyellow = ((settings->colorless) ? "" : "\033[93m"), + Darkyellow = ((settings->colorless) ? "" : "\033[33m"), + blue = ((settings->colorless) ? "" : "\033[96m"), + white = "\033[0m"; //speicher (zahl -1), ab da wo /staffel-x nicht mehr vorkommt int maxStaffel = pageManager.counterContains(tmp_reply.html, "/staffel-%i"); @@ -753,7 +758,7 @@ int ProgramManager::infoModus(Settings *settings) } std::cout << std::endl - << "Die Staffel " << staffel << " hat " << pageManager.counterContains(tmpReply.html, "/episode-%i") << " Folge(n)." << std::endl + << green << "Die Staffel " << staffel << " hat " << pageManager.counterContains(tmpReply.html, "/episode-%i") << " Folge(n)." << white << std::endl << std::endl; std::string html = tmpReply.html; @@ -774,6 +779,7 @@ int ProgramManager::infoModus(Settings *settings) std::stringstream folgenListe(html); std::string line; + while (std::getline(folgenListe, line).good()) { std::string titel; gesammtFolge = gesammtFolge + 1; @@ -787,9 +793,9 @@ int ProgramManager::infoModus(Settings *settings) std::cout << " => Error: Konnte Position von ' ' nicht finden." << std::endl; return 44; } - std::cout << "Ep. " << ( (gesammtFolge < 100) ? ( (gesammtFolge < 10) ? "00" : "0" ) : "" ) << gesammtFolge - << " ( S" << ( (staffel < 10) ? "0" : "" ) << staffel - << "E" << ( ( atoi( line.substr(0, pos).c_str() ) < 10) ? "0" : "" ) << line.substr(0, pos) << " ):" <")) == std::string::npos) { std::cout << " => Error: Konnte Position von '' nicht finden." << std::endl; @@ -802,7 +808,7 @@ int ProgramManager::infoModus(Settings *settings) } titel = line.substr(0, pos); if(titel != "") - std::cout << " > Titel 1: " << titel << std::endl; + std::cout << lila << " > Titel 1: " << Lightyellow << titel << white << std::endl; if( (pos = line.find("")) == std::string::npos) { std::cout << " => Error: Konnte Position von '' nicht finden." << std::endl; @@ -815,7 +821,7 @@ int ProgramManager::infoModus(Settings *settings) } titel = line.substr(0, pos); if(titel != "") - std::cout << " > Titel 2: " << titel << std::endl; + std::cout << lila << " > Titel 2: " << Darkyellow << titel << white << std::endl; } } @@ -907,16 +913,14 @@ int ProgramManager::infoModus(Settings *settings) std::string coverLink = line.substr(pos + 10, pos2 - pos -10); - - - std::cout << "Produktion von " << startStopDates[0] << " bis " << startStopDates[1] << std::endl - << "FSK: " << fsk << std::endl - << "Cover Bild: " << coverLink << std::endl - << "Genre(s): " << std::flush; + std::cout << lila << "Produktion von " << blue << startStopDates[0] << lila << " bis " << blue << startStopDates[1] << lila << std::endl + << "FSK: " << blue << fsk << lila << std::endl + << "Cover Bild: " << green << coverLink << lila << std::endl + << "Genre(s): " << blue << std::flush; for( const auto &e : genres) std::cout << e << " "; - std::cout << std::endl << "\nBeschreibung: " << description << std::endl; + std::cout << lila << std::endl << "\nBeschreibung: " << green << description << white << std::endl; if(settings->debugMode)