diff --git a/src/parameterManager.h b/src/parameterManager.h index c5bf563..8429d37 100644 --- a/src/parameterManager.h +++ b/src/parameterManager.h @@ -81,7 +81,7 @@ struct Settings { proxy_ip = "127.0.0.1", languages = "GerDub,GerSub,Eng,", genaueHoster = "", - version = "3.7.6", + version = "3.7.7", defaultFileVersion="1.7", outputFilePath = "", default_checkPath = "", diff --git a/src/programManager.cpp b/src/programManager.cpp index 4dcf221..c59ddfc 100644 --- a/src/programManager.cpp +++ b/src/programManager.cpp @@ -76,12 +76,13 @@ void * threadFunction(void * data) { std::string green = ((myThreadData->settings->colorless) ? "" : "\033[32m"), red = ((myThreadData->settings->colorless) ? "" : "\033[31m"), orange =((myThreadData->settings->colorless) ? "" : "\033[33m"), - blue = ((myThreadData->settings->colorless) ? "" : "\033[34m"); + blue = ((myThreadData->settings->colorless) ? "" : "\033[34m"), + clearColor = ((myThreadData->settings->colorless) ? "" : "\033[0m"); if(Link == "") { //Wenn gar keine Links vorhanden sind: if(allLinks == "") { - myThreadData->returnValue = " => " + red + "KEINEN Hoster für die Folge " + folgenID + " gefunden." + "\033[0m"; + myThreadData->returnValue = " => " + red + "KEINEN Hoster für die Folge " + folgenID + " gefunden." + clearColor; if(myThreadData->pageManager->writeToFile(myThreadData->settings->outputFilePath, std::string("KEINEN Hoster für die Folge ") + folgenID + std::string(" gefunden.")) != 0) { if(myThreadData->settings->debugMode) std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": writeToFile Function failed." << std::endl; @@ -89,7 +90,7 @@ void * threadFunction(void * data) { } //Wenn nur kein passender Link gefunden wurde: } else { - myThreadData->returnValue = " => " + orange + "Keinen PASSENDEN Hoster für die Folge " + folgenID + " gefunden." + "\033[0m" + "\n" + myThreadData->returnValue = " => " + orange + "Keinen PASSENDEN Hoster für die Folge " + folgenID + " gefunden." + clearColor + "\n" + "Alle Links:" + "\n" + myThreadData->pageManager->replace( myThreadData->pageManager->replace( myThreadData->pageManager->replace( allLinks, "data-lang-key=\"1\"", "language=\"GerDub\"" ), @@ -127,7 +128,7 @@ void * threadFunction(void * data) { // get NO-Redirect Link after getUrlAfterRedirect Function } else { - myThreadData->returnValue = " => " + folgenID + ( (folgenID == "") ? "" : ": " ) + green + newUrl + "\033[0m"; + myThreadData->returnValue = " => " + folgenID + ( (folgenID == "") ? "" : ": " ) + green + newUrl + clearColor; if(myThreadData->settings->outputFilePath != "") { if(myThreadData->pageManager->writeToFile(myThreadData->settings->outputFilePath,folgenID + ( (folgenID == "") ? "" : ": " ) + newUrl) != 0) { if(myThreadData->settings->debugMode) @@ -141,7 +142,7 @@ void * threadFunction(void * data) { } } - myThreadData->returnValue = " => " + folgenID + ( (folgenID == "") ? "" : ": " ) + red + "https://s.to" + Link + "\033[0m"; + myThreadData->returnValue = " => " + folgenID + ( (folgenID == "") ? "" : ": " ) + red + "https://s.to" + Link + clearColor; if(myThreadData->settings->outputFilePath != "") if(myThreadData->pageManager->writeToFile(myThreadData->settings->outputFilePath, folgenID + ( (folgenID == "") ? "" : ": " ) + Link) != 0) { if(myThreadData->settings->debugMode) @@ -320,7 +321,7 @@ int ProgramManager::checkLastUpdate(Settings *settings, ssize_t *days = nullptr) //Gib nachricht nicht aus wenn nur diffday verlangt wird if(!days) { std::cout << ((settings->colorless) ? "" : "\033[93m") << " => Warnung: SerienListe wurde zuletzt vor " << difDays << " Tagen aktualisiert." - << std::endl << " Mit '" << settings->programName << " search -u' kannst du die Liste aktualisieren." << "\033[0m" << std::endl; + << std::endl << " Mit '" << settings->programName << " search -u' kannst du die Liste aktualisieren." << ((settings->colorless) ? "" : "\033[0m") << std::endl; } } //Wenn keine Ausgabe, sondern nur Tage gespeichgtert werden sollen(days != nullptr), speicher diffdays darin @@ -783,7 +784,7 @@ int ProgramManager::infoModus(Settings *settings) Lightyellow = ((settings->colorless) ? "" : "\033[93m"), Darkyellow = ((settings->colorless) ? "" : "\033[33m"), blue = ((settings->colorless) ? "" : "\033[96m"), - white = "\033[0m"; + white = ((settings->colorless) ? "" : "\033[0m"); if( ! settings->skipEpisodenNameOutput) { @@ -1348,7 +1349,8 @@ int ProgramManager::searchModus_update(Settings *settings) //Vergeliche neue und alte list => entfernte Serien if(line != "" && serienListe.find(line) == std::string::npos) { - std::cout << ((settings->colorless) ? "" : "\033[91m") << "Entfernt: '" << line.substr(line.find_last_of("|") + 1) << "'" << "\033[0m" << std::endl; + std::cout << ((settings->colorless) ? "" : "\033[91m") << "Entfernt: '" << line.substr(line.find_last_of("|") + 1) << "'" << ((settings->colorless) ? "" : "\033[0m") + << std::endl; } } myFileBef.close(); @@ -1372,7 +1374,8 @@ int ProgramManager::searchModus_update(Settings *settings) for(countAf = 0; std::getline(myFileAf,line); ++countAf) { //Vergeliche neu mit Alt => gib neue Serien aus if(line != "" && alteListe.find(line) == std::string::npos) { - std::cout << ((settings->colorless) ? "" : "\033[92m") << "Neu: '" << line.substr(line.find_last_of("|") + 1) << "'" << "\033[0m" << std::endl; + std::cout << ((settings->colorless) ? "" : "\033[92m") << "Neu: '" << line.substr(line.find_last_of("|") + 1) << "'" << ((settings->colorless) ? "" : "\033[0m") + << std::endl; } } myFileAf.close(); @@ -1469,14 +1472,14 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou if(redirectLink == "" && settings->modus == Modus::DEFAULT_MODUS) { if(allLinks == "") { - std::cout << " => " << red << "KEINEN Hoster für die Folge " << folgenID << " gefunden." << "\033[0m" << std::endl; + std::cout << " => " << red << "KEINEN Hoster für die Folge " << folgenID << " gefunden." << ((settings->colorless) ? "" : "\033[0m") << std::endl; if(pageManager.writeToFile(settings->outputFilePath, std::string("KEINEN Hoster für die Folge ") + folgenID + std::string(" gefunden.")) != 0) { if(settings->debugMode) std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; return 130; } } else { - std::cout << " => " << orange << "Keinen PASSENDEN Hoster für die Folge " << folgenID << " gefunden." << "\033[0m" << std::endl + std::cout << " => " << orange << "Keinen PASSENDEN Hoster für die Folge " << folgenID << " gefunden." << ((settings->colorless) ? "" : "\033[0m") << std::endl << "Alle Links:" << std::endl << pageManager.replace( pageManager.replace( pageManager.replace( allLinks, "data-lang-key=\"1\"", "language=\"GerDub\"" ), "data-lang-key=\"2\"", "language=\"Eng\"" ), "data-lang-key=\"3\"", "language=\"GerSub\"") << std::endl; @@ -1511,7 +1514,8 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou //wenn nach der Umwandlung https://s.to/ vorhanden ist, die ist wenn der Link Ungültig war: } else if (newUrl == "https://s.to/") { - std::cout << " => " << red << folgenID << ( (folgenID == "") ? "" : ": " ) << "Ungültige Url: 'https://s.to" << redirectLink << "'\033[0m" << std::endl; + std::cout << " => " << red << folgenID << ( (folgenID == "") ? "" : ": " ) << "Ungültige Url: 'https://s.to" << redirectLink << "'" + << ((settings->colorless) ? "" : "\033[0m") << std::endl; if(settings->outputFilePath != "") if(pageManager.writeToFile(settings->outputFilePath, folgenID + ( (folgenID == "") ? "" : ": " ) + "Ungültige Url: https://s.to" + redirectLink) != 0) { if(settings->debugMode) @@ -1521,7 +1525,7 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou return 0; //sonst war die umwandlung erfolgreich } else { - std::cout << " => " << folgenID << ( (folgenID == "") ? "" : ": " ) << green << newUrl << "\033[0m" << std::endl; + std::cout << " => " << folgenID << ( (folgenID == "") ? "" : ": " ) << green << newUrl << ((settings->colorless) ? "" : "\033[0m") << std::endl; if(settings->outputFilePath != "") if(pageManager.writeToFile(settings->outputFilePath,folgenID + ( (folgenID == "") ? "" : ": " ) + newUrl) != 0) { if(settings->debugMode) @@ -1533,7 +1537,7 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou } //nach 3temn Versuch gib error aus: - std::cout << " => " << folgenID << ( (folgenID == "") ? "" : ": " ) << red << "https://s.to" << redirectLink << "\033[0m" << std::endl; + std::cout << " => " << folgenID << ( (folgenID == "") ? "" : ": " ) << red << "https://s.to" << redirectLink << ((settings->colorless) ? "" : "\033[0m") << std::endl; if(settings->outputFilePath != "") { if(pageManager.writeToFile(settings->outputFilePath, folgenID + ( (folgenID == "") ? "" : ": " ) + redirectLink) != 0) { if(settings->debugMode)