v2.2.2 faster colormaking

This commit is contained in:
Markus 2019-08-17 13:54:24 +02:00
parent efcfc36ec7
commit 5fcd1fcce1
3 changed files with 14 additions and 4 deletions

View File

@ -143,7 +143,7 @@ std::string PageManager::checkName(std::string Name)
return "-1";
}
else {
std::cout << "boku-dake-ga-inai-machi > Name: " << name << std::endl;
std::cout << "\33[2K\r > Name: " << name << std::endl;
return name;
}
}

View File

@ -36,7 +36,7 @@ struct Settings {
proxy_ip = "127.0.0.1",
languages = "GerDub,GerSub,Eng",
genaueHoster = "Vivo,GoUnlimited",
version = "2.2.1",
version = "2.2.2",
outputFilePath = "",
default_checkDirPath = "",
default_Searchmuster = "S%Staffel%E%Folge%";

View File

@ -370,14 +370,24 @@ int ProgramManager::searchModus(Settings *settings)
std::string finds = pageManager.grep(serienListe, settings->name, settings->search_IgnoreUpperLower);
serienListe.clear(); // Speicher freigeben

//Text mit Farben versehen
/*//Text mit Farben versehen
if(!settings->colorless) {
for (size_t pos = pageManager.upper_string( finds ).find( pageManager.upper_string( settings->name ), 0);
pos != std::string::npos;
pos = pageManager.upper_string( finds ).find( pageManager.upper_string( settings->name ), pos + settings->name.length() + strlen("\033[37m\033[0m")))
finds.insert(pos, ( (finds.find(settings->name, pos) == pos) ? "\033[32m" : "\033[36m" ) ).insert(pos + settings->name.length() + strlen("\033[37m"), "\033[0m");
}
}*/

//Text mit Farben versehen
if(!settings->colorless) {
std::string UpperFinds = pageManager.upper_string( finds );
std::string UpperName = pageManager.upper_string( settings->name );
for (size_t pos = UpperFinds.find( UpperName, 0); pos != std::string::npos; pos = UpperFinds.find( UpperName, pos + settings->name.length() + strlen("\033[37m\033[0m"))) {
bool exaktGeschrieben = (finds.find(settings->name, pos) == pos);
finds.insert(pos, ( (exaktGeschrieben) ? "\033[32m" : "\033[36m" ) ).insert(pos + settings->name.length() + strlen("\033[37m"), "\033[0m");
UpperFinds.insert(pos, ( (exaktGeschrieben ) ? "\033[32m" : "\033[36m" ) ).insert(pos + settings->name.length() + strlen("\033[37m"), "\033[0m");
}
}
//Ausgabe
if(finds == "") {
std::cout << " => Für '" << settings->name << "' wurde(n) keine Serie(n) gefunden." << std::endl;