forked from markus/S_New4
v3.7.7: fix no color 033[0m to ""
This commit is contained in:
parent
a1098b29e8
commit
86f89f1f04
@ -81,7 +81,7 @@ struct Settings {
|
|||||||
proxy_ip = "127.0.0.1",
|
proxy_ip = "127.0.0.1",
|
||||||
languages = "GerDub,GerSub,Eng,",
|
languages = "GerDub,GerSub,Eng,",
|
||||||
genaueHoster = "",
|
genaueHoster = "",
|
||||||
version = "3.7.6",
|
version = "3.7.7",
|
||||||
defaultFileVersion="1.7",
|
defaultFileVersion="1.7",
|
||||||
outputFilePath = "",
|
outputFilePath = "",
|
||||||
default_checkPath = "",
|
default_checkPath = "",
|
||||||
|
@ -76,12 +76,13 @@ void * threadFunction(void * data) {
|
|||||||
std::string green = ((myThreadData->settings->colorless) ? "" : "\033[32m"),
|
std::string green = ((myThreadData->settings->colorless) ? "" : "\033[32m"),
|
||||||
red = ((myThreadData->settings->colorless) ? "" : "\033[31m"),
|
red = ((myThreadData->settings->colorless) ? "" : "\033[31m"),
|
||||||
orange =((myThreadData->settings->colorless) ? "" : "\033[33m"),
|
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 == "") {
|
if(Link == "") {
|
||||||
//Wenn gar keine Links vorhanden sind:
|
//Wenn gar keine Links vorhanden sind:
|
||||||
if(allLinks == "") {
|
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->pageManager->writeToFile(myThreadData->settings->outputFilePath, std::string("KEINEN Hoster für die Folge ") + folgenID + std::string(" gefunden.")) != 0) {
|
||||||
if(myThreadData->settings->debugMode)
|
if(myThreadData->settings->debugMode)
|
||||||
std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": writeToFile Function failed." << std::endl;
|
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:
|
//Wenn nur kein passender Link gefunden wurde:
|
||||||
} else {
|
} 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"
|
+ "Alle Links:" + "\n"
|
||||||
+ myThreadData->pageManager->replace(
|
+ myThreadData->pageManager->replace(
|
||||||
myThreadData->pageManager->replace( myThreadData->pageManager->replace( allLinks, "data-lang-key=\"1\"", "language=\"GerDub\"" ),
|
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
|
// get NO-Redirect Link after getUrlAfterRedirect Function
|
||||||
} else {
|
} else {
|
||||||
myThreadData->returnValue = " => " + folgenID + ( (folgenID == "") ? "" : ": " ) + green + newUrl + "\033[0m";
|
myThreadData->returnValue = " => " + folgenID + ( (folgenID == "") ? "" : ": " ) + green + newUrl + clearColor;
|
||||||
if(myThreadData->settings->outputFilePath != "") {
|
if(myThreadData->settings->outputFilePath != "") {
|
||||||
if(myThreadData->pageManager->writeToFile(myThreadData->settings->outputFilePath,folgenID + ( (folgenID == "") ? "" : ": " ) + newUrl) != 0) {
|
if(myThreadData->pageManager->writeToFile(myThreadData->settings->outputFilePath,folgenID + ( (folgenID == "") ? "" : ": " ) + newUrl) != 0) {
|
||||||
if(myThreadData->settings->debugMode)
|
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->settings->outputFilePath != "")
|
||||||
if(myThreadData->pageManager->writeToFile(myThreadData->settings->outputFilePath, folgenID + ( (folgenID == "") ? "" : ": " ) + Link) != 0) {
|
if(myThreadData->pageManager->writeToFile(myThreadData->settings->outputFilePath, folgenID + ( (folgenID == "") ? "" : ": " ) + Link) != 0) {
|
||||||
if(myThreadData->settings->debugMode)
|
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
|
//Gib nachricht nicht aus wenn nur diffday verlangt wird
|
||||||
if(!days) {
|
if(!days) {
|
||||||
std::cout << ((settings->colorless) ? "" : "\033[93m") << " => Warnung: SerienListe wurde zuletzt vor " << difDays << " Tagen aktualisiert."
|
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
|
//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"),
|
Lightyellow = ((settings->colorless) ? "" : "\033[93m"),
|
||||||
Darkyellow = ((settings->colorless) ? "" : "\033[33m"),
|
Darkyellow = ((settings->colorless) ? "" : "\033[33m"),
|
||||||
blue = ((settings->colorless) ? "" : "\033[96m"),
|
blue = ((settings->colorless) ? "" : "\033[96m"),
|
||||||
white = "\033[0m";
|
white = ((settings->colorless) ? "" : "\033[0m");
|
||||||
|
|
||||||
|
|
||||||
if( ! settings->skipEpisodenNameOutput) {
|
if( ! settings->skipEpisodenNameOutput) {
|
||||||
@ -1348,7 +1349,8 @@ int ProgramManager::searchModus_update(Settings *settings)
|
|||||||
|
|
||||||
//Vergeliche neue und alte list => entfernte Serien
|
//Vergeliche neue und alte list => entfernte Serien
|
||||||
if(line != "" && serienListe.find(line) == std::string::npos) {
|
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();
|
myFileBef.close();
|
||||||
@ -1372,7 +1374,8 @@ int ProgramManager::searchModus_update(Settings *settings)
|
|||||||
for(countAf = 0; std::getline(myFileAf,line); ++countAf) {
|
for(countAf = 0; std::getline(myFileAf,line); ++countAf) {
|
||||||
//Vergeliche neu mit Alt => gib neue Serien aus
|
//Vergeliche neu mit Alt => gib neue Serien aus
|
||||||
if(line != "" && alteListe.find(line) == std::string::npos) {
|
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();
|
myFileAf.close();
|
||||||
@ -1469,14 +1472,14 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou
|
|||||||
|
|
||||||
if(redirectLink == "" && settings->modus == Modus::DEFAULT_MODUS) {
|
if(redirectLink == "" && settings->modus == Modus::DEFAULT_MODUS) {
|
||||||
if(allLinks == "") {
|
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(pageManager.writeToFile(settings->outputFilePath, std::string("KEINEN Hoster für die Folge ") + folgenID + std::string(" gefunden.")) != 0) {
|
||||||
if(settings->debugMode)
|
if(settings->debugMode)
|
||||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl;
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl;
|
||||||
return 130;
|
return 130;
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
<< "Alle Links:" << std::endl
|
||||||
<< pageManager.replace( pageManager.replace( pageManager.replace( allLinks, "data-lang-key=\"1\"", "language=\"GerDub\"" ),
|
<< 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;
|
"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:
|
//wenn nach der Umwandlung https://s.to/ vorhanden ist, die ist wenn der Link Ungültig war:
|
||||||
} else if (newUrl == "https://s.to/") {
|
} 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(settings->outputFilePath != "")
|
||||||
if(pageManager.writeToFile(settings->outputFilePath, folgenID + ( (folgenID == "") ? "" : ": " ) + "Ungültige Url: https://s.to" + redirectLink) != 0) {
|
if(pageManager.writeToFile(settings->outputFilePath, folgenID + ( (folgenID == "") ? "" : ": " ) + "Ungültige Url: https://s.to" + redirectLink) != 0) {
|
||||||
if(settings->debugMode)
|
if(settings->debugMode)
|
||||||
@ -1521,7 +1525,7 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou
|
|||||||
return 0;
|
return 0;
|
||||||
//sonst war die umwandlung erfolgreich
|
//sonst war die umwandlung erfolgreich
|
||||||
} else {
|
} 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(settings->outputFilePath != "")
|
||||||
if(pageManager.writeToFile(settings->outputFilePath,folgenID + ( (folgenID == "") ? "" : ": " ) + newUrl) != 0) {
|
if(pageManager.writeToFile(settings->outputFilePath,folgenID + ( (folgenID == "") ? "" : ": " ) + newUrl) != 0) {
|
||||||
if(settings->debugMode)
|
if(settings->debugMode)
|
||||||
@ -1533,7 +1537,7 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou
|
|||||||
}
|
}
|
||||||
|
|
||||||
//nach 3temn Versuch gib error aus:
|
//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(settings->outputFilePath != "") {
|
||||||
if(pageManager.writeToFile(settings->outputFilePath, folgenID + ( (folgenID == "") ? "" : ": " ) + redirectLink) != 0) {
|
if(pageManager.writeToFile(settings->outputFilePath, folgenID + ( (folgenID == "") ? "" : ": " ) + redirectLink) != 0) {
|
||||||
if(settings->debugMode)
|
if(settings->debugMode)
|
||||||
|
Loading…
Reference in New Issue
Block a user